Transformer-based models are popularly used in natural language processing (NLP). Its core component, self-attention, has aroused widespread interest. To understand the self-attention mechanism, a direct method is to visualize the attention map of a pre-trained model. Based on the patterns observed, a series of efficient Transformers with different sparse attention masks have been proposed. From a theoretical perspective, universal approximability of Transformer-based models is also recently proved. However, the above understanding and analysis of self-attention is based on a pre-trained model. To rethink the importance analysis in self-attention, we study the significance of different positions in attention matrix during pre-training. A surprising result is that diagonal elements in the attention map are the least important compared with other attention positions. We provide a proof showing that these diagonal elements can indeed be removed without deteriorating model performance. Furthermore, we propose a Differentiable Attention Mask (DAM) algorithm, which further guides the design of the SparseBERT. Extensive experiments verify our interesting findings and illustrate the effect of the proposed algorithm.


翻译:在自然语言处理(NLP)中广泛使用基于变压器的模型。其核心组成部分,即自我注意,引起了广泛的兴趣。为了了解自我注意机制,直接的方法是直观地描绘一个经过训练的模型的注意图。根据观察到的模式,提出了一系列高效的变压器,其关注面面不同。从理论上看,基于变压器的模型的普遍接近性最近也得到证明。但是,上述对自我注意的理解和分析是以预先训练的模式为基础的。为了重新思考自我注意的重要性分析,我们研究了在训练前的注意矩阵中不同位置的重要性。一个令人惊讶的结果是,与其它注意位置相比,注意图中的对角要素是最不重要的。我们提供的证据表明,这些对角要素确实可以消除,而不会使模型性能恶化。此外,我们建议一种差异式的注意面具算法,进一步指导SparchaBERT的设计。广泛的实验证实了我们有趣的调查结果,并说明了提议的算法的效果。

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研究进展的大概趋势。
专知会员服务
36+阅读 · 2021年5月15日
最新《Transformers模型》教程,64页ppt
专知会员服务
276+阅读 · 2020年11月26日
【ICLR 2019】双曲注意力网络,Hyperbolic  Attention Network
专知会员服务
82+阅读 · 2020年6月21日
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
ExBert — 可视化分析Transformer学到的表示
专知会员服务
30+阅读 · 2019年10月16日
强化学习最新教程,17页pdf
专知会员服务
168+阅读 · 2019年10月11日
【哈佛大学商学院课程Fall 2019】机器学习可解释性
专知会员服务
99+阅读 · 2019年10月9日
令人心动的offer之微软苏州篇
微软招聘
4+阅读 · 2020年11月27日
意识是一种数学模式
CreateAMind
3+阅读 · 2019年6月24日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
Disentangled的假设的探讨
CreateAMind
9+阅读 · 2018年12月10日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
可解释的CNN
CreateAMind
17+阅读 · 2017年10月5日
Arxiv
0+阅读 · 2021年9月3日
Arxiv
3+阅读 · 2020年9月30日
Arxiv
6+阅读 · 2019年4月8日
VIP会员
相关VIP内容
专知会员服务
36+阅读 · 2021年5月15日
最新《Transformers模型》教程,64页ppt
专知会员服务
276+阅读 · 2020年11月26日
【ICLR 2019】双曲注意力网络,Hyperbolic  Attention Network
专知会员服务
82+阅读 · 2020年6月21日
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
ExBert — 可视化分析Transformer学到的表示
专知会员服务
30+阅读 · 2019年10月16日
强化学习最新教程,17页pdf
专知会员服务
168+阅读 · 2019年10月11日
【哈佛大学商学院课程Fall 2019】机器学习可解释性
专知会员服务
99+阅读 · 2019年10月9日
相关资讯
令人心动的offer之微软苏州篇
微软招聘
4+阅读 · 2020年11月27日
意识是一种数学模式
CreateAMind
3+阅读 · 2019年6月24日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
Disentangled的假设的探讨
CreateAMind
9+阅读 · 2018年12月10日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
可解释的CNN
CreateAMind
17+阅读 · 2017年10月5日
Top
微信扫码咨询专知VIP会员