From Shortcut to Induction Head: How Data Diversity Shapes Algorithm Selection in Transformers
Not on the map. Why?
Abstract (arXiv)
Transformers can implement both generalizable algorithms (e.g., induction heads) and simple positional shortcuts (e.g., memorizing fixed output positions). In this work, we study how the choice of pretraining data distribution steers a shallow transformer toward one behavior or the other. Focusing on a minimal trigger-output prediction task -- copying the token immediately following a special trigger upon its second occurrence -- we present a rigorous analysis of gradient-based training of a single-layer transformer. In both the infinite and finite sample regimes, we prove a transition in the learned mechanism: if input sequences exhibit sufficient diversity, measured by a low ``max-sum'' ratio of trigger-to-trigger distances, the trained model implements an induction head and generalizes to unseen contexts; by contrast, when this ratio is large, the model resorts to a positional shortcut and fails to generalize out-of-distribution (OOD). We also reveal a trade-off between the pretraining context length and OOD generalization, and derive the optimal pretraining distribution that minimizes computational cost per sample. Finally, we validate our theoretical predictions with controlled synthetic experiments, demonstrating that broadening context distributions robustly induces induction heads and enables OOD generalization. Our results shed light on the algorithmic biases of pretrained transformers and offer conceptual guidelines for data-driven control of their learned behaviors.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 35 of its 45 references that are in the map. First posted on arXiv 21 Dec 2025.
Builds on
35 of 45 references.
References · 35
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,718
- 2020Shortcut Learning in Deep Neural Networkscited by 1,969
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
- 2022In-context Learning and Induction Headscited by 964
- 2019Right for the Wrong Reasons: Diagnosing Syntactic Heuristics in Natural Language Inferencecited by 876
- 2019Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Prunedcited by 856
- 2023RWKV: Reinventing RNNs for the Transformer Eracited by 827
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
- 2022Transformers Learn Shortcuts to Automatacited by 268
- 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 199
23 more
- 2022Hidden Progress in Deep Learning: SGD Learns Parities Near the Computational Limitcited by 187
- 2022Neural Networks can Learn Representations with Gradient Descentcited by 161
- 2023Birth of a Transformer: A Memory Viewpointcited by 161
- 2022High-dimensional Asymptotics of Feature Learning: How One Gradient Step Improves the Representationcited by 150
- 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 146
- 2022Impact of Pretraining Term Frequencies on Few-Shot Reasoningcited by 142
- 2023The mechanistic basis of data dependence and abrupt learning in an in-context classification taskcited by 118
- 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 118
- 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
- 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 106
- 2024In-Context Language Learning: Architectures and Algorithmscited by 89
- 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 86
- 2023Length Generalization in Arithmetic Transformerscited by 66
- 2024Asymptotic theory of in-context learning by linear attentioncited by 55
- 2023On the Role of Attention in Prompt-tuningcited by 50
- 2024Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformerscited by 50
- 2025Learning Compositional Functions with Transformers from Easy-to-Hard Datacited by 36
- 2025Physics of Language Models: Part 4.1, Architecture Design and the Magic of Canon Layerscited by 33
- 2024One-layer transformers fail to solve the induction heads taskcited by 32
- 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 31
- 2024A phase transition between positional and semantic learning in a solvable model of dot-product attentioncited by 30
- 2025The Role of Sparsity for Length Generalization in Transformerscited by 8
- 2024On the Power of Convolution Augmented Transformercited by 6
Built on by
Citing papers per year: 2026: 6.
6 papers.
- 2026Mechanistic Data Attribution: Tracing the Training Origins of Interpretable LLM Unitscited by 10
- 2026Understanding Contextual Recall in Transformers: How Finetuning Enables In-Context Reasoning over Pretraining Knowledgecited by 3
- 2026Exemplar Retrieval Without Overhypothesis Induction: Limits of Distributional Sequence Learning in Early Word Learningcited by 0
- 2026Shortcut Solutions Learned by Transformers Impair Continual Compositional Reasoningcited by 0
- 2026Distance generalization in transformers: why bother with positional encoding?cited by 0
- 2026What Should Data Teach? Moving Bottlenecks Across Circuit, Store, and Usecited by 0
- 2026What Should Data Teach? Moving Bottlenecks Across Circuit, Store, and Use26 Sep 2026
- 2026Distance generalization in transformers: why bother with positional encoding?10 Sep 2026
- 2026Shortcut Solutions Learned by Transformers Impair Continual Compositional Reasoning6 May 2026
- 2026Exemplar Retrieval Without Overhypothesis Induction: Limits of Distributional Sequence Learning in Early Word Learning6 Apr 2026
- 2026Understanding Contextual Recall in Transformers: How Finetuning Enables In-Context Reasoning over Pretraining Knowledge21 Mar 2026
- 2026Mechanistic Data Attribution: Tracing the Training Origins of Interpretable LLM Units29 Jan 2026