Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers
Siyu Chen, Heejune Sheen, Tianhao Wang, Zhuoran Yang
摘要
In-context learning (ICL) is a cornerstone of large language model (LLM) functionality, yet its theoretical foundations remain elusive due to the complexity of transformer architectures. In particular, most existing work only theoretically explains how the attention mechanism facilitates ICL under certain data models. It remains unclear how the other building blocks of the transformer contribute to ICL. To address this question, we study how a two-attention-layer transformer is trained to perform ICL on -gram Markov chain data, where each token in the Markov chain statistically depends on the previous tokens. We analyze a sophisticated transformer model featuring relative positional embedding, multi-head softmax attention, and a feed-forward layer with normalization. We prove that the gradient flow with respect to a cross-entropy ICL loss converges to a limiting model that performs a generalized version of the induction head mechanism with a learned feature, resulting from the congruous contribution of all the building blocks. In the limiting model, the first attention layer acts as a , copying past tokens within a given window to each position, and the feed-forward network with normalization acts as a that generates a feature vector by only looking at informationally relevant parents from the window. Finally, the second attention layer is a that compares these features with the feature at the output position, and uses the resulting similarity scores to generate the desired output. Our theory is further validated by experiments.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 36 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- An Explanation of In-context Learning as Implicit Bayesian Inference 引用了 Language Models are Few-Shot Learners
- An Explanation of In-context Learning as Implicit Bayesian Inference 引用了 Finetuned Language Models are Zero-Shot Learners
- Language Model Behavioral Phases are Consistent Across Architecture, Training Data, and Scale 引用了 Language Models are Few-Shot Learners
- Language Model Behavioral Phases are Consistent Across Architecture, Training Data, and Scale 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Finetuned Language Models are Zero-Shot Learners 引用了 Language Models are Few-Shot Learners
- Finetuned Language Models are Zero-Shot Learners 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Flamingo: a Visual Language Model for Few-Shot Learning 引用了 Language Models are Few-Shot Learners
- Flamingo: a Visual Language Model for Few-Shot Learning 引用了 Finetuned Language Models are Zero-Shot Learners
引用它的顶会 Paper36
- Enhancing Graph Transformers with Hierarchical Distance Structural EncodingYuankai Luo, Hongkang Li, Lei Shi, Xiao-Ming WuNeurIPS 2024 · 26 次引用
- Why and How LLMs Hallucinate: Connecting the Dots with Subsequence AssociationsYiyou Sun, Yu Gai, Lijie Chen, Abhilasha Ravichander 等NeurIPS 2025 · 20 次引用
- Context parroting: A simple but tough-to-beat baseline for foundation models in scientific machine learningYuanzhao Zhang, William GilpinICLR 2026 · 16 次引用
- Language Model Behavioral Phases are Consistent Across Architecture, Training Data, and ScaleJames A. Michaelov, Roger P. Levy, Benjamin BergenNeurIPS 2025 · 15 次引用
- Symmetries in language statistics shape the geometry of model representationsDhruva Karkada, Daniel Korchinski, Andres Nava, Matthieu Wyart 等ICML 2026 · 15 次引用
它引用的 Paper32
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
- Flamingo: a Visual Language Model for Few-Shot LearningJean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech 等NeurIPS 2022 · 6,707 次引用
- Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu 等ICLR 2022 · 4,966 次引用
- An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 次引用
相关 Paper
- The Evolution of Statistical Induction Heads: In-Context Learning Markov ChainsEzra Edelman, Nikolaos Tsilivis, Benjamin L. Edelman, Eran Malach 等NeurIPS 2024 · 140 次引用
- What One Cannot, Two Can: Two-Layer Transformers Provably Represent Induction Heads on Any-Order Markov ChainsChanakya Ekbote, Ashok Vardhan Makkuva, Marco Bondaschi, Nived Rajaraman 等NeurIPS 2025 · 4 次引用
- Transformers Efficiently Perform In-Context Logistic Regression via Normalized Gradient DescentChenyang Zhang, Yuan CaoICML 2026 · 1 次引用
- Selective induction Heads: How Transformers Select Causal Structures in ContextFrancesco D'Angelo, Francesco Croce, Nicolas FlammarionICLR 2025
- How Transformers Learn Causal Structure with Gradient DescentEshaan Nichani, Alex Damian, Jason D. LeeICML 2024 · 117 次引用
