Open Interpretability Models Contributors Research Posts About

Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention

Source

Citation. Angelos Katharopoulos (Idiap Research Institute and EPFL), Apoorv Vyas (Idiap and EPFL), Nikolaos Pappas (University of Washington) and François Fleuret (EPFL and University of Geneva). "Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention". Proceedings of the 37th International Conference on Machine Learning (ICML 2020), PMLR 119. arXiv 2006.16236: v1 29 June 2020, v2 30 June 2020, v3 31 August 2020. Paper. Code, a PyTorch library with about 200 lines of CUDA, is at linear-transformers.com. The paper says that the authors did the work at Idiap. The Swiss National Science Foundation funded the first three authors. The paper gives no statement about tools or help from an LLM. The abstract page gives no journal reference, but its comment and the PDF both name ICML 2020.

Status. Not applicable. The registry explores four models, and all of them use softmax attention. Softmax attention has no finite state of the paper's kind. The paper's state is also written by activations, so it gives no way to check an explanation from weights alone.

Read. We read the arXiv v3 PDF on 2026-11-19. We extracted its text with pdftotext and read all of it. That is Sections 1 to 5, Algorithm 1, Tables 1 to 5 and Supplementary Sections A to D. The model that wrote this page read the text itself, with no subagent. We did not see the figures as images. So the loss curves of Figures 1, 2 and 5 are here only as their captions and the body text describe them. Some equations came out of the extraction with their layout broken. We read them against the text around them.

Summary

Claim. Self-attention can be written with a kernel feature map φ. Then a layer computes the sums over keys once and reuses them for each query. This makes attention linear in the sequence length. With a causal mask, the sums are a state that each new token updates, so the layer is a recurrent network. Generation is then much faster than with softmax attention, at similar quality.

Method.

Findings, as the source reports them.

Setting Result
Copy task, cross-entropy against gradient steps (Figure 2) Linear "converges smoothly" and reaches the same loss as softmax. Reformer stays higher
One layer, GTX 1080 Ti with 11 GB, lengths 2⁹ to 2¹⁶ The longest length that fits is 4,096 for softmax and 16,384 for lsh-4 and lsh-8. Linear is faster and uses less memory at every length
MNIST, bits/dim and images/s Softmax 0.621 and 0.45. Stateful-softmax 0.621 and 7.56. LSH-1 0.745 and 0.68. LSH-4 0.676 and 0.27. Linear 0.644 and 142.8 (317×)
CIFAR-10, 7 days each, bits/dim and images/s Softmax 3.47 and 0.004. Stateful-softmax 3.47 and 0.32. LSH-1 3.39 and 0.015. LSH-4 3.51 and 0.005. Linear 3.40 and 17.85 (4,462×)
CIFAR-10, epochs in the 7 days Linear completes 3 times more epochs than softmax
WSJ speech, PER and seconds per epoch Bi-LSTM 10.94 and 1,047. Softmax 5.12 and 2,711. LSH-4 9.33 and 2,250. Linear 8.08 and 824
One MNIST image, batch 1, seconds on CPU and GPU Softmax 72.6 and 10.2. Stateful-softmax 7.4 and 10.4. Linear 5.5 and 7.3
One CIFAR-10 image, batch 1, seconds on CPU and GPU Softmax 8,651.4 and 300.1. Stateful-softmax 71.9 and 70.4. Linear 45.1 and 61.3

Where the claims go beyond the evidence

The authors state two limits themselves. They add the stateful-softmax baseline themselves, which makes the speed claims fairer. They also report the speech result where softmax wins.

Use in this repo