Self-Attention Networks Can Process Bounded Hierarchical Languages
Not on the map. Why?
Abstract (arXiv)
Despite their impressive performance in NLP, self-attention networks were recently proved to be limited for processing formal languages with hierarchical structure, such as mathsfDyckk, the language consisting of well-nested parentheses of k types. This suggested that natural language can be approximated well with models that are too weak for formal languages, or that the role of hierarchy and recursion in natural language might be limited. We qualify this implication by proving that self-attention networks can process mathsfDyckk, D, the subset of mathsfDyckk with depth bounded by D, which arguably better captures the bounded hierarchical structure of natural language. Specifically, we construct a hard-attention network with D+1 layers and O(log k) memory size (per token per layer) that recognizes mathsfDyckk, D, and a soft-attention network with two layers and O(log k) memory size that generates mathsfDyckk, D. Experiments show that self-attention networks trained on mathsfDyckk, D generalize to longer inputs with near-perfect accuracy, and also verify the theoretical memory advantage of self-attention networks over recurrent networks.
Key facts. Cited by 105 papers in the map (data through 7 Oct 2026). Builds on 30 of its 57 references that are in the map. First posted on arXiv 24 May 2021.
Builds on
30 of 57 references.
References · 30
- 2017Attention Is All You Needcited by 59,932
- 2015Deep Residual Learning for Image Recognitioncited by 51,809
- 2016Layer Normalizationcited by 5,579
- 2016Pointer Sentinel Mixture Modelscited by 2,992
- 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
- 2018Self-Attention with Relative Position Representationscited by 1,112
- 2019BERT Rediscovers the Classical NLP Pipelinecited by 1,046
- 2018Universal Transformerscited by 613
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 286
- 2020Rethinking Positional Encoding in Language Pre-trainingcited by 197
- 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
18 more
- 2019Open Sesame: Getting Inside BERT's Linguistic Knowledgecited by 119
- 2018The Best of Both Worlds: Combining Recent Advances in Neural Machine Translationcited by 101
- 2020On the Computational Power of Transformers and its Implications in Sequence Modelingcited by 85
- 2017DiSAN: Directional Self-Attention Network for RNN/CNN-Free Language Understandingcited by 71
- 2020A Formal Hierarchy of RNN Architecturescited by 61
- 2020RNNs can generate bounded hierarchical languages with optimal memorycited by 59
- 2019Encoding word order in complex embeddingscited by 53
- 2020How Can Self-Attention Networks Recognize Dyck-n Languages?cited by 51
- 2020Fast and Accurate Neural CRF Constituency Parsingcited by 50
- 2018The Importance of Being Recurrent for Modeling Hierarchical Structurecited by 42
- 2019On the Computational Power of RNNscited by 35
- 2019Memory-Augmented Recurrent Neural Networks Can Learn Generalized Dyck Languagescited by 31
- 2019Modeling Recurrence for Transformercited by 26
- 2019Establishing Strong Baselines for the New Decade: Sequence Tagging, Syntactic and Semantic Parsing with BERTcited by 19
- 2018Evaluating the Ability of LSTMs to Learn Context-Free Grammarscited by 16
- 2020On the Ability and Limitations of Transformers to Recognize Formal Languagescited by 12
- 2019Assessing the Ability of Self-Attention Networks to Learn Word Ordercited by 9
- 2018Unsupervised Grammar Induction with Depth-bounded PCFGcited by 8
Built on by
Citing papers per year: 2021: 2; 2022: 6; 2023: 30; 2024: 31; 2025: 21; 2026: 15.
105 papers.
Sort:
By area:
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2022Transformers Learn Shortcuts to Automatacited by 260
- 2024Chain of Thought Empowers Transformers to Solve Inherently Serial Problemscited by 256
- 2021Thinking Like Transformerscited by 182
- 2021Saturated Transformers are Constant-Depth Threshold Circuitscited by 137
- 2023Representational Strengths and Limitations of Transformerscited by 132
- 2023What Formal Languages Can Transformers Express? A Surveycited by 120
- 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 105
- 2023Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformercited by 101
- 2022Formal Language Recognition by Hard Attention Transformers: Perspectives from Circuit Complexitycited by 92
- 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 85
38 more
- 2023Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretrainingcited by 82
- 2023Exposing Attention Glitches with Flip-Flop Language Modelingcited by 74
- 2024Why are Sensitive Functions Hard for Transformers?cited by 74
- 2025Reasoning by Superposition: A Theoretical Perspective on Chain of Continuous Thoughtcited by 73
- 2022Simplicity Bias in Transformers and their Ability to Learn Sparse Boolean Functionscited by 68
- 2024On Limitations of the Transformer Architecturecited by 63
- 2023JoMA: Demystifying Multilayer Transformers via JOint Dynamics of MLP and Attentioncited by 52
- 2023Do Transformers Parse while Predicting the Masked Word?cited by 48
- 2023The Expressive Power of Transformers with Chain of Thoughtcited by 47
- 2023Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languagescited by 47
- 2023Are Transformers with One Layer Self-Attention Using Low-Rank Weight Matrices Universal Approximators?cited by 46
- 2024The Expressive Capacity of State Space Models: A Formal Language Perspectivecited by 45
- 2024Theoretical limitations of multi-layer Transformercited by 43
- 2023The Closeness of In-Context Learning and Weight Shifting for Softmax Regressioncited by 41
- 2023Modeling rapid language learning by distilling Bayesian priors into artificial neural networkscited by 40
- 2023Learning Transformer Programscited by 40
- 2023What can a Single Attention Layer Learn? A Study Through the Random Features Lenscited by 39
- 2024Counting Like Transformers: Compiling Temporal Counting Logic Into Softmax Transformerscited by 39
- 2023Logical Languages Accepted by Transformer Encoders with Hard Attentioncited by 37
- 2024Transformers Can Represent n-gram Language Modelscited by 31
- 2023Transformers are uninterpretable with myopic methods: a case study with bounded Dyck grammarscited by 30
- 2023A Mathematical Abstraction for Balancing the Trade-off Between Creativity and Reality in Large Language Modelscited by 29
- 2024Separations in the Representational Capabilities of Transformers and Recurrent Architecturescited by 29
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamicscited by 27
- 2024Language Models Need Inductive Biases to Count Inductivelycited by 25
- 2023Interpretability Illusions in the Generalization of Simplified Modelscited by 24
- 2024Training Neural Networks as Recognizers of Formal Languagescited by 23
- 2024Learned feature representations are biased by complexity, learning order, position, and morecited by 22
- 2024Provably learning a multi-head attention layercited by 21
- 2024Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannotcited by 21
- 2023Practical Computational Power of Linear Transformers and Their Recurrent and Self-Referential Extensionscited by 20
- 2024Do Efficient Transformers Really Save Computation?cited by 20
- 2023Pushdown Layers: Encoding Recursive Structure in Transformer Language Modelscited by 18
- 2023Can Transformers Learn to Solve Problems Recursively?cited by 17
- 2023Trainable Transformer in Transformercited by 17
- 2023Stack Attention: Improving the Ability of Transformers to Model Hierarchical Patternscited by 17
- 2024Algorithmic Capabilities of Random Transformerscited by 17
- 2024Can Transformers Reason Logically? A Study in SAT Solvingcited by 16
50 most cited of 105 All 105 (JSON)
- 2026Comparing Transformers and Hybrid Models at the Token Level18 Jun 2026
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars16 Jun 2026
- 2026Boltzmann Attention: Learnable Ising Couplings for Cooperative Attention10 Jun 2026
- 2026Refit the Probe: Single-Direction Ablation Is Not a Necessity Test30 May 2026
- 2026Fixed Universal Transformers29 May 2026
- 2026Good Token Hunting: A Hitchhiker's Guide to Token Selection for Visual Geometry Transformers22 May 2026
- 2026Towards Verifiable Transformers: Solver-Checkable Circuit Explanations21 May 2026
- 2026The two clocks and the innovation window: When and how generative models learn rules11 May 2026
- 2026Dissociating Decodability and Causal Use in Bracket-Sequence Transformers24 Apr 2026
- 2026On the Emergence of Syntax by Means of Local Interaction20 Apr 2026
- 2026Exploration of Fast-Slow Latent Recurrence for Train-Short, Test-Long Generalization2 Apr 2026
- 2026On the Computational Hardness of Transformers11 Mar 2026
38 more
- 2026A Provable Expressiveness Hierarchy in Hybrid Linear-Full Attention2 Feb 2026
- 2026Understanding LLM Failures: A Multi-Tape Turing Machine Analysis of Systematic Errors in Language Model Reasoning27 Jan 2026
- 2026Barriers to Discrete Reasoning with Transformers: A Survey Across Depth, Exactness, and Bandwidth19 Jan 2026
- 2025Circuits, Features, and Heuristics in Molecular Transformers10 Dec 2025
- 2025Rectifying LLM Thought from Lens of Optimization1 Dec 2025
- 2025MapFormer: Self-Supervised Learning of Cognitive Maps with Input-Dependent Positional Embeddings24 Nov 2025
- 2025Probability Distributions Computed by Autoregressive Transformers31 Oct 2025
- 2025First Attentions Last: Better Exploiting First Attentions for Efficient Transformer Training16 Oct 2025
- 2025Post-Norm can Resharpen Attention9 Oct 2025
- 2025Decoupling Positional and Symbolic Attention Behavior in Transformers3 Oct 2025
- 2025The Transformer Cookbook1 Oct 2025
- 2025Efficient Turing Machine Simulation with Transformers28 Sep 2025
- 2025Fast attention mechanisms: a tale of parallelism10 Sep 2025
- 2025Sample Complexity and Representation Ability of Test-time Scaling Paradigms5 Jun 2025
- 2025Transformers Meet In-Context Learning: A Universal Approximation Theory5 Jun 2025
- 2025Comparison of different Unique hard attention transformer models by the formal languages they can recognize3 Jun 2025
- 2025Characterizing the Expressivity of Fixed-Precision Transformer Language Models29 May 2025
- 2025Deciphering Trajectory-Aided LLM Reasoning: An Optimization Perspective26 May 2025
- 2025Reasoning by Superposition: A Theoretical Perspective on Chain of Continuous Thought18 May 2025
- 2025Unique Hard Attention: A Tale of Two Sides18 Mar 2025
- 2025Three tiers of computation in transformers and in brain architectures5 Mar 2025
- 2025On the Query Complexity of Verifier-Assisted Language Generation17 Feb 2025
- 2025Transformers versus the EM Algorithm in Multi-class Clustering9 Feb 2025
- 2025Learning Model Successors31 Jan 2025
- 2024Simulating Hard Attention Using Soft Attention13 Dec 2024
- 2024Theoretical limitations of multi-layer Transformer4 Dec 2024
- 2024Sneaking Syntax into Transformer Language Models with Tree Regularization28 Nov 2024
- 2024Tree Transformers are an Ineffective Model of Syntactic Constituency25 Nov 2024
- 2024Selective Attention: Enhancing Transformer through Principled Context Control19 Nov 2024
- 2024Training Neural Networks as Recognizers of Formal Languages11 Nov 2024
- 2024ALTA: Compiler-Based Analysis of Transformers23 Oct 2024
- 2024Can Transformers Reason Logically? A Study in SAT Solving9 Oct 2024
- 2024Extracting Moore Machines from Transformers using Queries and Counterexamples8 Oct 2024
- 2024Algorithmic Capabilities of Random Transformers6 Oct 2024
- 2024Fundamental Limitations on Subquadratic Alternatives to Transformers5 Oct 2024
- 2024Promises and Pitfalls of Generative Masked Language Modeling: Theoretical Framework and Practical Guidelines22 Jul 2024
- 2024Representing Rule-based Chatbots with Transformers15 Jul 2024
- 2024Separations in the Representational Capabilities of Transformers and Recurrent Architectures13 Jun 2024
50 newest of 105 All 105 (JSON)
- 2024Chain of Thought Empowers Transformers to Solve Inherently Serial Problemscited by 256
- 2025Reasoning by Superposition: A Theoretical Perspective on Chain of Continuous Thoughtcited by 73
- 2023The Expressive Power of Transformers with Chain of Thoughtcited by 47
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamicscited by 27
- 2024Training Neural Networks as Recognizers of Formal Languagescited by 23
- 2024Can Transformers Reason Logically? A Study in SAT Solvingcited by 16
- 2025Sample Complexity and Representation Ability of Test-time Scaling Paradigmscited by 12
- 2025On the Query Complexity of Verifier-Assisted Language Generationcited by 10
- 2025Efficient Turing Machine Simulation with Transformerscited by 4
- 2025Rectifying LLM Thought from Lens of Optimizationcited by 3
- 2025Deciphering Trajectory-Aided LLM Reasoning: An Optimization Perspectivecited by 2
- 2026Understanding LLM Failures: A Multi-Tape Turing Machine Analysis of Systematic Errors in Language Model Reasoningcited by 0
- 2026Understanding LLM Failures: A Multi-Tape Turing Machine Analysis of Systematic Errors in Language Model Reasoning27 Jan 2026
- 2025Rectifying LLM Thought from Lens of Optimization1 Dec 2025
- 2025Efficient Turing Machine Simulation with Transformers28 Sep 2025
- 2025Sample Complexity and Representation Ability of Test-time Scaling Paradigms5 Jun 2025
- 2025Deciphering Trajectory-Aided LLM Reasoning: An Optimization Perspective26 May 2025
- 2025Reasoning by Superposition: A Theoretical Perspective on Chain of Continuous Thought18 May 2025
- 2025On the Query Complexity of Verifier-Assisted Language Generation17 Feb 2025
- 2024Training Neural Networks as Recognizers of Formal Languages11 Nov 2024
- 2024Can Transformers Reason Logically? A Study in SAT Solving9 Oct 2024
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics7 May 2024
- 2024Chain of Thought Empowers Transformers to Solve Inherently Serial Problems20 Feb 2024
- 2023The Expressive Power of Transformers with Chain of Thought11 Oct 2023
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2022Transformers Learn Shortcuts to Automatacited by 260
- 2021Thinking Like Transformerscited by 182
- 2021Saturated Transformers are Constant-Depth Threshold Circuitscited by 137
- 2023Representational Strengths and Limitations of Transformerscited by 132
- 2023What Formal Languages Can Transformers Express? A Surveycited by 120
- 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 105
- 2023Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformercited by 101
- 2022Formal Language Recognition by Hard Attention Transformers: Perspectives from Circuit Complexitycited by 92
- 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 85
- 2023Exposing Attention Glitches with Flip-Flop Language Modelingcited by 74
12 most cited of 91 All 91 (JSON)
- 2026Comparing Transformers and Hybrid Models at the Token Level18 Jun 2026
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars16 Jun 2026
- 2026Boltzmann Attention: Learnable Ising Couplings for Cooperative Attention10 Jun 2026
- 2026Refit the Probe: Single-Direction Ablation Is Not a Necessity Test30 May 2026
- 2026Fixed Universal Transformers29 May 2026
- 2026Good Token Hunting: A Hitchhiker's Guide to Token Selection for Visual Geometry Transformers22 May 2026
- 2026Towards Verifiable Transformers: Solver-Checkable Circuit Explanations21 May 2026
- 2026The two clocks and the innovation window: When and how generative models learn rules11 May 2026
- 2026Dissociating Decodability and Causal Use in Bracket-Sequence Transformers24 Apr 2026
- 2026On the Emergence of Syntax by Means of Local Interaction20 Apr 2026
- 2026Exploration of Fast-Slow Latent Recurrence for Train-Short, Test-Long Generalization2 Apr 2026
- 2026On the Computational Hardness of Transformers11 Mar 2026
12 newest of 91 All 91 (JSON)