arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2006.16236cs.LGstat.ML
收藏

Transformers是RNN:具有线性注意力的快速自回归Transformers

Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention

Idiap Research Institute(伊迪亚普研究所);EPFL(洛桑联邦理工学院);University of Washington(华盛顿大学);University of Geneva(日内瓦大学)

Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François Fleuret

摘要:

Transformers在几个任务中实现了卓越的性能,但由于其二次复杂性,相对于输入的长度,它们对于非常长的序列是非常慢的。为了解决这一问题,我们将自注意力表示为核特征映射的线性点积,并利用矩阵积的结合性将复杂度从$\mathcal{O}\left(N^2\right)$降低到$\mathcal{O}\left(N\right)$,其中$N$是序列长度.我们表明,这种提法允许迭代实现,大大加快自回归Transformers,并揭示了它们的关系,经常性的神经网络。我们的线性Transformers实现了与vanilla Transformers相似的性能,并且在对非常长的序列进行自回归预测时,它们的速度快达4000倍。

英文摘要:

Transformers achieve remarkable performance in several tasks but due to their quadratic complexity, with respect to the input's length, they are prohibitively slow for very long sequences. To address this limitation, we express the self-attention as a linear dot-product of kernel feature maps and make use of the associativity property of matrix products to reduce the complexity from $\mathcal{O}\left(N^2\right)$ to $\mathcal{O}\left(N\right)$, where $N$ is the sequence length. We show that this formulation permits an iterative implementation that dramatically accelerates autoregressive transformers and reveals their relationship to recurrent neural networks. Our linear transformers achieve similar performance to vanilla transformers and they are up to 4000x faster on autoregressive prediction of very long sequences.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑