Transformers are state-of-the-art models for a variety of sequence modeling tasks. At their core is an attention function which models pairwise interactions between the inputs at every timestep. While attention is powerful, it does not scale efficiently to long sequences due to its quadratic time and space complexity in the sequence length. We propose RFA, a linear time and space attention that uses random feature methods to approximate the softmax function, and explore its application in transformers. RFA can be used as a drop-in replacement for conventional softmax attention and offers a straightforward way of learning with recency bias through an optional gating mechanism. Experiments on language modeling and machine translation demonstrate that RFA achieves similar or better performance compared to strong transformer baselines. In the machine translation experiment, RFA decodes twice as fast as a vanilla transformer. Compared to existing efficient transformer variants, RFA is competitive in terms of both accuracy and efficiency on three long text classification datasets. Our analysis shows that RFA's efficiency gains are especially notable on long sequences, suggesting that RFA will be particularly useful in tasks that require working with large inputs, fast decoding speed, or low memory footprints.


翻译:最先进的变异器是各种序列建模任务的最新模型。 在其核心部分, 是一个关注功能, 模型在每一时间步骤中对投入的相互作用进行配对。 虽然注意是强大的, 但由于其四边时间和序列长度的空间复杂性, 它并没有有效地向长序列扩展。 我们建议RFA, 一个使用随机特征方法来接近软模功能的线性时间和空间关注, 并探索其在变压器中的应用。 RFA可以用作常规软体关注的低位替代器, 并且通过一个可选的格子机制, 提供一个直截了当的学习方式, 透视性偏差。 关于语言建模和机器翻译的实验表明, RFA 与强的变异器基线相比, 具有相似或更好的性能。 在机器翻译实验中, RFA 解码速度是香草变异体的两倍。 与现有的高效变异体相比, RFA 在三个长的文本分类数据集的准确性和效率方面具有竞争力。 我们的分析表明, RFA 效率的增益在长序列上特别明显, 表明, 意味着REFAA 将特别有用, 与高的存储速度。

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研究进展的大概趋势。
注意力机制综述
专知会员服务
83+阅读 · 2021年1月26日
【清华大学】图随机神经网络,Graph Random Neural Networks
专知会员服务
156+阅读 · 2020年5月26日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
41+阅读 · 2019年10月9日
一文读懂Attention机制
机器学习与推荐算法
63+阅读 · 2020年6月9日
Hierarchically Structured Meta-learning
CreateAMind
26+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
28+阅读 · 2019年5月18日
从Seq2seq到Attention模型到Self Attention(二)
量化投资与机器学习
23+阅读 · 2018年10月9日
LibRec 精选:基于LSTM的序列推荐实现(PyTorch)
LibRec智能推荐
50+阅读 · 2018年8月27日
计算机视觉领域顶会CVPR 2018 接受论文列表
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
计算机视觉近一年进展综述
机器学习研究会
9+阅读 · 2017年11月25日
Capsule Networks解析
机器学习研究会
11+阅读 · 2017年11月12日
Talking-Heads Attention
Arxiv
15+阅读 · 2020年3月5日
On Feature Normalization and Data Augmentation
Arxiv
15+阅读 · 2020年2月25日
Efficient and Effective $L_0$ Feature Selection
Arxiv
5+阅读 · 2018年8月7日
Arxiv
23+阅读 · 2017年3月9日
VIP会员
相关VIP内容
相关资讯
一文读懂Attention机制
机器学习与推荐算法
63+阅读 · 2020年6月9日
Hierarchically Structured Meta-learning
CreateAMind
26+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
28+阅读 · 2019年5月18日
从Seq2seq到Attention模型到Self Attention(二)
量化投资与机器学习
23+阅读 · 2018年10月9日
LibRec 精选:基于LSTM的序列推荐实现(PyTorch)
LibRec智能推荐
50+阅读 · 2018年8月27日
计算机视觉领域顶会CVPR 2018 接受论文列表
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
计算机视觉近一年进展综述
机器学习研究会
9+阅读 · 2017年11月25日
Capsule Networks解析
机器学习研究会
11+阅读 · 2017年11月12日
Top
微信扫码咨询专知VIP会员