Recently, it has been argued that encoder-decoder models can be made more interpretable by replacing the softmax function in the attention with its sparse variants. In this work, we introduce a novel, simple method for achieving sparsity in attention: we replace the softmax activation with a ReLU, and show that sparsity naturally emerges from such a formulation. Training stability is achieved with layer normalization with either a specialized initialization or an additional gating function. Our model, which we call Rectified Linear Attention (ReLA), is easy to implement and more efficient than previously proposed sparse attention mechanisms. We apply ReLA to the Transformer and conduct experiments on five machine translation tasks. ReLA achieves translation performance comparable to several strong baselines, with training and decoding speed similar to that of the vanilla attention. Our analysis shows that ReLA delivers high sparsity rate and head diversity, and the induced cross attention achieves better accuracy with respect to source-target word alignment than recent sparsified softmax-based models. Intriguingly, ReLA heads also learn to attend to nothing (i.e. 'switch off') for some queries, which is not possible with sparsified softmax alternatives.


翻译:最近,有人争论说,通过以其稀少的变体来取代关注点中的软max函数,可以使编码器-解码器模型更容易解释。在这项工作中,我们引入了一种创新的简单方法,以引起注意的宽度:我们用RELU取代软式马克思激活,并表明从这种配方中自然会出现宽度。通过专门初始化或额外的加格功能,通过层级正常化实现培训稳定。我们称之为校正线性注意(ReLA)的模型更容易执行,比以前提议的微量注意机制更高效。我们把ReLA应用到变异器上,并对5个机器翻译任务进行实验。ReLA的翻译性能与几个强的基线相当,培训和解码速度与香草的注意相似。我们的分析表明,RELA提供较高的吸附率和头部多样性,而引人注意在源-目标字对齐方面比最近的软式调软式模型更加准确。我们不感知,ReLA头也学习不易变的软件。

0
下载
关闭预览

相关内容

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研究进展的大概趋势。
【NUS-Xavier教授】注意力神经网络,79页ppt
专知会员服务
61+阅读 · 2021年11月25日
最新《Transformers模型》教程,64页ppt
专知会员服务
278+阅读 · 2020年11月26日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
76+阅读 · 2020年7月26日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
一文读懂Attention机制
机器学习与推荐算法
63+阅读 · 2020年6月9日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
Ray RLlib: Scalable 降龙十八掌
CreateAMind
8+阅读 · 2018年12月28日
Jointly Improving Summarization and Sentiment Classification
黑龙江大学自然语言处理实验室
3+阅读 · 2018年6月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
TensorFlow seq2seq中的Attention机制(续)
深度学习每日摘要
15+阅读 · 2017年11月16日
论文共读 | Attention is All You Need
黑龙江大学自然语言处理实验室
14+阅读 · 2017年9月7日
【音乐】Attention
英语演讲视频每日一推
3+阅读 · 2017年8月22日
【学习】Hierarchical Softmax
机器学习研究会
4+阅读 · 2017年8月6日
Attention is All You Need | 每周一起读
PaperWeekly
10+阅读 · 2017年6月28日
Arxiv
3+阅读 · 2020年9月30日
Talking-Heads Attention
Arxiv
15+阅读 · 2020年3月5日
LARNN: Linear Attention Recurrent Neural Network
Arxiv
5+阅读 · 2018年8月16日
Arxiv
19+阅读 · 2018年3月28日
Arxiv
26+阅读 · 2017年12月6日
VIP会员
相关VIP内容
【NUS-Xavier教授】注意力神经网络,79页ppt
专知会员服务
61+阅读 · 2021年11月25日
最新《Transformers模型》教程,64页ppt
专知会员服务
278+阅读 · 2020年11月26日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
76+阅读 · 2020年7月26日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
相关资讯
一文读懂Attention机制
机器学习与推荐算法
63+阅读 · 2020年6月9日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
Ray RLlib: Scalable 降龙十八掌
CreateAMind
8+阅读 · 2018年12月28日
Jointly Improving Summarization and Sentiment Classification
黑龙江大学自然语言处理实验室
3+阅读 · 2018年6月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
TensorFlow seq2seq中的Attention机制(续)
深度学习每日摘要
15+阅读 · 2017年11月16日
论文共读 | Attention is All You Need
黑龙江大学自然语言处理实验室
14+阅读 · 2017年9月7日
【音乐】Attention
英语演讲视频每日一推
3+阅读 · 2017年8月22日
【学习】Hierarchical Softmax
机器学习研究会
4+阅读 · 2017年8月6日
Attention is All You Need | 每周一起读
PaperWeekly
10+阅读 · 2017年6月28日
相关论文
Arxiv
3+阅读 · 2020年9月30日
Talking-Heads Attention
Arxiv
15+阅读 · 2020年3月5日
LARNN: Linear Attention Recurrent Neural Network
Arxiv
5+阅读 · 2018年8月16日
Arxiv
19+阅读 · 2018年3月28日
Arxiv
26+阅读 · 2017年12月6日
Top
微信扫码咨询专知VIP会员