Selective induction Heads: How Transformers Select Causal Structures in Context
Francesco D'Angelo, Francesco Croce, Nicolas Flammarion
Abstract
Transformers have exhibited exceptional capabilities in sequence modeling tasks, leveraging self-attention and in-context learning. Critical to this success are induction heads, attention circuits that enable copying tokens based on their previous occurrences. In this work, we introduce a novel framework that showcases transformers' ability to dynamically handle causal structures. Existing works rely on Markov Chains to study the formation of induction heads, revealing how transformers capture causal dependencies and learn transition probabilities in-context. However, they rely on a fixed causal structure that fails to capture the complexity of natural languages, where the relationship between tokens dynamically changes with context. To this end, our framework varies the causal structure through interleaved Markov chains with different lags while keeping the transition probabilities fixed. This setting unveils the formation of Selective Induction Heads, a new circuit that endows transformers with the ability to select the correct causal structure in-context. We empirically demonstrate that transformers learn this mechanism to predict the next token by identifying the correct lag and copying the corresponding token from the past. We provide a detailed construction of a 3-layer transformer to implement the selective induction head, and a theoretical analysis proving that this mechanism asymptotically converges to the maximum likelihood solution. Our findings advance the understanding of how transformers select causal structures, providing new insights into their functioning and interpretability.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
9 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Data Distributional Properties Drive Emergent In-Context Learning in Transformers cites An Explanation of In-context Learning as Implicit Bayesian Inference
- An Explanation of In-context Learning as Implicit Bayesian Inference cites Language Models are Few-Shot Learners
- The emergence of sparse attention: impact of data distribution and benefits of repetition cites Data Distributional Properties Drive Emergent In-Context Learning in Transformers
- The emergence of sparse attention: impact of data distribution and benefits of repetition cites Language Models are Few-Shot Learners
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent cites Data Distributional Properties Drive Emergent In-Context Learning in Transformers
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent cites An Explanation of In-context Learning as Implicit Bayesian Inference
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent cites The emergence of sparse attention: impact of data distribution and benefits of repetition
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent cites Language Models are Few-Shot Learners
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent cites Transformers Learn In-Context by Gradient Descent
- Transformers Learn Latent Mixture Models In-Context via Mirror Descent cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Incremental Learning of Sparse Attention Patterns in Transformers cites The emergence of sparse attention: impact of data distribution and benefits of repetition
- Incremental Learning of Sparse Attention Patterns in Transformers cites Transformers Learn Latent Mixture Models In-Context via Mirror Descent
- Incremental Learning of Sparse Attention Patterns in Transformers cites Transformers Learn In-Context by Gradient Descent
- Incremental Learning of Sparse Attention Patterns in Transformers cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Transformers Learn In-Context by Gradient Descent cites Data Distributional Properties Drive Emergent In-Context Learning in Transformers
- Transformers Learn In-Context by Gradient Descent cites Language Models are Few-Shot Learners
- Transformers Learn In-Context by Gradient Descent cites 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 cites An Explanation of In-context Learning as Implicit Bayesian Inference
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites Language Models are Few-Shot Learners
Cited by top-tier papers9
- The emergence of sparse attention: impact of data distribution and benefits of repetitionNicolas Zucchet, Francesco D'Angelo, Andrew Kyle Lampinen, Stephanie ChanNeurIPS 2025 · 28 citations
- Mitigating Conversational Inertia in Multi-Turn AgentsYang Wan, Zheng Cao, Zhenhao Zhang, Zhengwen Zeng et al.ICML 2026 · 4 citations
- Transformers Learn Latent Mixture Models In-Context via Mirror DescentFrancesco D'Angelo, Nicolas FlammarionICLR 2026 · 2 citations
- Incremental Learning of Sparse Attention Patterns in TransformersOğuz YükselICML 2026 · 2 citations
- Towards Understanding Transformers in Learning Random WalksWei Shi, Yuan CaoNeurIPS 2025 · 1 citation
Builds on17
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 citations
- What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations
- Data Distributional Properties Drive Emergent In-Context Learning in TransformersStephanie C. Y. Chan, Adam Santoro, Andrew K. Lampinen, Jane X. Wang et al.NeurIPS 2022 · 407 citations
Related papers
- How Transformers Learn Causal Structure with Gradient DescentEshaan Nichani, Alex Damian, Jason D. LeeICML 2024 · 117 citations
- The Evolution of Statistical Induction Heads: In-Context Learning Markov ChainsEzra Edelman, Nikolaos Tsilivis, Benjamin L. Edelman, Eran Malach et al.NeurIPS 2024 · 140 citations
- What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formationAaditya K. Singh, Ted Moskovitz, Felix Hill, Stephanie C. Y. Chan et al.ICML 2024 · 77 citations
- Beyond Induction Heads: In-Context Meta Learning Induces Multi-Phase Circuit EmergenceGouki Minegishi, Hiroki Furuta, Shohei Taniguchi, Yusuke Iwasawa et al.ICML 2025
- Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in TransformersSiyu Chen, Heejune Sheen, Tianhao Wang, Zhuoran YangNeurIPS 2024 · 48 citations
