Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, Fran\c{c}ois, Fleuret

TL;DR
This paper introduces linear transformers that use kernel feature maps to reduce self-attention complexity from quadratic to linear, enabling much faster processing of long sequences while maintaining performance.
Contribution
The authors reformulate self-attention as a linear dot-product, enabling an iterative implementation that accelerates autoregressive transformers and links them to RNNs.
Findings
Achieve similar performance to standard transformers
Up to 4000x faster on long sequence prediction
Reduce complexity from O(N^2) to O(N)
Abstract
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 to , where 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.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
Taxonomy
TopicsNeural Networks and Applications · Advanced Neural Network Applications · Neural Networks and Reservoir Computing
