Logical Languages Accepted by Transformer Encoders with Hard Attention
Not on the map. Why?
Abstract (arXiv)
We contribute to the study of formal languages that can be recognized by transformer encoders. We focus on two self-attention mechanisms: (1) UHAT (Unique Hard Attention Transformers) and (2) AHAT (Average Hard Attention Transformers). UHAT encoders are known to recognize only languages inside the circuit complexity class sf AC0, i.e., accepted by a family of poly-sized and depth-bounded boolean circuits with unbounded fan-ins. On the other hand, AHAT encoders can recognize languages outside sf AC0), but their expressive power still lies within the bigger circuit complexity class sf TC0, i.e., sf AC0-circuits extended by majority gates. We first show a negative result that there is an sf AC0-language that cannot be recognized by an UHAT encoder. On the positive side, we show that UHAT encoders can recognize a rich fragment of sf AC0-languages, namely, all languages definable in first-order logic with arbitrary unary numerical predicates. This logic, includes, for example, all regular languages from sf AC0. We then show that AHAT encoders can recognize all languages of our logic even when we enrich it with counting terms. We apply these results to derive new results on the expressive power of UHAT and AHAT up to permutation of letters (a.k.a. Parikh images).
Key facts. Cited by 38 papers in the map (data through 14 Oct 2026). Builds on 7 of its 22 references that are in the map. First posted on arXiv 5 Oct 2023.
Builds on
7 of 22 references.
References · 7
- 2017Attention Is All You Needcited by 60,361
- 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
Built on by
Citing papers per year: 2023: 2; 2024: 6; 2025: 17; 2026: 13.
38 papers.
Sort:
By area:
- 2023What Formal Languages Can Transformers Express? A Surveycited by 124
- 2023Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languagescited by 49
- 2024Counting Like Transformers: Compiling Temporal Counting Logic Into Softmax Transformerscited by 39
- 2025A Theory of Learning with Autoregressive Chain of Thoughtcited by 23
- 2024Simulating Hard Attention Using Soft Attentioncited by 15
- 2025Characterizing the Expressivity of Fixed-Precision Transformer Language Modelscited by 14
- 2024An Examination on the Effectiveness of Divide-and-Conquer Prompting in Large Language Modelscited by 12
- 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
- 2025Softmax Transformers are Turing-Completecited by 9
- 2024Transformers as Transducerscited by 8
26 more
- 2025Ehrenfeucht-Haussler Rank and Chain of Thoughtcited by 6
- 2025The Transformer Cookbookcited by 6
- 2024Learning Linear Attention in Polynomial Timecited by 5
- 2026Parity, Sensitivity, and Transformerscited by 5
- 2025Transformers are Inherently Succinctcited by 4
- 2025Efficient Turing Machine Simulation with Transformerscited by 4
- 2026Context-Free Recognition with Transformerscited by 4
- 2026Length Generalization Bounds for Transformerscited by 4
- 2024A Transformer with Stack Attentioncited by 2
- 2025Rosetta-PL: Propositional Logic as a Benchmark for Large Language Model Reasoningcited by 2
- 2025The Logical Expressiveness of Temporal GNNs via Two-Dimensional Product Logicscited by 2
- 2025Probability Distributions Computed by Autoregressive Transformerscited by 2
- 2026On the Expressiveness of State Space Models via Temporal Logicscited by 2
- 2025On the Existence of Universal Simulators of Attentioncited by 1
- 2025From Neural Networks to Logical Theories: The Correspondence between Fibring Modal Logics and Fibring Neural Networkscited by 1
- 2025The Role of Logic and Automata in Understanding Transformerscited by 1
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammarscited by 1
- 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
- 2026The Polynomial Counting Capabilities of Message Passing Neural Networkscited by 0
- 2026A Hierarchical Language Model with Predictable Scaling Laws and Provable Benefits of Reasoningcited by 0
- 2026Provably Shorter Scratchpads in Hybrid DeltaNet-Attention Decoderscited by 0
- 2026On the Expressive Power of Transformerscited by 0
- 2026Training Dynamics of Transformers on Unbounded Inputs: Attention Learning Can Lag Output Layer Learningcited by 0
- 2026Training Dynamics of Transformers on Unbounded Inputs: Attention Learning Can Lag Output Layer Learning14 Oct 2026
- 2026On the Expressive Power of Transformers13 Aug 2026
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars16 Jun 2026
- 2026Provably Shorter Scratchpads in Hybrid DeltaNet-Attention Decoders15 May 2026
- 2026A Hierarchical Language Model with Predictable Scaling Laws and Provable Benefits of Reasoning13 May 2026
- 2026The Polynomial Counting Capabilities of Message Passing Neural Networks11 May 2026
- 2026Encoder-Decoder Transformers: Logical Characterizations and Periodicity8 May 2026
- 2026Average Attention Transformers and Arithmetic Circuits6 May 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
26 more
- 2026Context-Free Recognition with Transformers5 Jan 2026
- 2025Softmax Transformers are Turing-Complete25 Nov 2025
- 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 Neural Networks to Logical Theories: The Correspondence between Fibring Modal Logics and Fibring Neural Networks28 Sep 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
- 2025The Logical Expressiveness of Temporal GNNs via Two-Dimensional Product Logics17 May 2025
- 2025The Counting Power of Transformers16 May 2025
- 2025Rosetta-PL: Propositional Logic as a Benchmark for Large Language Model Reasoning25 Mar 2025
- 2025Unique Hard Attention: A Tale of Two Sides18 Mar 2025
- 2025A Theory of Learning with Autoregressive Chain of Thought11 Mar 2025
- 2025Ehrenfeucht-Haussler Rank and Chain of Thought22 Jan 2025
- 2024Simulating Hard Attention Using Soft Attention13 Dec 2024
- 2024Learning Linear Attention in Polynomial Time14 Oct 2024
- 2024A Transformer with Stack Attention7 May 2024
- 2024Counting Like Transformers: Compiling Temporal Counting Logic Into Softmax Transformers5 Apr 2024
- 2024Transformers as Transducers2 Apr 2024
- 2024An Examination on the Effectiveness of Divide-and-Conquer Prompting in Large Language Models8 Feb 2024
- 2023What Formal Languages Can Transformers Express? A Survey1 Nov 2023
- 2023Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languages21 Oct 2023
- 2025A Theory of Learning with Autoregressive Chain of Thoughtcited by 23
- 2025Softmax Transformers are Turing-Completecited by 9
- 2025Ehrenfeucht-Haussler Rank and Chain of Thoughtcited by 6
- 2025Efficient Turing Machine Simulation with Transformerscited by 4
- 2025Rosetta-PL: Propositional Logic as a Benchmark for Large Language Model Reasoningcited by 2
- 2025Softmax Transformers are Turing-Complete25 Nov 2025
- 2025Efficient Turing Machine Simulation with Transformers28 Sep 2025
- 2025Rosetta-PL: Propositional Logic as a Benchmark for Large Language Model Reasoning25 Mar 2025
- 2025A Theory of Learning with Autoregressive Chain of Thought11 Mar 2025
- 2025Ehrenfeucht-Haussler Rank and Chain of Thought22 Jan 2025
- 2023What Formal Languages Can Transformers Express? A Surveycited by 124
- 2023Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languagescited by 49
- 2024Counting Like Transformers: Compiling Temporal Counting Logic Into Softmax Transformerscited by 39
- 2024Simulating Hard Attention Using Soft Attentioncited by 15
- 2025Characterizing the Expressivity of Fixed-Precision Transformer Language Modelscited by 14
- 2024An Examination on the Effectiveness of Divide-and-Conquer Prompting in Large Language Modelscited by 12
- 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
- 2025The Transformer Cookbookcited by 6
- 2024Learning Linear Attention in Polynomial Timecited by 5
12 most cited of 33 All 33 (JSON)
- 2026Training Dynamics of Transformers on Unbounded Inputs: Attention Learning Can Lag Output Layer Learning14 Oct 2026
- 2026On the Expressive Power of Transformers13 Aug 2026
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars16 Jun 2026
- 2026Provably Shorter Scratchpads in Hybrid DeltaNet-Attention Decoders15 May 2026
- 2026A Hierarchical Language Model with Predictable Scaling Laws and Provable Benefits of Reasoning13 May 2026
- 2026The Polynomial Counting Capabilities of Message Passing Neural Networks11 May 2026
- 2026Encoder-Decoder Transformers: Logical Characterizations and Periodicity8 May 2026
- 2026Average Attention Transformers and Arithmetic Circuits6 May 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
12 newest of 33 All 33 (JSON)