Lune

ICML2026顶会

Context-free Recognition with Transformers

Selim Jerad, Anej Svete, Sophie Hao, Ryan Cotterell, William Merrill

摘要

Transformers excel empirically on tasks that process well-formed inputs according to some grammar, such as natural language and code. However, it remains unclear how they can process grammatical syntax. In fact, under standard complexity conjectures, standard transformers cannot recognize context-free languages (CFLs), a canonical formalism to describe syntax, or even regular languages, a subclass of CFLs. Past work has shown that O(log⁡(N))\mathcal{O}(\log(N)) looping layers (w.r.t. input length NN) allow transformers to recognize regular languages, but the question of context-free recognition with looped transformers remained open. In this work, we show that looped transformers with O(log⁡(N))\mathcal{O}(\log(N)) looping layers and O(N6)\mathcal{O}(N^6) padding symbols can recognize all CFLs. However, training and inference with O(N6)\mathcal{O}(N^6) padding symbols is potentially impractical. Fortunately, we show that, for natural subclasses such as unambiguous CFLs, the recognition problem on transformers becomes more tractable, requiring O(N3)\mathcal{O}(N^3) padding. Empirically, looped and padded transformers perform better than fixed-depth transformers in recognizing CFLs. Overall, our results shed light on the intricacy of CFL recognition by transformers: while general recognition may require an intractable amount of padding, natural constraints such as unambiguity yield efficient recognition algorithms.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • The Expressive Power of Transformers with Chain of Thought 引用了 A Logic for Expressing Log-Precision Transformers
  • A Little Depth Goes a Long Way: The Expressive Power of Log-Depth Transformers 引用了 The Expressive Power of Transformers with Chain of Thought
  • A Little Depth Goes a Long Way: The Expressive Power of Log-Depth Transformers 引用了 A Logic for Expressing Log-Precision Transformers
  • Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don't 引用了 The Expressive Power of Transformers with Chain of Thought
  • Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don't 引用了 A Little Depth Goes a Long Way: The Expressive Power of Log-Depth Transformers
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper2

  1. Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don'tAnej Svete, William Merrill, Ryan Cotterell, Ashish SabharwalICML 2026 · 3 次引用
  2. How Transformers Represent Hierarchies: A Local-to-Global MechanismZhiling Zhou, Tianhao Wang, Zhuoran YangICML 2026

它引用的 Paper21

  1. The Expressive Power of Transformers with Chain of ThoughtWilliam Merrill, Ashish SabharwalICLR 2024 · 243 次引用
  2. A Logic for Expressing Log-Precision TransformersWilliam Merrill, Ashish SabharwalNeurIPS 2023 · 87 次引用
  3. A Little Depth Goes a Long Way: The Expressive Power of Log-Depth TransformersWilliam Merrill, Ashish SabharwalNeurIPS 2025 · 62 次引用
  4. Logical Languages Accepted by Transformer Encoders with Hard AttentionPablo Barceló, Alexander Kozachinskiy, Anthony Widjaja Lin, Vladimir V. PodolskiiICLR 2024 · 36 次引用
  5. We're Afraid Language Models Aren't Modeling AmbiguityAlisa Liu, Zhaofeng Wu, Julian Michael, Alane Suhr 等EMNLP 2023 · 35 次引用

相关 Paper

  1. Stack Attention: Improving the Ability of Transformers to Model Hierarchical PatternsBrian DuSell, David ChiangICLR 2024 · 15 次引用
  2. Exact Expressive Power of Transformers with PaddingWilliam Merrill, Ashish SabharwalNeurIPS 2025 · 21 次引用
  3. Unraveling Syntax: Language Modeling and the Substructure of GrammarsLaura Ying Schulz, Daniel Mitropolsky, Tomaso A PoggioICML 2026 · 5 次引用
  4. On the Ability and Limitations of Transformers to Recognize Formal LanguagesSatwik Bhattamishra, Kabir Ahuja, Navin GoyalEMNLP 2020 · 7 次引用
  5. Learning Bounded Context-Free-Grammar via LSTM and the Transformer: Difference and the ExplanationsHui Shi, Sicun Gao, Yuandong Tian, Xinyun Chen 等AAAI 2022 · 24 次引用
黄昏的海面,两侧是细线勾勒的悬崖