Overcoming a Theoretical Limitation of Self-Attention
Not on the map. Why?
Abstract (arXiv)
Although transformers are remarkably effective for many tasks, there are some surprisingly easy-looking regular languages that they struggle with. Hahn shows that for languages where acceptance depends on a single input symbol, a transformer's classification decisions become less and less confident (that is, with cross-entropy approaching 1 bit per string) as input strings get longer and longer. We examine this limitation using two languages: PARITY, the language of bit strings with an odd number of 1s, and FIRST, the language of bit strings starting with a 1. We demonstrate three ways of overcoming the limitation suggested by Hahn's lemma. First, we settle an open question by constructing a transformer that recognizes PARITY with perfect accuracy, and similarly for FIRST. Second, we use layer normalization to bring the cross-entropy of both models arbitrarily close to zero. Third, when transformers need to focus on a single position, as for FIRST, we find that they can fail to generalize to longer strings; we offer a simple remedy to this problem that also improves length generalization in machine translation.
Key facts. Cited by 110 papers in the map (data through 7 Oct 2026). Builds on 14 of its 21 references that are in the map. First posted on arXiv 24 Feb 2022.
Builds on
14 of 21 references.
References · 14
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2014Adam: A Method for Stochastic Optimizationcited by 36,960
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2016Layer Normalizationcited by 5,579
- 2017Convolutional Sequence to Sequence Learningcited by 550
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
- 2019Learning Deep Transformer Models for Machine Translationcited by 309
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 286
- 2021Thinking Like Transformerscited by 182
- 2019Transformers without Tears: Improving the Normalization of Self-Attentioncited by 153
- 2020On the Computational Power of Transformers and its Implications in Sequence Modelingcited by 85
2 more
Built on by
Citing papers per year: 2022: 3; 2023: 23; 2024: 33; 2025: 31; 2026: 20.
110 papers.
Sort:
By area:
- 2023Qwen Technical Reportcited by 3,273
- 2023A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questionscited by 1,582
- 2024Hallucination is Inevitable: An Innate Limitation of Large Language Modelscited by 329
- 2022Neural Networks and the Chomsky Hierarchycited by 214
- 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 198
- 2023Scaling Laws of RoPE-based Extrapolationcited by 124
- 2023What Formal Languages Can Transformers Express? A Surveycited by 120
- 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 114
- 2022State-of-the-art generalisation research in NLP: A taxonomy and reviewcited by 97
- 2025HalluLens: LLM Hallucination Benchmarkcited by 88
- 2023Exposing Attention Glitches with Flip-Flop Language Modelingcited by 74
- 2024Why are Sensitive Functions Hard for Transformers?cited by 74
38 more
- 2023The Transient Nature of Emergent In-Context Learning in Transformerscited by 72
- 2022Simplicity Bias in Transformers and their Ability to Learn Sparse Boolean Functionscited by 68
- 2023Tighter Bounds on the Expressivity of Transformer Encoderscited by 65
- 2025Test-time regression: a unifying framework for designing sequence models with associative memorycited by 63
- 2023Understanding In-Context Learning in Transformers and LLMs by Learning to Learn Discrete Functionscited by 62
- 2023TransNeXt: Robust Foveal Visual Perception for Vision Transformerscited by 61
- 2024MemFlow: Optical Flow Estimation and Prediction with Memorycited by 55
- 2024Knowledge Mechanisms in Large Language Models: A Survey and Perspectivecited by 50
- 2024MVSFormer++: Revealing the Devil in Transformer's Details for Multi-View Stereocited by 49
- 2023Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languagescited by 47
- 2024LongEmbed: Extending Embedding Models for Long Context Retrievalcited by 47
- 2023Are Transformers with One Layer Self-Attention Using Low-Rank Weight Matrices Universal Approximators?cited by 46
- 2024Length Generalization of Causal Transformers without Position Encodingcited by 46
- 2024The Expressive Capacity of State Space Models: A Formal Language Perspectivecited by 45
- 2024Theoretical limitations of multi-layer Transformercited by 43
- 2024Softmax is not Enough (for Sharp Size Generalisation)cited by 42
- 2023Logical Languages Accepted by Transformer Encoders with Hard Attentioncited by 37
- 2024Transformers Can Represent n-gram Language Modelscited by 31
- 2024Counting Ability of Large Language Models and Impact of Tokenizationcited by 29
- 2024Language Models Need Inductive Biases to Count Inductivelycited by 25
- 2024ALR2: A Retrieve-then-Reason Framework for Long-context Question Answeringcited by 25
- 2024Training Neural Networks as Recognizers of Formal Languagescited by 23
- 2024When Can Transformers Count to n?cited by 22
- 2023Practical Computational Power of Linear Transformers and Their Recurrent and Self-Referential Extensionscited by 20
- 2024Extending LLMs' Context Window with 100 Samplescited by 20
- 2025AttentionRAG: Attention-Guided Context Pruning in Retrieval-Augmented Generationcited by 19
- 2023Pushdown Layers: Encoding Recursive Structure in Transformer Language Modelscited by 18
- 2024Superiority of Multi-Head Attention in In-Context Linear Regressioncited by 17
- 2024Selective Prompt Anchoring for Code Generationcited by 16
- 2024Simulating Hard Attention Using Soft Attentioncited by 15
- 2025Characterizing the Expressivity of Fixed-Precision Transformer Language Modelscited by 14
- 2023Transformer Working Memory Enables Regular Language Reasoning and Natural Language Length Extrapolationcited by 13
- 2023From Interpolation to Extrapolation: Complete Length Generalization for Arithmetic Transformerscited by 10
- 2025Unique Hard Attention: A Tale of Two Sidescited by 10
- 2025How Transformers Learn Regular Language Recognition: A Theoretical Study on Training Dynamics and Implicit Biascited by 10
- 2024LeMeViT: Efficient Vision Transformer with Learnable Meta Tokens for Remote Sensing Image Interpretationcited by 9
- 2024Rethinking Transformers in Solving POMDPscited by 9
- 2024Fundamental Limitations on Subquadratic Alternatives to Transformerscited by 9
50 most cited of 110 All 110 (JSON)
- 2026VC Dimension and Expressivity of Real-Valued Transformers25 Sep 2026
- 2026LimiX-2: A Contextual Mechanism Network Towards General Structured-Data Intelligence15 Sep 2026
- 2026Length Generalization for Transformers via Compression8 Sep 2026
- 2026State Propagation Also Satisfies: A Complex-Valued State-Space Model for Deterministic State Tracking4 Aug 2026
- 2026The Information Shadow: Measuring Structural Limits on What Language Models Can Learn17 Jul 2026
- 2026Understanding the Parameter Space Geometry of Transformers Encoding Boolean Functions7 Jun 2026
- 2026An Algebraic View of the Expressivity of Recurrent Language Models1 Jun 2026
- 2026Length Generalization with Log-Depth Recurrent Units25 May 2026
- 2026The two clocks and the innovation window: When and how generative models learn rules11 May 2026
- 2026Scaling Limits of Long-Context Transformers8 May 2026
- 2026Encoder-Decoder Transformers: Logical Characterizations and Periodicity8 May 2026
- 2026Meta-learning In-Context Enables Training-Free Cross Subject Brain Decoding9 Apr 2026
38 more
- 2026Circuit Complexity of Hierarchical Knowledge Tracing and Implications for Log-Precision Transformers25 Mar 2026
- 2026On the Ability of Transformers to Verify Plans20 Mar 2026
- 2026Beyond Pairwise Attention: Higher-Order Modular Attention for Efficient Sequence Learning11 Mar 2026
- 2026TIDE: Text-Informed Dynamic Extrapolation with Step-Aware Temperature Control for Diffusion Transformers9 Mar 2026
- 2026Trapped by simplicity: When Transformers fail to learn from noisy features9 Feb 2026
- 2026Parity, Sensitivity, and Transformers5 Feb 2026
- 2026How Far Ahead Do LLMs Plan? Uncovering the Latent Horizon in Chain-of-Thought Reasoning2 Feb 2026
- 2026Barriers to Discrete Reasoning with Transformers: A Survey Across Depth, Exactness, and Bandwidth19 Jan 2026
- 2025Softmax Transformers are Turing-Complete25 Nov 2025
- 2025Controllably Efficient Language Models7 Nov 2025
- 2025Transformers are Inherently Succinct22 Oct 2025
- 2025Post-Norm can Resharpen Attention9 Oct 2025
- 2025Gaussian Equivalence for Self-Attention: Asymptotic Spectral Analysis of Attention Matrix8 Oct 2025
- 2025The Transformer Cookbook1 Oct 2025
- 2025The Role of Logic and Automata in Understanding Transformers28 Sep 2025
- 2025Bridging Kolmogorov Complexity and Deep Learning: Asymptotically Optimal Description Length Objectives for Transformers26 Sep 2025
- 2025BEE-RAG: Balanced Entropy Engineering for Retrieval-Augmented Generation7 Aug 2025
- 2025Learning Moderately Input-Sensitive Functions: A Case Study in QR Code Decoding25 Jun 2025
- 2025On the Existence of Universal Simulators of Attention23 Jun 2025
- 2025Understanding Input Selectivity in Mamba: Impact on Approximation Power, Memorization, and Associative Recall Capacity13 Jun 2025
- 2025Characterizing the Expressivity of Fixed-Precision Transformer Language Models29 May 2025
- 2025Meta-Learning an In-Context Transformer Model of Human Higher Visual Cortex21 May 2025
- 2025Scale-invariant Attention20 May 2025
- 2025The Counting Power of Transformers16 May 2025
- 2025Continuity and Isolation Lead to Doubts or Dilemmas in Large Language Models15 May 2025
- 2025Lost in Transmission: When and Why LLMs Fail to Reason Globally13 May 2025
- 2025How Transformers Learn Regular Language Recognition: A Theoretical Study on Training Dynamics and Implicit Bias2 May 2025
- 2025HalluLens: LLM Hallucination Benchmark24 Apr 2025
- 2025Exploring Compositional Generalization (in COGS/ReCOGS_pos) by Transformers using Restricted Access Sequence Processing (RASP)21 Apr 2025
- 2025Approximation Bounds for Transformer Networks with Application to Regression16 Apr 2025
- 2025Unique Hard Attention: A Tale of Two Sides18 Mar 2025
- 2025AttentionRAG: Attention-Guided Context Pruning in Retrieval-Augmented Generation13 Mar 2025
- 2025Language Models, Graph Searching, and Supervision Adulteration: When More Supervision is Less and How to Make More More13 Mar 2025
- 2025Three tiers of computation in transformers and in brain architectures5 Mar 2025
- 2025HuDEx: Integrating Hallucination Detection and Explainability for Enhancing the Reliability of LLM responses12 Feb 2025
- 2025Softplus Attention with Re-weighting Boosts Length Extrapolation in Large Language Models23 Jan 2025
- 2025Test-time regression: a unifying framework for designing sequence models with associative memory21 Jan 2025
- 2025Information Entropy Invariance: Enhancing Length Extrapolation in Attention Mechanisms15 Jan 2025
50 newest of 110 All 110 (JSON)
- 2024Counting Ability of Large Language Models and Impact of Tokenizationcited by 29
- 2024ALR2: A Retrieve-then-Reason Framework for Long-context Question Answeringcited by 25
- 2024Training Neural Networks as Recognizers of Formal Languagescited by 23
- 2025Lost in Transmission: When and Why LLMs Fail to Reason Globallycited by 9
- 2025Softmax Transformers are Turing-Completecited by 9
- 2026How Far Ahead Do LLMs Plan? Uncovering the Latent Horizon in Chain-of-Thought Reasoningcited by 1
- 2026How Far Ahead Do LLMs Plan? Uncovering the Latent Horizon in Chain-of-Thought Reasoning2 Feb 2026
- 2025Softmax Transformers are Turing-Complete25 Nov 2025
- 2025Lost in Transmission: When and Why LLMs Fail to Reason Globally13 May 2025
- 2024Training Neural Networks as Recognizers of Formal Languages11 Nov 2024
- 2024Counting Ability of Large Language Models and Impact of Tokenization25 Oct 2024
- 2024ALR2: A Retrieve-then-Reason Framework for Long-context Question Answering4 Oct 2024
- 2023Qwen Technical Reportcited by 3,273
- 2023A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questionscited by 1,582
- 2024Hallucination is Inevitable: An Innate Limitation of Large Language Modelscited by 329
- 2022Neural Networks and the Chomsky Hierarchycited by 214
- 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 198
- 2023Scaling Laws of RoPE-based Extrapolationcited by 124
- 2023What Formal Languages Can Transformers Express? A Surveycited by 120
- 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 114
- 2022State-of-the-art generalisation research in NLP: A taxonomy and reviewcited by 97
- 2025HalluLens: LLM Hallucination Benchmarkcited by 88
- 2023Exposing Attention Glitches with Flip-Flop Language Modelingcited by 74
- 2024Why are Sensitive Functions Hard for Transformers?cited by 74
12 most cited of 97 All 97 (JSON)
- 2026VC Dimension and Expressivity of Real-Valued Transformers25 Sep 2026
- 2026LimiX-2: A Contextual Mechanism Network Towards General Structured-Data Intelligence15 Sep 2026
- 2026Length Generalization for Transformers via Compression8 Sep 2026
- 2026State Propagation Also Satisfies: A Complex-Valued State-Space Model for Deterministic State Tracking4 Aug 2026
- 2026The Information Shadow: Measuring Structural Limits on What Language Models Can Learn17 Jul 2026
- 2026Understanding the Parameter Space Geometry of Transformers Encoding Boolean Functions7 Jun 2026
- 2026An Algebraic View of the Expressivity of Recurrent Language Models1 Jun 2026
- 2026Length Generalization with Log-Depth Recurrent Units25 May 2026
- 2026The two clocks and the innovation window: When and how generative models learn rules11 May 2026
- 2026Scaling Limits of Long-Context Transformers8 May 2026
- 2026Encoder-Decoder Transformers: Logical Characterizations and Periodicity8 May 2026
- 2026Meta-learning In-Context Enables Training-Free Cross Subject Brain Decoding9 Apr 2026
12 newest of 97 All 97 (JSON)