mlsanityData to 14 Oct 2026

From Shortcut to Induction Head: How Data Diversity Shapes Algorithm Selection in Transformers

arXiv 2512.18634 ↗First posted 21 Dec 2025cs.LG stat.MLcited by 6

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

  1. 2017Attention Is All You Needcited by 60,361
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,718
  4. 2020Shortcut Learning in Deep Neural Networkscited by 1,969
  5. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
  6. 2022In-context Learning and Induction Headscited by 964
  7. 2019Right for the Wrong Reasons: Diagnosing Syntactic Heuristics in Natural Language Inferencecited by 876
  8. 2019Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Prunedcited by 856
  9. 2023RWKV: Reinventing RNNs for the Transformer Eracited by 827
  10. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
  11. 2022Transformers Learn Shortcuts to Automatacited by 268
  12. 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 199
23 more
  1. 2022Hidden Progress in Deep Learning: SGD Learns Parities Near the Computational Limitcited by 187
  2. 2022Neural Networks can Learn Representations with Gradient Descentcited by 161
  3. 2023Birth of a Transformer: A Memory Viewpointcited by 161
  4. 2022High-dimensional Asymptotics of Feature Learning: How One Gradient Step Improves the Representationcited by 150
  5. 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 146
  6. 2022Impact of Pretraining Term Frequencies on Few-Shot Reasoningcited by 142
  7. 2023The mechanistic basis of data dependence and abrupt learning in an in-context classification taskcited by 118
  8. 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 118
  9. 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
  10. 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 106
  11. 2024In-Context Language Learning: Architectures and Algorithmscited by 89
  12. 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 86
  13. 2023Length Generalization in Arithmetic Transformerscited by 66
  14. 2024Asymptotic theory of in-context learning by linear attentioncited by 55
  15. 2023On the Role of Attention in Prompt-tuningcited by 50
  16. 2024Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformerscited by 50
  17. 2025Learning Compositional Functions with Transformers from Easy-to-Hard Datacited by 36
  18. 2025Physics of Language Models: Part 4.1, Architecture Design and the Magic of Canon Layerscited by 33
  19. 2024One-layer transformers fail to solve the induction heads taskcited by 32
  20. 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 31
  21. 2024A phase transition between positional and semantic learning in a solvable model of dot-product attentioncited by 30
  22. 2025The Role of Sparsity for Length Generalization in Transformerscited by 8
  23. 2024On the Power of Convolution Augmented Transformercited by 6

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 6.

6 papers.