Manifest AI - Linear Transformers Are Faster After All
It is well-known that removing the exponential from the attention layer of a transformer allows for a recurrent reformulation, with computational cost that is linear instead of quadratic on context length [1]. One would expect that such an architecture would be far faster to train, especially when the context size is large. However, when training deep neural networks on hardware accelerators (e.g. GPUs), reductions in FLOPs do not always straightforwardly translate into practical speedups. Initial empirical experiments showed that large language models based on linear transformers train more slowly than classic transformers, and led many to dismiss the approach as nice-in-theory but unhelpful-in-practice [2]. At the moment, the conventional wisdom in the field is that a quadratic-cost algorithm with highly optimized hardware utilization (e.g. FlashAttention) gives the best training throughput [3]. But this is mistaken. In this post, we explain several different ways of implementing lin
Linear Transformers Are Faster After All – Manifest AI \[ \newcommand{\R}{\mathbb{R}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\N}{\mathbb{N}} \newcommand{\sft}{\text{softmax}} \newcommand{\List}{\text{List}} \newcommand{\Seq}{\text{Seq}} \newcommand{\SeqT}{\text{SeqT}} \newcommand{\CSeqT}{\text{CSeqT}} \newcommand{\Dist}{\text{Dist}} \newcommand{\SM}{\text{SM}} \newcommand{\Fn}{\text{Fn}} \newcommand{\Tok}{\text{Tok}} \newcommand{\Aij}{ A_{[i,j]}} \] It is well-known that removing the exponential from the attention layer of a transformer allows for a recurrent reformulation, with computational
Explore this link on the map →saved by
related reading
- A Mathematical Framework for Transformer Circuitstransformer-circuits.pub
- Linear Attention Fundamentals | Hailey Schoelkopfhaileyschoelkopf.github.io
- Linear Attention Is All You Need | Towards Data Sciencetowardsdatascience.com
- Transformers Inference Optimization Toolset | AstraBlogastralord.github.io
- Parallelizing Linear Transformers with the Delta Rule over Sequence Lengtharxiv.org
- The Annotated Transformernlp.seas.harvard.edu
- Transformer Inference Arithmetic | kipply's blogkipp.ly
- [2507.04239] Scaling Context Requires Rethinking Attentionarxiv.org
- On the Tradeoffs of SSMs and Transformers | Goomba Labgoombalab.github.io
- Transformers from Scratche2eml.school
- Mamba: The Easy Wayjackcook.com
- Mediumblog.gopenai.com