Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languages
Not on the map. Why?
Abstract (arXiv)
The expressive power of transformers over inputs of unbounded size can be studied through their ability to recognize classes of formal languages. In this paper, we establish exact characterizations of transformers with hard attention (in which all attention is focused on exactly one position) and attention masking (in which each position only attends to positions on one side). With strict masking (each position cannot attend to itself) and without position embeddings, these transformers are expressively equivalent to linear temporal logic (LTL), which defines exactly the star-free languages. A key technique is the use of Boolean RASP as a convenient intermediate language between transformers and LTL. We then take numerous results known for LTL and apply them to transformers, showing how position embeddings, strict masking, and depth all increase expressive power.
Key facts. Cited by 49 papers in the map (data through 14 Oct 2026). Builds on 16 of its 35 references that are in the map. First posted on arXiv 21 Oct 2023.
Builds on
16 of 35 references.
References · 16
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2016Layer Normalizationcited by 5,669
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 288
- 2021Thinking Like Transformerscited by 184
- 2022Overcoming a Theoretical Limitation of Self-Attentioncited by 113
- 2021Self-Attention Networks Can Process Bounded Hierarchical Languagescited by 105
- 2022Formal Language Recognition by Hard Attention Transformers: Perspectives from Circuit Complexitycited by 93
- 2023Tighter Bounds on the Expressivity of Transformer Encoderscited by 66
- 2021Memory-efficient Transformers via Top-k Attentioncited by 60
- 2020How Can Self-Attention Networks Recognize Dyck-n Languages?cited by 51
4 more
- 2023Learning Transformer Programscited by 41
- 2020Effects of Parameter Norm Growth During Transformer Training: Inductive Bias from Gradient Descentcited by 40
- 2023Logical Languages Accepted by Transformer Encoders with Hard Attentioncited by 38
- 2020Learning Hard Retrieval Decoder Attention for Transformerscited by 1
Built on by
Citing papers per year: 2024: 8; 2025: 22; 2026: 19.
49 papers.
Sort:
By area:
- 2024Transformers, parallel computation, and logarithmic depthcited by 79
- 2024SynCode: LLM Generation with Grammar Augmentationcited by 69
- 2025Between Circuits and Chomsky: Pre-pretraining on Formal Languages Imparts Linguistic Biasescited by 37
- 2025Type-Constrained Code Generation with Language Modelscited by 35
- 2024Training Neural Networks as Recognizers of Formal Languagescited by 24
- 2025Exact Expressive Power of Transformers with Paddingcited by 19
- 2025Constant Bit-size Transformers Are Turing Completecited by 19
- 2024Simulating Hard Attention Using Soft Attentioncited by 15
- 2025Characterizing the Expressivity of Fixed-Precision Transformer Language Modelscited by 14
- 2025Knee-Deep in C-RASP: A Transformer Depth Hierarchycited by 12
- 2025Unique Hard Attention: A Tale of Two Sidescited by 10
- 2025The Counting Power of Transformerscited by 9
37 more
- 2024Transformers as Transducerscited by 8
- 2025Meta-Learning Neural Mechanisms rather than Bayesian Priorscited by 8
- 2025Ehrenfeucht-Haussler Rank and Chain of Thoughtcited by 6
- 2025The Transformer Cookbookcited by 6
- 2024Quantifying artificial intelligence through algorithmic generalizationcited by 5
- 2026Parity, Sensitivity, and Transformerscited by 5
- 2025Transformers are Inherently Succinctcited by 4
- 2025Efficient Turing Machine Simulation with Transformerscited by 4
- 2026Length Generalization Bounds for Transformerscited by 4
- 2025When Do Transformers Outperform Feedforward and Recurrent Networks? A Statistical Perspectivecited by 3
- 2026Characterizing the Expressivity of Local Attention in Transformerscited by 3
- 2024Extracting Moore Machines from Transformers using Queries and Counterexamplescited by 2
- 2025Expressive Power of Graph Transformers via Logiccited by 2
- 2025From Next Token Prediction to (STRIPS) World Modelscited by 2
- 2025Probability Distributions Computed by Autoregressive Transformerscited by 2
- 2026On the Expressiveness of State Space Models via Temporal Logicscited by 2
- 2026On the Ability of Transformers to Verify Planscited by 2
- 2024Representing Rule-based Chatbots with Transformerscited by 1
- 2025Three tiers of computation in transformers and in brain architecturescited by 1
- 2025On the Existence of Universal Simulators of Attentioncited by 1
- 2025The Role of Logic and Automata in Understanding Transformerscited by 1
- 2026Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don'tcited by 1
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammarscited by 1
- 2026Disentangling the Expressivity of RoPEcited by 1
- 2025Generative Linguistics, Large Language Models, and the Social Nature of Scientific Successcited by 0
- 2025Comparison of different Unique hard attention transformer models by the formal languages they can recognizecited by 0
- 2026Synthesis and Verification of Transformer Programs (Technical Report)cited by 0
- 2026Average Attention Transformers and Arithmetic Circuitscited by 0
- 2026Encoder-Decoder Transformers: Logical Characterizations and Periodicitycited by 0
- 2026Provably Shorter Scratchpads in Hybrid DeltaNet-Attention Decoderscited by 0
- 2026Causally Evaluating the Learnability of Formal Language Taskscited by 0
- 2026A Compositional Theory of Causally Masked Transformerscited by 0
- 2026On the Expressive Power of Transformerscited by 0
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformerscited by 0
- 2026Latest Exact Match Attentioncited by 0
- 2026Hidden Reasoning Must Leak, but Need Not Be Readable: Fundamental Opportunities and Limits for Chain-of-Thought Monitoringcited by 0
- 2026Constraint-Aware Trainingcited by 0
- 2026Constraint-Aware Training2 Oct 2026
- 2026Hidden Reasoning Must Leak, but Need Not Be Readable: Fundamental Opportunities and Limits for Chain-of-Thought Monitoring29 Sep 2026
- 2026Latest Exact Match Attention22 Sep 2026
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformers31 Aug 2026
- 2026On the Expressive Power of Transformers13 Aug 2026
- 2026Disentangling the Expressivity of RoPE12 Aug 2026
- 2026A Compositional Theory of Causally Masked Transformers29 Jul 2026
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars16 Jun 2026
- 2026Causally Evaluating the Learnability of Formal Language Tasks8 Jun 2026
- 2026Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don't28 May 2026
- 2026Provably Shorter Scratchpads in Hybrid DeltaNet-Attention Decoders15 May 2026
- 2026Encoder-Decoder Transformers: Logical Characterizations and Periodicity8 May 2026
37 more
- 2026Average Attention Transformers and Arithmetic Circuits6 May 2026
- 2026Characterizing the Expressivity of Local Attention in Transformers1 May 2026
- 2026On the Ability of Transformers to Verify Plans20 Mar 2026
- 2026Synthesis and Verification of Transformer Programs (Technical Report)18 Feb 2026
- 2026Length Generalization Bounds for Transformers13 Feb 2026
- 2026Parity, Sensitivity, and Transformers5 Feb 2026
- 2026On the Expressiveness of State Space Models via Temporal Logics27 Jan 2026
- 2025Probability Distributions Computed by Autoregressive Transformers31 Oct 2025
- 2025Transformers are Inherently Succinct22 Oct 2025
- 2025The Transformer Cookbook1 Oct 2025
- 2025Efficient Turing Machine Simulation with Transformers28 Sep 2025
- 2025The Role of Logic and Automata in Understanding Transformers28 Sep 2025
- 2025From Next Token Prediction to (STRIPS) World Models16 Sep 2025
- 2025Expressive Power of Graph Transformers via Logic1 Aug 2025
- 2025On the Existence of Universal Simulators of Attention23 Jun 2025
- 2025Knee-Deep in C-RASP: A Transformer Depth Hierarchy19 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
- 2025Exact Expressive Power of Transformers with Padding25 May 2025
- 2025Constant Bit-size Transformers Are Turing Complete22 May 2025
- 2025The Counting Power of Transformers16 May 2025
- 2025Type-Constrained Code Generation with Language Models12 Apr 2025
- 2025Generative Linguistics, Large Language Models, and the Social Nature of Scientific Success25 Mar 2025
- 2025Meta-Learning Neural Mechanisms rather than Bayesian Priors20 Mar 2025
- 2025Unique Hard Attention: A Tale of Two Sides18 Mar 2025
- 2025When Do Transformers Outperform Feedforward and Recurrent Networks? A Statistical Perspective14 Mar 2025
- 2025Three tiers of computation in transformers and in brain architectures5 Mar 2025
- 2025Between Circuits and Chomsky: Pre-pretraining on Formal Languages Imparts Linguistic Biases26 Feb 2025
- 2025Ehrenfeucht-Haussler Rank and Chain of Thought22 Jan 2025
- 2024Simulating Hard Attention Using Soft Attention13 Dec 2024
- 2024Training Neural Networks as Recognizers of Formal Languages11 Nov 2024
- 2024Quantifying artificial intelligence through algorithmic generalization8 Nov 2024
- 2024Extracting Moore Machines from Transformers using Queries and Counterexamples8 Oct 2024
- 2024Representing Rule-based Chatbots with Transformers15 Jul 2024
- 2024Transformers as Transducers2 Apr 2024
- 2024SynCode: LLM Generation with Grammar Augmentation3 Mar 2024
- 2024Transformers, parallel computation, and logarithmic depth14 Feb 2024
- 2024Training Neural Networks as Recognizers of Formal Languagescited by 24
- 2025Exact Expressive Power of Transformers with Paddingcited by 19
- 2025Ehrenfeucht-Haussler Rank and Chain of Thoughtcited by 6
- 2025Efficient Turing Machine Simulation with Transformerscited by 4
- 2026Hidden Reasoning Must Leak, but Need Not Be Readable: Fundamental Opportunities and Limits for Chain-of-Thought Monitoringcited by 0
- 2026Hidden Reasoning Must Leak, but Need Not Be Readable: Fundamental Opportunities and Limits for Chain-of-Thought Monitoring29 Sep 2026
- 2025Efficient Turing Machine Simulation with Transformers28 Sep 2025
- 2025Exact Expressive Power of Transformers with Padding25 May 2025
- 2025Ehrenfeucht-Haussler Rank and Chain of Thought22 Jan 2025
- 2024Training Neural Networks as Recognizers of Formal Languages11 Nov 2024
- 2025From Next Token Prediction to (STRIPS) World Modelscited by 2
- 2025From Next Token Prediction to (STRIPS) World Models16 Sep 2025
- 2024Transformers, parallel computation, and logarithmic depthcited by 79
- 2024SynCode: LLM Generation with Grammar Augmentationcited by 69
- 2025Between Circuits and Chomsky: Pre-pretraining on Formal Languages Imparts Linguistic Biasescited by 37
- 2025Type-Constrained Code Generation with Language Modelscited by 35
- 2025Constant Bit-size Transformers Are Turing Completecited by 19
- 2024Simulating Hard Attention Using Soft Attentioncited by 15
- 2025Characterizing the Expressivity of Fixed-Precision Transformer Language Modelscited by 14
- 2025Knee-Deep in C-RASP: A Transformer Depth Hierarchycited by 12
- 2025Unique Hard Attention: A Tale of Two Sidescited by 10
- 2025The Counting Power of Transformerscited by 9
- 2024Transformers as Transducerscited by 8
- 2025Meta-Learning Neural Mechanisms rather than Bayesian Priorscited by 8
12 most cited of 43 All 43 (JSON)
- 2026Constraint-Aware Training2 Oct 2026
- 2026Latest Exact Match Attention22 Sep 2026
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformers31 Aug 2026
- 2026On the Expressive Power of Transformers13 Aug 2026
- 2026Disentangling the Expressivity of RoPE12 Aug 2026
- 2026A Compositional Theory of Causally Masked Transformers29 Jul 2026
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars16 Jun 2026
- 2026Causally Evaluating the Learnability of Formal Language Tasks8 Jun 2026
- 2026Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don't28 May 2026
- 2026Provably Shorter Scratchpads in Hybrid DeltaNet-Attention Decoders15 May 2026
- 2026Encoder-Decoder Transformers: Logical Characterizations and Periodicity8 May 2026
- 2026Average Attention Transformers and Arithmetic Circuits6 May 2026
12 newest of 43 All 43 (JSON)