Transformers provide a class of expressive architectures that are extremely effective for sequence modeling. However, the key limitation of transformers is their quadratic memory and time complexity $\mathcal{O}(L^2)$ with respect to the sequence length in attention layers, which restricts application in extremely long sequences. Most existing approaches leverage sparsity or low-rank assumptions in the attention matrix to reduce cost, but sacrifice expressiveness. Instead, we propose Combiner, which provides full attention capability in each attention head while maintaining low computation and memory complexity. The key idea is to treat the self-attention mechanism as a conditional expectation over embeddings at each location, and approximate the conditional distribution with a structured factorization. Each location can attend to all other locations, either via direct attention, or through indirect attention to abstractions, which are again conditional expectations of embeddings from corresponding local regions. We show that most sparse attention patterns used in existing sparse transformers are able to inspire the design of such factorization for full attention, resulting in the same sub-quadratic cost ($\mathcal{O}(L\log(L))$ or $\mathcal{O}(L\sqrt{L})$). Combiner is a drop-in replacement for attention layers in existing transformers and can be easily implemented in common frameworks. An experimental evaluation on both autoregressive and bidirectional sequence tasks demonstrates the effectiveness of this approach, yielding state-of-the-art results on several image and text modeling tasks.


翻译:变压器提供了一组对序列建模极为有效的表达式结构。 然而,变压器的关键限制是其四级内存和时间复杂性$\mathcal{O}(L2/2)$(L2/2),相对于注意层的序列长度,这限制了在极长的序列中的应用。 大多数现有办法利用关注矩阵中的聚度或低位假设来降低成本,但牺牲表达性。 相反,我们提议组合器,它提供每个关注头部的完全关注能力,同时保持低度计算和记忆复杂性。关键的想法是将自留机制作为每个位置嵌入的有条件的预期,并且以结构化因子化而接近有条件的分布。每个地点都可以通过直接关注或通过间接关注来关注所有其它地点,这些地点也是对相关地区嵌入的有条件期望。 我们表明,现有稀薄变压器中最稀少的注意模式能够激发这种充分关注的因子化设计,从而导致相同的次夸度成本($/mathcal{O}(L\log) 和当前双级变压的变压值框架中的变压值(AL_BIL_Bal_) listrual_Bal_Bal_IL_IL_IL_IL_L_L_

1
下载
关闭预览

相关内容

Attention机制最早是在视觉图像领域提出来的,但是真正火起来应该算是google mind团队的这篇论文《Recurrent Models of Visual Attention》[14],他们在RNN模型上使用了attention机制来进行图像分类。随后,Bahdanau等人在论文《Neural Machine Translation by Jointly Learning to Align and Translate》 [1]中,使用类似attention的机制在机器翻译任务上将翻译和对齐同时进行,他们的工作算是是第一个提出attention机制应用到NLP领域中。接着类似的基于attention机制的RNN模型扩展开始应用到各种NLP任务中。最近,如何在CNN中使用attention机制也成为了大家的研究热点。下图表示了attention研究进展的大概趋势。
【ICLR2021】彩色化变换器,Colorization Transformer
专知会员服务
9+阅读 · 2021年2月9日
Transformer模型-深度学习自然语言处理,17页ppt
专知会员服务
102+阅读 · 2020年8月30日
因果图,Causal Graphs,52页ppt
专知会员服务
243+阅读 · 2020年4月19日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Hierarchically Structured Meta-learning
CreateAMind
24+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
27+阅读 · 2019年5月18日
Disentangled的假设的探讨
CreateAMind
9+阅读 · 2018年12月10日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
条件GAN重大改进!cGANs with Projection Discriminator
CreateAMind
8+阅读 · 2018年2月7日
【推荐】RNN/LSTM时序预测
机器学习研究会
25+阅读 · 2017年9月8日
【音乐】Attention
英语演讲视频每日一推
3+阅读 · 2017年8月22日
强化学习族谱
CreateAMind
26+阅读 · 2017年8月2日
Arxiv
0+阅读 · 2021年12月28日
Hyperbolic Graph Attention Network
Arxiv
6+阅读 · 2019年12月6日
Arxiv
6+阅读 · 2019年7月11日
Sparse Sequence-to-Sequence Models
Arxiv
5+阅读 · 2019年5月14日
Arxiv
5+阅读 · 2017年11月30日
VIP会员
相关资讯
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Hierarchically Structured Meta-learning
CreateAMind
24+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
27+阅读 · 2019年5月18日
Disentangled的假设的探讨
CreateAMind
9+阅读 · 2018年12月10日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
条件GAN重大改进!cGANs with Projection Discriminator
CreateAMind
8+阅读 · 2018年2月7日
【推荐】RNN/LSTM时序预测
机器学习研究会
25+阅读 · 2017年9月8日
【音乐】Attention
英语演讲视频每日一推
3+阅读 · 2017年8月22日
强化学习族谱
CreateAMind
26+阅读 · 2017年8月2日
相关论文
Arxiv
0+阅读 · 2021年12月28日
Hyperbolic Graph Attention Network
Arxiv
6+阅读 · 2019年12月6日
Arxiv
6+阅读 · 2019年7月11日
Sparse Sequence-to-Sequence Models
Arxiv
5+阅读 · 2019年5月14日
Arxiv
5+阅读 · 2017年11月30日
Top
微信扫码咨询专知VIP会员