Transformers Provably Learn Two-Mixture of Linear Classification via Gradient Flow
Hongru Yang, Zhangyang Wang, Jason D. Lee, Yingbin Liang
摘要
Understanding how transformers learn and utilize hidden connections between words is crucial to understand the behavior of large language models. To study this mechanism, we consider the task of two-mixture of linear classification which features a hidden correspondence structure between words, and study the training dynamics of a symmetric two-headed transformer with ReLU neurons. Motivated by the stage-wise learning phenomenon observed in our experiments, we design and theoretically analyze a three-stage training algorithm, which can effectively characterize the actual gradient descent dynamics when we simultaneously train the neuron weights and the softmax attention. The first stage is a neuron learning stage, where the neurons align with the underlying signals. The second stage is an attention feature learning stage, where we analyze the feature learning process of how the attention learns to utilize the relationship between the tokens to solve certain hard samples. In the meantime, the attention features evolve from a nearly non-separable state (at the initialization) to a well-separated state. The third stage is a convergence stage, where the population loss is driven towards zero. The key technique in our analysis of softmax attention is to identify a critical subsystem inside a large dynamical system and bound the growth of the non-linear sub-system by a linear system. Along the way, we utilize a novel structure called mean-field infinite-width transformer. Finally, we discuss the setting with more than two mixtures. We empirically show the difficulty of generalizing our analysis of the gradient flow dynamics to the case even when the number of mixtures equals three, although the transformer can still successfully learn such distribution. On the other hand, we show by construction that there exists a transformer that can solve mixture of linear classification given any arbitrary number of mixtures. In this work, we study the training dynamics of a two-headed transformer given two mixtures. Our contributions are summarized as follows:
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 3 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- The Stability of Singular Distribution: A Spectral Perspective on the Two-Phase Dynamics of Language Model Pre-training 引用了 Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer
- How Transformers Learn Causal Structure with Gradient Descent 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- How Transformers Learn Causal Structure with Gradient Descent 引用了 Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Attention-based clustering 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Attention-based clustering 引用了 Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer 引用了 Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
引用它的顶会 Paper3
- Attention-based clusteringRodrigo Maulen-Soto, Pierre Marion, Claire BoyerNeurIPS 2025 · 3 次引用
- On the Provable Separation of Scales in Maximal Update ParameterizationLetong Hong, Zhangyang WangICML 2025
- The Stability of Singular Distribution: A Spectral Perspective on the Two-Phase Dynamics of Language Model Pre-trainingHongtao Zhang, WenJie Zhou, Chenxi Jia, Wei Chen 等ICML 2026
它引用的 Paper16
- Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu 等ICCV 2021 · 31,683 次引用
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn 等ICLR 2021 · 21,477 次引用
- Towards Understanding the Mixture-of-Experts Layer in Deep LearningZixiang Chen, Yihe Deng, Yue Wu, Quanquan Gu 等NeurIPS 2022 · 199 次引用
- Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer TransformerYuandong Tian, Yiping Wang, Beidi Chen, Simon S. DuNeurIPS 2023 · 125 次引用
- How Transformers Learn Causal Structure with Gradient DescentEshaan Nichani, Alex Damian, Jason D. LeeICML 2024 · 117 次引用
相关 Paper
- Training Dynamics of Transformers to Recognize Word Co-occurrence via Gradient Flow AnalysisHongru Yang, Bhavya Kailkhura, Zhangyang Wang, Yingbin LiangNeurIPS 2024 · 14 次引用
- In-context Convergence of TransformersYu Huang, Yuan Cheng, Yingbin LiangICML 2024 · 114 次引用
- Infinite Limits of Multi-head Transformer DynamicsBlake Bordelon, Hamza Tahir Chaudhry, Cengiz PehlevanNeurIPS 2024 · 42 次引用
- From Condensation to Rank Collapse: A Two-Stage Analysis of Transformer Training DynamicsZheng-An Chen, Tao LuoNeurIPS 2025 · 13 次引用
- Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention LandscapeJuno Kim, Taiji SuzukiICML 2024 · 42 次引用
