Standard inference and training with transformer based architectures scale quadratically with input sequence length. This is prohibitively large for a variety of applications especially in web-page translation, query-answering etc. Consequently, several approaches have been developed recently to speedup attention computation by enforcing different attention structures such as sparsity, low-rank, approximating attention using kernels. In this work, we view attention computation as that of nearest neighbor retrieval, and use decision tree based hierarchical navigation to reduce the retrieval cost per query token from linear in sequence length to nearly logarithmic. Based on such hierarchical navigation, we design Treeformer which can use one of two efficient attention layers -- TF-Attention and TC-Attention. TF-Attention computes the attention in a fine-grained style, while TC-Attention is a coarse attention layer which also ensures that the gradients are "dense". To optimize such challenging discrete layers, we propose a two-level bootstrapped training method. Using extensive experiments on standard NLP benchmarks, especially for long-sequences, we demonstrate that our Treeformer architecture can be almost as accurate as baseline Transformer while using 30x lesser FLOPs in the attention layer. Compared to Linformer, the accuracy can be as much as 12% higher while using similar FLOPs in the attention layer.


翻译:基于Transformer架构的标准推理与训练的计算复杂度随输入序列长度呈二次方增长。这在网页翻译、问答等多种应用中显得过于庞大。为此,近期涌现出若干通过强制注意力结构(如稀疏性、低秩性、利用核函数近似注意力)来加速注意力计算的方法。本研究将注意力计算视为最近邻检索问题,并采用基于决策树的层级导航,将每个查询令牌的检索成本从序列长度的线性关系降低至近对数关系。基于这种层级导航,我们设计了Treeformer,可采用两种高效注意力层之一——TF-Attention和TC-Attention。TF-Attention以细粒度方式计算注意力,而TC-Attention作为粗粒度注意力层,同时能确保梯度具有“密集性”。针对这类具有挑战性的离散层优化,我们提出了一种两级自举训练方法。通过在标准NLP基准测试(尤其针对长序列)上的大量实验,我们证明Treeformer架构在注意力层仅使用30倍更少FLOPs的条件下,其准确率几乎与基线Transformer相当。与Linformer相比,在注意力层使用相似FLOPs时,准确率最高可提升12%。

0
下载
关闭预览

相关内容

【ICML2022】基于自适应上下文池化的高效表示学习
专知会员服务
20+阅读 · 2022年7月9日
【Google】高效Transformer综述,Efficient Transformers: A Survey
专知会员服务
66+阅读 · 2022年3月17日
GNN 新基准!Long Range Graph Benchmark
图与推荐
0+阅读 · 2022年10月18日
BERT 瘦身之路:Distillation,Quantization,Pruning
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
强化学习的Unsupervised Meta-Learning
CreateAMind
18+阅读 · 2019年1月7日
无监督元学习表示学习
CreateAMind
27+阅读 · 2019年1月4日
从Seq2seq到Attention模型到Self Attention(二)
量化投资与机器学习
23+阅读 · 2018年10月9日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
A survey on deep hashing for image retrieval
Arxiv
15+阅读 · 2020年6月10日
Heterogeneous Graph Transformer
Arxiv
27+阅读 · 2020年3月3日
Self-Attention Graph Pooling
Arxiv
13+阅读 · 2019年6月13日
VIP会员
最新内容
在人工智能加速决策环境中拓展OODA循环
专知会员服务
0+阅读 · 21分钟前
军事欺骗:供作战战术指挥官使用的工具
专知会员服务
0+阅读 · 36分钟前
综述 | 世界动作模型:少做梦,多行动
专知会员服务
4+阅读 · 6月23日
美以伊冲突:无人机与人工智能的运用
专知会员服务
7+阅读 · 6月23日
《特种部队在透明战场中的生存力》最新报告
专知会员服务
4+阅读 · 6月23日
综述 | 3D场景图:开放挑战与未来方向
专知会员服务
8+阅读 · 6月22日
21世纪的无人机战争
专知会员服务
4+阅读 · 6月22日
相关资讯
GNN 新基准!Long Range Graph Benchmark
图与推荐
0+阅读 · 2022年10月18日
BERT 瘦身之路:Distillation,Quantization,Pruning
Hierarchically Structured Meta-learning
CreateAMind
27+阅读 · 2019年5月22日
强化学习的Unsupervised Meta-Learning
CreateAMind
18+阅读 · 2019年1月7日
无监督元学习表示学习
CreateAMind
27+阅读 · 2019年1月4日
从Seq2seq到Attention模型到Self Attention(二)
量化投资与机器学习
23+阅读 · 2018年10月9日
相关基金
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员