Transformer has shown great successes in natural language processing, computer vision, and audio processing. As one of its core components, the softmax attention helps to capture long-range dependencies yet prohibits its scale-up due to the quadratic space and time complexity to the sequence length. Kernel methods are often adopted to reduce the complexity by approximating the softmax operator. Nevertheless, due to the approximation errors, their performances vary in different tasks/corpus and suffer crucial performance drops when compared with the vanilla softmax attention. In this paper, we propose a linear transformer called cosFormer that can achieve comparable or better accuracy to the vanilla transformer in both casual and cross attentions. cosFormer is based on two key properties of softmax attention: i). non-negativeness of the attention matrix; ii). a non-linear re-weighting scheme that can concentrate the distribution of the attention matrix. As its linear substitute, cosFormer fulfills these properties with a linear operator and a cosine-based distance re-weighting mechanism. Extensive experiments on language modeling and text understanding tasks demonstrate the effectiveness of our method. We further examine our method on long sequences and achieve state-of-the-art performance on the Long-Range Arena benchmark. The source code is available at https://github.com/OpenNLPLab/cosFormer.


翻译:变压器在自然语言处理、计算机视觉和音频处理方面取得了巨大成功。 软性关注是其核心组成部分之一, 有助于捕捉长距离依赖性, 但由于音序长度的四边空间和时间复杂性, 也禁止其扩大。 内核方法通常被采用, 通过接近软体操作器来降低复杂性。 然而, 由于近似错误, 其性能因任务/ 体体而异, 与香草软体关注度相比, 其性能会发生重大下降。 在本文中, 我们提议使用一个叫做cos Former 的线性变压器, 它可以在临时和交叉关注中实现与香草变压器的可比或更准确性。 COs Former基于软体注意的两种关键特性: i. 注意矩阵的无偏重度矩阵;ii. 一种非线性重力重力重力计划, 可以集中分配注意矩阵。 作为线性替代品, cosFormer将这些特性与线性操作器的远程再加权调整机制。 在长期性变压法中进行广泛的实验, 我们的模型/ 的 Rormainal rodeal rode roal rode rodu rodustral la la la la la la la la la la la lax la la lax lax lax lax lax lax lax lax

0
下载
关闭预览

相关内容

专知会员服务
50+阅读 · 2020年12月14日
专知会员服务
123+阅读 · 2020年9月8日
专知会员服务
60+阅读 · 2020年3月19日
100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
162+阅读 · 2020年3月18日
注意力机制介绍,Attention Mechanism
专知会员服务
166+阅读 · 2019年10月13日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
145+阅读 · 2019年10月12日
强化学习最新教程,17页pdf
专知会员服务
171+阅读 · 2019年10月11日
【哈佛大学商学院课程Fall 2019】机器学习可解释性
专知会员服务
101+阅读 · 2019年10月9日
AIART 2022 Call for Papers
CCF多媒体专委会
1+阅读 · 2022年2月13日
【ICIG2021】Check out the hot new trailer of ICIG2021 Symposium6
中国图象图形学学会CSIG
2+阅读 · 2021年11月12日
Hierarchically Structured Meta-learning
CreateAMind
23+阅读 · 2019年5月22日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
跨越注意力:Cross-Attention
我爱读PAMI
172+阅读 · 2018年6月2日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
4+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
Arxiv
30+阅读 · 2021年6月30日
Arxiv
17+阅读 · 2021年3月29日
Arxiv
13+阅读 · 2019年11月14日
Arxiv
11+阅读 · 2018年1月18日
VIP会员
相关VIP内容
专知会员服务
50+阅读 · 2020年12月14日
专知会员服务
123+阅读 · 2020年9月8日
专知会员服务
60+阅读 · 2020年3月19日
100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
162+阅读 · 2020年3月18日
注意力机制介绍,Attention Mechanism
专知会员服务
166+阅读 · 2019年10月13日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
145+阅读 · 2019年10月12日
强化学习最新教程,17页pdf
专知会员服务
171+阅读 · 2019年10月11日
【哈佛大学商学院课程Fall 2019】机器学习可解释性
专知会员服务
101+阅读 · 2019年10月9日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
4+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
Top
微信扫码咨询专知VIP会员