Transformers have outperformed recurrent neural networks (RNNs) in natural language generation. But this comes with a significant computational cost, as the attention mechanism's complexity scales quadratically with sequence length. Efficient transformer variants have received increasing interest in recent works. Among them, a linear-complexity recurrent variant has proven well suited for autoregressive generation. It approximates the softmax attention with randomized or heuristic feature maps, but can be difficult to train and may yield suboptimal accuracy. This work aims to convert a pretrained transformer into its efficient recurrent counterpart, improving efficiency while maintaining accuracy. Specifically, we propose a swap-then-finetune procedure: in an off-the-shelf pretrained transformer, we replace the softmax attention with its linear-complexity recurrent alternative and then finetune. With a learned feature map, our approach provides an improved tradeoff between efficiency and accuracy over the standard transformer and other recurrent variants. We also show that the finetuning process has lower training cost relative to training these recurrent variants from scratch. As many models for natural language tasks are increasingly dependent on large-scale pretrained transformers, this work presents a viable approach to improving inference efficiency without repeating the expensive pretraining process.


翻译:在自然语言生成中,变异器比正常神经网络(RNNS)的正常神经网络(RNNS)要好得多。但是,这需要大量计算成本,因为注意机制的复杂度以序列长度为四倍。高效变异器对最近的工程越来越感兴趣。其中,线性复杂变异器被证明非常适合自动递减生成。它与随机化或超常特征图相近,但可能难以培训软性关注,并可能产生不最优化的准确性。这项工作的目的是将预先训练的变异器转换成高效的经常对等器,提高效率,同时保持准确性。具体地说,我们提议一个交换-正对式变异器程序:在现成的先变异器中,我们用其线性兼容性复变异器取代软性变异体,然后进行微调。我们的方法通过一个有知识的地貌图,改善了标准变异器和其他经常变异器的效率和准确性之间的权衡。我们还表明,微调过程比培训这些经常变异器更低的培训费用。我们建议采用一个具体地说,因为许多自然语言变式变式的变换方法越来越依赖高的变换方法,而不用前的变压法。

0
下载
关闭预览

相关内容

专知会员服务
22+阅读 · 2021年9月20日
【ICML2021】具有线性复杂度的Transformer的相对位置编码
专知会员服务
24+阅读 · 2021年5月20日
专知会员服务
58+阅读 · 2021年2月16日
【AAAI2021】记忆门控循环网络
专知会员服务
47+阅读 · 2020年12月28日
最新《Transformers模型》教程,64页ppt
专知会员服务
274+阅读 · 2020年11月26日
Transformer模型-深度学习自然语言处理,17页ppt
专知会员服务
97+阅读 · 2020年8月30日
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
56+阅读 · 2019年10月17日
Transformer中的相对位置编码
AINLP
5+阅读 · 2020年11月28日
命名实体识别新SOTA:改进Transformer模型
AI科技评论
17+阅读 · 2019年11月26日
基于PyTorch/TorchText的自然语言处理库
专知
27+阅读 · 2019年4月22日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
【推荐】RNN最新研究进展综述
机器学习研究会
25+阅读 · 2018年1月6日
可解释的CNN
CreateAMind
17+阅读 · 2017年10月5日
【推荐】用Tensorflow理解LSTM
机器学习研究会
36+阅读 · 2017年9月11日
最佳实践:深度学习用于自然语言处理(三)
待字闺中
3+阅读 · 2017年8月20日
Arxiv
17+阅读 · 2021年3月29日
Arxiv
5+阅读 · 2019年8月22日
Arxiv
6+阅读 · 2019年7月11日
Arxiv
6+阅读 · 2019年3月19日
Universal Transformers
Arxiv
5+阅读 · 2019年3月5日
VIP会员
相关VIP内容
专知会员服务
22+阅读 · 2021年9月20日
【ICML2021】具有线性复杂度的Transformer的相对位置编码
专知会员服务
24+阅读 · 2021年5月20日
专知会员服务
58+阅读 · 2021年2月16日
【AAAI2021】记忆门控循环网络
专知会员服务
47+阅读 · 2020年12月28日
最新《Transformers模型》教程,64页ppt
专知会员服务
274+阅读 · 2020年11月26日
Transformer模型-深度学习自然语言处理,17页ppt
专知会员服务
97+阅读 · 2020年8月30日
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
56+阅读 · 2019年10月17日
相关资讯
Transformer中的相对位置编码
AINLP
5+阅读 · 2020年11月28日
命名实体识别新SOTA:改进Transformer模型
AI科技评论
17+阅读 · 2019年11月26日
基于PyTorch/TorchText的自然语言处理库
专知
27+阅读 · 2019年4月22日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
【推荐】RNN最新研究进展综述
机器学习研究会
25+阅读 · 2018年1月6日
可解释的CNN
CreateAMind
17+阅读 · 2017年10月5日
【推荐】用Tensorflow理解LSTM
机器学习研究会
36+阅读 · 2017年9月11日
最佳实践:深度学习用于自然语言处理(三)
待字闺中
3+阅读 · 2017年8月20日
相关论文
Arxiv
17+阅读 · 2021年3月29日
Arxiv
5+阅读 · 2019年8月22日
Arxiv
6+阅读 · 2019年7月11日
Arxiv
6+阅读 · 2019年3月19日
Universal Transformers
Arxiv
5+阅读 · 2019年3月5日
Top
微信扫码咨询专知VIP会员