Distinct mechanisms underlying in-context learning in transformers
Cole Gibson, Wenping Cui, Gautam Reddy
Key points
From the paper's conclusion- Put together, we show that transformers develop distinct subcircuits to implement in-context learning and identify conditions that favor certain mechanisms over others.
Abstract
Modern distributed networks, notably transformers, acquire a remarkable ability (termed in-context learning) to adapt their computation to input statistics, such that a fixed network can be applied to data from a broad range of systems. Here, we provide a complete mechanistic characterization of this behavior in transformers trained on a finite set 𝒮 of discrete Markov chains. The transformer displays four algorithmic phases, characterized by whether the network memorizes and generalizes, and whether it uses 1-point or 2-point statistics. We show that the four phases are implemented by multi-layer subcircuits that exemplify two qualitatively distinct mechanisms for implementing context-adaptive computations. Minimal models isolate the key features of both motifs. Memorization and generalization phases are delineated by two boundaries that depend on data diversity, K = | 𝒮 | . The first ( K 1 * ) is set by a kinetic competition between subcircuits and the second ( K 2 * ) is set by a representational bottleneck. A symmetry-constrained theory of a transformer's training dynamics explains the sharp transition from 1-point to 2-point generalization and identifies key features of the loss landscape that allow the network to generalize. Put together, we show that transformers develop distinct subcircuits to implement in-context learning and identify conditions that favor certain mechanisms over others.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Characterizing In-Context Learning: When Can Transformers Match Standard Learning Algorithms?2026
- Solvable dynamics model of in-context learningarXiv · 2026
- The Transformer Paradigm: Dynamic Processing and a New Principle of InferencearXiv · 2026
- In-Context Learning Before Specialisation: Theory of Learning in a Solvable Topic ModelarXiv · 2026
- Large Language Models as Nonlinear Dynamical Systems: The Three Clocks of Depth, Training, and GenerationarXiv · 2026
- Training Dynamics of Transformers on Unbounded Inputs: Attention Learning Can Lag Output Layer LearningarXiv · 2026