JoMA: Demystifying Multilayer Transformers via Joint Dynamics of MLP and Attention
Yuandong Tian, Yiping Wang, Zhenyu Zhang, Beidi Chen, Simon Shaolei Du
摘要
We propose Joint MLP/Attention (JoMA) dynamics, a novel mathematical framework to understand the training procedure of multilayer Transformer architectures. This is achieved by integrating out the self-attention layer in Transformers, producing a modified dynamics of MLP layers only. JoMA removes unrealistic assumptions in previous analysis (e.g., lack of residual connection) and predicts that the attention first becomes sparse (to learn salient tokens), then dense (to learn less salient tokens) in the presence of nonlinear activations, while in the linear case, it is consistent with existing works that show attention becomes sparse over time. We leverage JoMA to qualitatively explains how tokens are combined to form hierarchies in multilayer Transformers, when the input tokens are generated by a latent hierarchical generative model. Experiments on models trained from real-world dataset (Wikitext2/Wikitext103) and various pre-trained models (OPT, Pythia) verify our theoretical findings. Code can be found in https://github.com/facebookresearch/luckmatters/tree/yuandong3.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 34 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscape 引用了 Transformers Learn In-Context by Gradient Descent
- Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscape 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers 引用了 Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscape
- Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers 引用了 How Transformers Learn Causal Structure with Gradient Descent
- Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers 引用了 Transformers Learn In-Context by Gradient Descent
- Linear Transformers are Versatile In-Context Learners 引用了 Transformers Learn In-Context by Gradient Descent
- Linear Transformers are Versatile In-Context Learners 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- 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 引用了 Transformers Learn In-Context by Gradient Descent
- How Transformers Learn Causal Structure with Gradient Descent 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Transformers Learn In-Context by Gradient Descent 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Transformers Learn In-Context by Gradient Descent 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics 引用了 How Transformers Learn Causal Structure with Gradient Descent
- Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics 引用了 Transformers Learn In-Context by Gradient Descent
- Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
引用它的顶会 Paper34
- How Transformers Learn Causal Structure with Gradient DescentEshaan Nichani, Alex Damian, Jason D. LeeICML 2024 · 117 次引用
- Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in TransformersSiyu Chen, Heejune Sheen, Tianhao Wang, Zhuoran YangNeurIPS 2024 · 48 次引用
- Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention LandscapeJuno Kim, Taiji SuzukiICML 2024 · 42 次引用
- Linear Transformers are Versatile In-Context LearnersMax Vladymyrov, Johannes von Oswald, Mark Sandler, Rong GeNeurIPS 2024 · 37 次引用
- Towards a Theoretical Understanding of the 'Reversal Curse' via Training DynamicsHanlin Zhu, Baihe Huang, Shaolun Zhang, Michael I. Jordan 等NeurIPS 2024 · 37 次引用
它引用的 Paper24
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn 等ICLR 2021 · 21,477 次引用
- Pythia: A Suite for Analyzing Large Language Models Across Training and ScalingStella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley 等ICML 2023 · 1,822 次引用
- What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 次引用
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento 等ICML 2023 · 729 次引用
- Are Transformers universal approximators of sequence-to-sequence functions?Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi 等ICLR 2020 · 481 次引用
相关 Paper
- Training Dynamics of Transformers to Recognize Word Co-occurrence via Gradient Flow AnalysisHongru Yang, Bhavya Kailkhura, Zhangyang Wang, Yingbin LiangNeurIPS 2024 · 14 次引用
- The emergence of sparse attention: impact of data distribution and benefits of repetitionNicolas Zucchet, Francesco D'Angelo, Andrew Kyle Lampinen, Stephanie ChanNeurIPS 2025 · 28 次引用
- Focus and Dilution: The Multi-stage Learning Process of AttentionZheng-An Chen, Pengxiao Lin, Zhi-Qin John Xu, Tao LuoICML 2026
- Incremental Learning of Sparse Attention Patterns in TransformersOğuz YükselICML 2026 · 2 次引用
- Attention Sinks and Compression Valleys in LLMs are Two Sides of the Same CoinEnrique Queipo-de-Llano, Alvaro Arroyo, Federico Barbero, Xiaowen Dong 等ICLR 2026 · 56 次引用
