Logical Languages Accepted by Transformer Encoders with Hard Attention
Pablo Barceló, Alexander Kozachinskiy, Anthony Widjaja Lin, Vladimir V. Podolskii
摘要
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 , 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 ), but their expressive power still lies within the bigger circuit complexity class , i.e., -circuits extended by majority gates. We first show a negative result that there is an -language that cannot be recognized by an UHAT encoder. On the positive side, we show that UHAT encoders can recognize a rich fragment of -languages, namely, all languages definable in first-order logic with arbitrary unary numerical predicates. This logic, includes, for example, all regular languages from . 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).
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 20 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Characterizing the Expressivity of Fixed-Precision Transformer Language Models 引用了 Overcoming a Theoretical Limitation of Self-Attention
- Characterizing the Expressivity of Fixed-Precision Transformer Language Models 引用了 Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languages
- Characterizing the Expressivity of Fixed-Precision Transformer Language Models 引用了 Self-Attention Networks Can Process Bounded Hierarchical Languages
- Characterizing the Expressivity of Fixed-Precision Transformer Language Models 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- Characterizing the Expressivity of Fixed-Precision Transformer Language Models 引用了 Tighter Bounds on the Expressivity of Transformer Encoders
- Knee-Deep in C-RASP: A Transformer Depth Hierarchy 引用了 Thinking Like Transformers
- Knee-Deep in C-RASP: A Transformer Depth Hierarchy 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- Knee-Deep in C-RASP: A Transformer Depth Hierarchy 引用了 Tighter Bounds on the Expressivity of Transformer Encoders
- Softmax Transformers are Turing-Complete 引用了 Thinking Like Transformers
- Softmax Transformers are Turing-Complete 引用了 Overcoming a Theoretical Limitation of Self-Attention
- Thinking Like Transformers 引用了 Self-Attention Networks Can Process Bounded Hierarchical Languages
- Thinking Like Transformers 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- The Power of Hard Attention Transformers on Data Sequences: A formal language theoretic perspective 引用了 Tighter Bounds on the Expressivity of Transformer Encoders
- Overcoming a Theoretical Limitation of Self-Attention 引用了 Thinking Like Transformers
- Overcoming a Theoretical Limitation of Self-Attention 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languages 引用了 Thinking Like Transformers
- Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languages 引用了 Overcoming a Theoretical Limitation of Self-Attention
- Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languages 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languages 引用了 Tighter Bounds on the Expressivity of Transformer Encoders
- Tighter Bounds on the Expressivity of Transformer Encoders 引用了 Thinking Like Transformers
- Tighter Bounds on the Expressivity of Transformer Encoders 引用了 Overcoming a Theoretical Limitation of Self-Attention
- Tighter Bounds on the Expressivity of Transformer Encoders 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
引用它的顶会 Paper20
- Masked Hard-Attention Transformers Recognize Exactly the Star-Free LanguagesAndy Yang, David Chiang, Dana AngluinNeurIPS 2024 · 58 次引用
- Characterizing the Expressivity of Fixed-Precision Transformer Language ModelsJiaoda Li, Ryan CotterellNeurIPS 2025 · 18 次引用
- Knee-Deep in C-RASP: A Transformer Depth HierarchyAndy Yang, Michaël Cadilhac, David ChiangNeurIPS 2025 · 15 次引用
- Softmax Transformers are Turing-CompleteHongjian Jiang, Michael Hahn, Georg Zetzsche, Anthony W. LinICLR 2026 · 12 次引用
- The Power of Hard Attention Transformers on Data Sequences: A formal language theoretic perspectivePascal Bergsträßer, Chris Köcher, Anthony Widjaja Lin, Georg ZetzscheNeurIPS 2024 · 7 次引用
它引用的 Paper5
- Thinking Like TransformersGail Weiss, Yoav Goldberg, Eran YahavICML 2021 · 183 次引用
- Tighter Bounds on the Expressivity of Transformer EncodersDavid Chiang, Peter Cholak, Anand PillayICML 2023 · 80 次引用
- On the Ability and Limitations of Transformers to Recognize Formal LanguagesSatwik Bhattamishra, Kabir Ahuja, Navin GoyalEMNLP 2020 · 7 次引用
- Overcoming a Theoretical Limitation of Self-AttentionDavid Chiang, Peter CholakACL 2022
- Self-Attention Networks Can Process Bounded Hierarchical LanguagesShunyu Yao, Binghui Peng, Christos H. Papadimitriou, Karthik NarasimhanACL 2021
相关 Paper
- Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don'tAnej Svete, William Merrill, Ryan Cotterell, Ashish SabharwalICML 2026 · 3 次引用
- A Logic for Expressing Log-Precision TransformersWilliam Merrill, Ashish SabharwalNeurIPS 2023 · 87 次引用
- Learning Linear Attention in Polynomial TimeMorris Yau, Ekin Akyürek, Jiayuan Mao, Joshua B. Tenenbaum 等NeurIPS 2025 · 7 次引用
- Exact Expressive Power of Transformers with PaddingWilliam Merrill, Ashish SabharwalNeurIPS 2025 · 21 次引用
- Characterizing the Expressivity of Local Attention in TransformersJiaoda Li, Ryan CotterellACL 2026 · 2 次引用
