Across 34 decoder-only transformers ranging from 1-layer attention-only models to a 40-layer, 13-billion-parameter model, in-context learning does not grow smoothly over training; it snaps on during a single narrow phase change between 2.5 billion and 5 billion tokens. Catherine Olsson, Nelson Elhage, Neel Nanda, Chris Olah, and colleagues at Anthropic assembled six lines of evidence pointing to one mechanism behind that jump: induction heads, two-layer attention circuits that look back for earlier occurrences of the current context and copy whatever came next.
For engineers trying to reason about modern prompt adaptation and sudden capability shifts, the paper bridges microscopic circuit weights from the residual stream framework with macroscopic training loss curves. Instead of treating in-context learning as mysterious test-time gradient descent or mesa-optimization, the authors show how a reusable lookup algorithm turns a transformer’s context window into an online nearest-neighbor memory.
- One abrupt phase change: An in-context learning score (50th-token loss minus 500th-token loss) jumps from under 0.15 nats before the transition window to roughly 0.4 nats afterward, forming over 75% of final in-context learning at 1% to 2% of full training.
- Two layers required: Standard 1-layer models lack cross-layer head composition and never form induction heads or reach the 0.4-nat jump, until a “smeared key” tweak lets a single layer interpolate current and previous keys.
- Causal proof in small models: Across more than 50,000 pattern-preserving attention head ablations, knocking out induction heads eliminates almost all in-context learning in small attention-only transformers.
- Fuzzy generalization at scale: In a 40-layer 13B model, the exact same heads that pass literal random-token copying tests also drive cross-language translation and synthetic category pattern matching.
The phase change that splits one-layer from deep models
Most interpretability work looks at a fully trained checkpoint. Olsson and colleagues instead tracked 200 snapshots across 10,000 steps (about 10 billion tokens) for small 1-layer to 6-layer models (d_model = 768, 12 heads per layer, 8,192-token context, 2^16 token vocabulary), alongside 14 to 15 logarithmic checkpoints for six full-scale models spanning 4 layers (13M non-embedding parameters) up to 40 layers (13B parameters, d_model = 5120). Rather than measuring few-shot accuracy on hand-picked benchmarks as in GPT-3, they adopted Kaplan et al.’s broader definition of in-context learning: how much better a model predicts tokens late in a context than early in a context, operationalized as 50th-token loss minus 500th-token loss averaged over 10,000 sequences of length 512.
Naively, one would expect in-context learning to climb smoothly with training steps and model parameters, just like perplexity. Instead, every model with at least two layers undergoes four synchronized shifts inside the 2.5B to 5B token window:
- In-context learning jumps: Before the window, the 50th-to-500th token delta sits below 0.15 nats. Across the transition, it climbs sharply to roughly 0.4 nats and stays flat thereafter.
- Induction heads appear: Scoring every head on repeated random 25-token sequences (prefix matching on
[A][B]...[A]and logit-copying via ReLU-filtered direct-path attribution) reveals induction heads forming abruptly in the same window. - Training loss shows a non-convex bump: The aggregate training curve temporarily steepens, creating the only non-convex inflection point in the entire training run. Scheduled changes cannot explain it: learning rate warmup finishes at 1.5B tokens, and weight decay drops later at 4,750 steps (around 5B tokens).
- Function-space trajectories pivot: Applying PCA to 10,000-element per-token loss vectors shows every multi-layer model turning a sharp corner during the exact same interval, while the 1-layer model keeps moving along its baseline curve.
Looking token by token at the first paragraph of Harry Potter confirms what changes inside that bump. Repeated names like “The Dursleys” gain large likelihood boosts on second and third mentions. Conversely, the first occurrence of “Mrs Potter” gets measurably worse right after the phase change because “Mrs” had previously been followed by “Dursley,” tempting the newly formed induction heads to predict the wrong continuation.
To rule out depth-unrelated explanations, the authors intervened directly on architecture. A standard 1-layer transformer cannot build an induction head because a head’s attention score depends only on the query token and the attended key token, never on what preceded the attended token. The authors added a single trainable scalar alpha_h per head so each key vector blends current and previous positions: k_j^h = sigma(alpha_h) k_j^h + (1 - sigma(alpha_h)) k_{j-1}^h. With that minimal “smeared key” change, 1-layer models suddenly exhibit the phase change and gain in-context learning, while 2-layer models shift their phase change earlier in training.
Six lines of evidence, and where causal proof stops
The paper draws a disciplined boundary between causal proof and analogy. In small attention-only transformers (1 to 6 layers), logits decompose into a direct embedding path plus a nearly linear sum of head outputs. That structure makes pattern-preserving ablation clean: run the unperturbed model to record all attention patterns, then zero one head’s residual output while freezing later layers’ attention patterns. Knocking out induction heads erases virtually the entire in-context learning score and reverses the phase-change loss vector, whereas ablating unrelated heads can raise the score by hurting normal bigram prediction.
Once MLPs enter the picture, ablations lose precision. Removing a head can shift input statistics and break downstream MLP biases, or redundant heads can mask one another through LayerNorm rescaling. At the 13B scale, exhaustive ablations become prohibitive because cost scales as O(N^1.33) over 10,000 examples per snapshot.
To bridge that gap in the 40-layer 13B model, the authors inspected heads passing the strict random-token induction test and tested them on harder prompts. The exact same heads perform literal passage copying (a layer 21 head with 0.89 copying score and 0.75 prefix-matching score), cross-lingual English/French/German translation where attention meanders across reordered clauses (a layer 7 head with 0.20 copying score and 0.85 prefix-matching score), and synthetic pattern classification on (month/color) (animal/fruit): 0..3 templates, where a layer 26 head allocates roughly 65% of its colon-token attention to earlier lines matching the full category pair while skipping partial matches like “grey bird” after “January bird” (the summary table also highlights a layer 8 pattern-matching head scoring 0.69 on copying and 0.94 on prefix matching).
Mechanistically, an induction circuit acts as an in-context nearest-neighbor lookup [A*][B*] ... [A] -> [B]: when earlier layers build abstract embeddings where equivalent words or categories sit close together, K-composition (W_QK reading the previous-token subspace) and positive-eigenvalue W_OV copying operate on concepts rather than raw token IDs. Replications by Adam Scherlis (recovering 99% of previous-token loss difference and 65% plus 10% for two- and three-token matches in two-layer models) and Tom Lieberum (locating induction heads in GPT-2 XL and GPT-Neo-2.7B) reinforced the pattern, though GPT-2 also uses a pointer-arithmetic Q-composition variant later seen in the IOI circuit.
Compare all six arguments across model scales
Switch through the tabs below to inspect how the six lines of evidence operate, why simpler explanations fail, and where causal certainty tapers off as models gain MLPs and scale up to 13B parameters.
Select an argument (or use Left and Right arrow keys) to compare the experiment, the naive expectation it falsifies, and the evidentiary limit.
Macroscopic co-occurrence across training
Argument 1In-context learning jumps from under 0.15 to 0.4 nats at 2.5B to 5B tokens, synchronized with induction head formation, a training loss bump, and a PCA pivot.
- Naive expectation broken
- In-context learning does not climb smoothly with training steps or parameters; over 75% of the score forms in one non-convex transition.
- Paper's evidence
- Measured across 34 models on Common Crawl plus books and an alternate books-only dataset, independent of learning-rate warmup (1.5B) and weight decay (5B).
- Scope and strength
- Medium correlational evidence across small and 13B models; large models only had 14 to 15 logarithmic checkpoints, lowering time resolution.
- Open confound
- A shared latent change, such as learning cross-layer residual composition, could trigger induction heads and other composition circuits together.
Architectural perturbation shifts the cliff
Argument 2Interpolating each key with the previous token's key lets a 1-layer model express induction heads and triggers the phase change.
- Naive expectation broken
- One-layer models do not fail at in-context learning merely from having fewer parameters; they lack a way to read predecessor information in keys.
- Paper's evidence
- Adding k_j^h = sigma(alpha_h) k_j^h + (1 - sigma(alpha_h)) k_{j-1}^h creates the phase change in 1L models and pulls it earlier in 2L models.
- Scope and strength
- Medium interventional evidence in small models; weak interventional evidence for large models.
- Design insight
- Proves key-shifting is the minimal architectural ingredient needed to unlock induction-driven sequence adaptation.
Test-time ablations in small models
Argument 3More than 50,000 pattern-preserving head ablations show induction heads account for almost all in-context learning in small attention-only models.
- Naive expectation broken
- Full ablations scramble downstream Q and K matrices; freezing attention patterns isolates each head's direct residual contribution cleanly.
- Paper's evidence
- Zeroing induction head outputs in 2L to 6L attention-only models wipes out the in-context learning score and reverses the phase-change loss vector.
- Scope and strength
- Strong causal evidence for small attention-only models; medium causal evidence for small MLP models; untested at 13B scale.
- Why MLPs muddy tests
- MLPs interact non-additively with heads, so ablating a head can shift effective MLP biases or be hidden by redundant backup heads.
Fuzzy copying and translation at 13B
Argument 4Heads in the 40-layer 13B model that pass strict random-token induction tests also execute translation and synthetic function classification.
- Naive expectation broken
- Strict induction heads are not narrow n-gram copiers; the exact same heads implement fuzzy [A*][B*] ... [A] -> [B] analogies.
- Paper's evidence
- 13B heads span literal Harry Potter copying (L21, copy 0.89, prefix 0.75), EN/FR/DE translation (L7, 0.20, 0.85), and 65% accurate template matching.
- Scope and strength
- Plausibility evidence at full 13B scale based on detailed qualitative case studies rather than exhaustive dataset-wide attribution.
- Downstream note
- Translation heads show weaker direct logit attribution (0.20 copying score) because later layers refine their semantic outputs.
Weight-level mechanism and continuity to scale
Arguments 5 & 6K-composition plus positive-eigenvalue OV copying explains small models from weights alone, and macroscopic curves scale smoothly to 13B.
- Naive expectation broken
- Large models do not gain their edge late in context; they pull ahead in the first 10 tokens using pretrained world knowledge, then gain the same 0.4 nats.
- Paper's evidence
- QK trace of previous-token K-composition matches empirical prefix matching; PCA, bump timing, and 0.4-nat delta stay continuous from 2L to 40L.
- Where induction lives
- Induction heads sit in the final layer of small attention-only models, shift to layer N-1 in 5L-6L MLP models, and form before mid-depth in 24L-40L.
- Safety takeaway
- No evidence of test-time mesa-optimization emerged; in-context learning looks like nearest-neighbor pattern lookup over learned representations.
If you skip clicking through the tabs, the five-part synthesis of the paper’s case is straightforward:
- Phase change timing: Across 34 models with two or more layers, in-context learning snaps from under 0.15 to 0.4 nats alongside induction head formation and a non-convex loss bump around 2.5B to 5B tokens.
- Architectural cause: One-layer models fail until the smeared-key interpolation lets a head read previous-token information in its keys, shifting the phase transition into a single layer.
- Causal knockout: Over 50,000 pattern-preserving ablations prove induction heads drive nearly all in-context learning in small attention-only models, though MLPs complicate additivity.
- Fuzzy generalization: Individual 13B induction heads combine strict random-token prefix matching with cross-lingual translation and synthetic category matching via nearest-neighbor analogies.
- Scale continuity and limits: Macroscopic curves stay remarkably uniform from 2 layers to 40 layers, yet large models could still rely on additional non-induction composition circuits that form in the same window.
Caveats, mysteries, and what it means for builders
The authors are unusually candid about what their evidence does not settle. First, correlational co-occurrence in large models has a plausible confound: because induction heads require K-composition between layers, the 2.5B to 5B token phase change might mark the moment gradient descent learns how to compose layers across the residual stream in general. If dozens of non-induction composition heads also switch on in that same window in a 40-layer model, induction heads might explain only part of late-training in-context learning at scale.
Second, the constant 0.4-nat score hides shifting difficulty. Even though token-50 minus token-500 loss stays near 0.4 nats from 2 layers to 40 layers, the 13B model achieves much lower absolute loss by token 10 thanks to broader world knowledge. Shaving another 0.4 nats off a much lower baseline later in context requires harder inferences, and later checkpoints could gradually swap simple copying heads for richer MLP-mediated circuits without changing the headline delta.
Third, several anomalies remain unexplained: full-scale models above 16 layers develop “anti-copying prefix-search” heads with negative copying scores; the 6-layer attention-only model grows a late non-induction head whose ablation reverses the phase change; the 6-layer MLP model contains a single induction head whose knockout increases the in-context learning score; and the ordering of loss-curve derivatives across model sizes inverts right at the phase change.
For engineers building with LLMs and interpretability tools today, the lasting shift is conceptual. Prompt sensitivity is not magic test-time weight training: it is largely driven by composable attention circuits matching context prefixes against earlier representations, a mechanism that tools like path patching later traced inside concrete tasks such as indirect object identification. When a model repeats an earlier formatting mistake or latches onto a misleading in-context pattern (“Mrs Potter” after “Mrs Dursley”), you are often watching induction circuits outvote local priors.


