Learning In-context n-grams with Transformers: Sub-n-grams Are Near-Stationary Points
Aditya Varre, Gizem Yüce, Nicolas Flammarion
摘要
Motivated by empirical observations of prolonged plateaus and stage-wise progression during training, we investigate the loss landscape of transformer models trained on in-context next-token prediction tasks. In particular, we focus on learning in-context n-gram language models under cross-entropy loss, and establish a sufficient condition for parameter configurations to be stationary points. We then construct a set of parameter configurations for a simplified transformer model that represent k-gram estimators (for k ⩽ n), and show that the gradient of the population loss at these solutions vanishes in the limit of infinite sequence length and parameter norm. This reveals a key property of the loss landscape: sub-ngrams are near-stationary points of the population cross-entropy loss, offering theoretical insight into widely observed phenomena such as stagewise learning dynamics and emergent phase transitions. These insights are further supported by numerical experiments that illustrate the learning dynamics of n-grams, characterized by discrete transitions between near-stationary solutions.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 7 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Transformers learn to implement preconditioned gradient descent for in-context learning 引用了 Language Models are Few-Shot Learners
- Transformers learn to implement preconditioned gradient descent for in-context learning 引用了 Transformers Learn In-Context by Gradient Descent
- Transformers learn to implement preconditioned gradient descent for in-context learning 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- What Happens During the Loss Plateau? Understanding Abrupt Learning in Transformers 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent 引用了 Transformers learn to implement preconditioned gradient descent for in-context learning
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent 引用了 Language Models are Few-Shot Learners
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent 引用了 Birth of a Transformer: A Memory Viewpoint
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent 引用了 Transformers Learn In-Context by Gradient Descent
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Saddle-to-Saddle Dynamics Explains A Simplicity Bias Across Neural Network Architectures 引用了 Incremental Learning of Sparse Attention Patterns in Transformers
- Incremental Learning of Sparse Attention Patterns in Transformers 引用了 Saddle-to-Saddle Dynamics Explains A Simplicity Bias Across Neural Network Architectures
- Saddle-to-Saddle Dynamics Explains A Simplicity Bias Across Neural Network Architectures 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Incremental Learning of Sparse Attention Patterns in Transformers 引用了 Transformers learn to implement preconditioned gradient descent for in-context learning
- Incremental Learning of Sparse Attention Patterns in Transformers 引用了 Transformers Learn Latent Mixture Models In-Context via Mirror Descent
- Incremental Learning of Sparse Attention Patterns in Transformers 引用了 Birth of a Transformer: A Memory Viewpoint
- Incremental Learning of Sparse Attention Patterns in Transformers 引用了 Transformers Learn In-Context by Gradient Descent
- Incremental Learning of Sparse Attention Patterns in Transformers 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Birth of a Transformer: A Memory Viewpoint 引用了 Language Models are Few-Shot Learners
- Birth of a Transformer: A Memory Viewpoint 引用了 Transformers Learn In-Context by Gradient Descent
- Transformers Learn In-Context by Gradient Descent 引用了 Language Models are Few-Shot Learners
- 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 引用了 Language Models are Few-Shot Learners
引用它的顶会 Paper7
- Saddle-to-Saddle Dynamics Explains A Simplicity Bias Across Neural Network ArchitecturesYedi Zhang, Andrew M. Saxe, Peter E. LathamICLR 2026 · 15 次引用
- What Happens During the Loss Plateau? Understanding Abrupt Learning in TransformersPulkit Gopalani, Wei HuNeurIPS 2025 · 6 次引用
- Transformers Learn Latent Mixture Models In-Context via Mirror DescentFrancesco D'Angelo, Nicolas FlammarionICLR 2026 · 2 次引用
- Incremental Learning of Sparse Attention Patterns in TransformersOğuz YükselICML 2026 · 2 次引用
- Length Generalization Bounds for TransformersAndy Yang, Pascal Bergsträßer, Georg Zetzsche, David Chiang 等ICML 2026
它引用的 Paper21
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- 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 次引用
- Transformers learn to implement preconditioned gradient descent for in-context learningKwangjun Ahn, Xiang Cheng, Hadi Daneshmand, Suvrit SraNeurIPS 2023 · 324 次引用
- Birth of a Transformer: A Memory ViewpointAlberto Bietti, Vivien Cabannes, Diane Bouchacourt, Hervé Jégou 等NeurIPS 2023 · 182 次引用
相关 Paper
- The Evolution of Statistical Induction Heads: In-Context Learning Markov ChainsEzra Edelman, Nikolaos Tsilivis, Benjamin L. Edelman, Eran Malach 等NeurIPS 2024 · 140 次引用
- Optimality and NP-Hardness of Transformers in Learning Markovian Dynamical FunctionsYanna Ding, Songtao Lu, Yingdong Lu, Tomasz Nowicki 等NeurIPS 2025 · 1 次引用
- Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention LandscapeJuno Kim, Taiji SuzukiICML 2024 · 42 次引用
- Attention with Markov: A Curious Case of Single-layer TransformersAshok Vardhan Makkuva, Marco Bondaschi, Adway Girish, Alliot Nagle 等ICLR 2025
- In-context Convergence of TransformersYu Huang, Yuan Cheng, Yingbin LiangICML 2024 · 114 次引用
