On the Computational Hardness of Transformers
Not on the map. Why?
Abstract (arXiv)
The transformer has revolutionized modern AI across language, vision, and beyond. It consists of L layers, each running H attention heads in parallel and feeding the combined output to the subsequent layer. In attention, the input consists of N tokens, each a vector of dimension m. The attention mechanism involves multiplying three N × m matrices, applying softmax to an intermediate product. Several recent works have advanced our understanding of the complexity of attention. Known algorithms for transformers compute each attention head independently. This raises a fundamental question that has recurred throughout TCS under the guise of ``direct sum'' problems: can multiple instances of the same problem be solved more efficiently than solving each instance separately? Many answers to this question, both positive and negative, have arisen in fields spanning communication complexity and algorithm design. Thus, we ask whether transformers can be computed more efficiently than LH independent evaluations of attention. In this paper, we resolve this question in the negative, and give the first non-trivial computational lower bounds for multi-head multi-layer transformers. In the small embedding regime (m = No(1)), computing LH attention heads separately takes LHN2 + o(1) time. We establish that this is essentially optimal under SETH. In the large embedding regime (m = N), one can compute LH attention heads separately using LHNω + o(1) arithmetic operations (plus exponents), where ω is the matrix multiplication exponent. We establish that this is optimal, by showing that LHNω - o(1) arithmetic operations are necessary when ω > 2. Our lower bound in the large embedding regime relies on a novel application of the Baur-Strassen theorem, a powerful algorithmic tool underpinning the famous backpropagation algorithm.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 44 of its 73 references that are in the map. First posted on arXiv 11 Mar 2026.
Builds on
44 of 73 references.
References · 44
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Segment Anythingcited by 8,234
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
- 2020GLU Variants Improve Transformercited by 1,804
- 2020Big Bird: Transformers for Longer Sequencescited by 1,684
- 2022Fast Inference from Transformers via Speculative Decodingcited by 1,653
- 2020Rethinking Attention with Performerscited by 1,601
32 more
- 2024Gemma: Open Models Based on Gemini Research and Technologycited by 916
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 288
- 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 216
- 2022The Parallelism Tradeoff: Limitations of Log-Precision Transformerscited by 193
- 2021Saturated Transformers are Constant-Depth Threshold Circuitscited by 139
- 2022On The Computational Complexity of Self-Attentioncited by 139
- 2023Representational Strengths and Limitations of Transformerscited by 133
- 2021Self-Attention Networks Can Process Bounded Hierarchical Languagescited by 105
- 2023Fast Attention Requires Bounded Entriescited by 102
- 2023HyperAttention: Long-context Attention in Near-Linear Timecited by 85
- 2024Transformers, parallel computation, and logarithmic depthcited by 79
- 2024RNNs are not Transformers (Yet): The Key Bottleneck on In-context Retrievalcited by 64
- 2024On Limitations of the Transformer Architecturecited by 63
- 2023Simple Hardware-Efficient Long Convolutions for Sequence Modelingcited by 62
- 2020RNNs can generate bounded hierarchical languages with optimal memorycited by 59
- 2023KDEformer: Accelerating Transformers via Kernel Density Estimationcited by 58
- 2024Theoretical limitations of multi-layer Transformercited by 45
- 2023PolySketchFormer: Fast Transformers via Sketching Polynomial Kernelscited by 36
- 2024One-layer transformers fail to solve the induction heads taskcited by 32
- 2024More Asymmetry Yields Faster Matrix Multiplicationcited by 27
- 2014Edit Distance Cannot Be Computed in Strongly Subquadratic Time (unless SETH is false)cited by 18
- 2025Strassen Attention, Split VC Dimension and Compositionality in Transformerscited by 12
- 2025Depth-Width tradeoffs in Algorithmic Reasoning of Graph Tasks with Transformerscited by 11
- 2025Unique Hard Attention: A Tale of Two Sidescited by 10
- 2024Fundamental Limitations on Subquadratic Alternatives to Transformerscited by 9
- 2025Subquadratic Algorithms and Hardness for Attention with Any Temperaturecited by 5
- 2025Fast attention mechanisms: a tale of parallelismcited by 3
- 2017SETH-Based Lower Bounds for Subset Sum and Bicriteria Pathcited by 2
- 2018Towards Tight Approximation Bounds for Graph Diameter and Eccentricitiescited by 2
- 2025Two Heads Are Better than One: Simulating Large Transformers with Small Onescited by 2
- 20214 vs 7 sparse undirected unweighted Diameter is SETH-hard at time n4/3cited by 1
- 2023Deterministic Sparse Pattern Matching via the Baur-Strassen Theoremcited by 1
Built on by
Not cited yet.