Lune

ICML2025顶会

How Transformers Learn Regular Language Recognition: A Theoretical Study on Training Dynamics and Implicit Bias

Ruiquan Huang, Yingbin Liang, Jing Yang

摘要

Language recognition tasks are fundamental in natural language processing (NLP) and have been widely used to benchmark the performance of large language models (LLMs). These tasks also play a crucial role in explaining the working mechanisms of transformers. In this work, we focus on two representative tasks in the category of regular language recognition, known as 'even pairs' and 'parity check', the aim of which is to determine whether the occurrences of certain subsequences in a given sequence are even. Our goal is to explore how a one-layer transformer, consisting of an attention layer followed by a linear layer, learns to solve these tasks by theoretically analyzing its training dynamics under gradient descent. While even pairs can be solved directly by a one-layer transformer, parity check need to be solved by integrating Chain-of-Thought (CoT), either into the inference stage of a transformer well-trained for the even pairs task, or into the training of a one-layer transformer. For both problems, our analysis shows that the joint training of attention and linear layers exhibits two distinct phases. In the first phase, the attention layer grows rapidly, mapping data sequences into separable vectors. In the second phase, the attention layer becomes stable, while the linear layer grows logarithmically and approaches in direction to a max-margin hyperplane that correctly separates the attention layer outputs into positive and negative samples, and the loss decreases at a rate of O(1/t). Our experiments validate those theoretical results.

问 Lune

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

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

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

可以从这些问题问起

Lune 可以查阅

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

获取答案

免费开始,无需绑卡

脉络

  • Transformers learn to implement preconditioned gradient descent for in-context learning 引用了 One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attention
  • One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attention 引用了 Transformers learn to implement preconditioned gradient descent for in-context learning
  • The Expressive Power of Transformers with Chain of Thought 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Unlabeled Data Can Provably Enhance In-Context Learning of Transformers 引用了 Transformers learn to implement preconditioned gradient descent for in-context learning
  • Unlabeled Data Can Provably Enhance In-Context Learning of Transformers 引用了 One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attention
  • Unlabeled Data Can Provably Enhance In-Context Learning of Transformers 引用了 Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer
  • Transformers with RL or SFT Provably Learn Sparse Boolean Functions, But Differently 引用了 The Expressive Power of Transformers with Chain of Thought
  • Transformers with RL or SFT Provably Learn Sparse Boolean Functions, But Differently 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Context-free Recognition with Transformers 引用了 The Expressive Power of Transformers with Chain of Thought
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper3

  1. Unlabeled Data Can Provably Enhance In-Context Learning of TransformersRenpu Liu, Jing YangNeurIPS 2025 · 3 次引用
  2. Context-free Recognition with TransformersSelim Jerad, Anej Svete, Sophie Hao, Ryan Cotterell 等ICML 2026 · 3 次引用
  3. Transformers with RL or SFT Provably Learn Sparse Boolean Functions, But DifferentlyBochen Lyu, Yiyang Jia, Xiaohao Cai, Zhanxing ZhuICML 2026

它引用的 Paper29

  1. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
  2. Transformers learn to implement preconditioned gradient descent for in-context learningKwangjun Ahn, Xiang Cheng, Hadi Daneshmand, Suvrit SraNeurIPS 2023 · 324 次引用
  3. The Expressive Power of Transformers with Chain of ThoughtWilliam Merrill, Ashish SabharwalICLR 2024 · 243 次引用
  4. One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-AttentionArvind V. Mahankali, Tatsunori Hashimoto, Tengyu MaICLR 2024 · 160 次引用
  5. Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer TransformerYuandong Tian, Yiping Wang, Beidi Chen, Simon S. DuNeurIPS 2023 · 125 次引用

相关 Paper

  1. Transformers Provably Solve Parity Efficiently with Chain of ThoughtJuno Kim, Taiji SuzukiICLR 2025
  2. Overcoming a Theoretical Limitation of Self-AttentionDavid Chiang, Peter CholakACL 2022
  3. Task Generalization with Autoregressive Compositional Structure: Can Learning from D Tasks Generalize to DT Tasks?Amirhesam Abedsoltan, Huaqing Zhang, Kaiyue Wen, Hongzhou Lin 等ICML 2025
  4. Training Dynamics of Transformers to Recognize Word Co-occurrence via Gradient Flow AnalysisHongru Yang, Bhavya Kailkhura, Zhangyang Wang, Yingbin LiangNeurIPS 2024 · 14 次引用
  5. Transformers Learn to Implement Multi-step Gradient Descent with Chain of ThoughtJianhao Huang, Zixuan Wang, Jason D. LeeICLR 2025
黄昏的海面,两侧是细线勾勒的悬崖