An induction head is an attention head in a transformer that implements a simple copying rule: when the current token appeared earlier in the context, the head attends to the token that followed that earlier occurrence and raises the probability of predicting it again. Given a sequence such as “A B … A”, it pushes the model toward “B”.
In Explainable AI, induction heads are one of the best documented results of mechanistic interpretability, the effort to reverse engineer neural networks into understandable algorithms. Researchers at Anthropic described them in 2021 and 2022 and argued that they account for a large share of in-context learning in language models, which made them a reference case for circuit analysis.
How an induction head completes a pattern
An induction head does not work alone. It forms a two-head circuit across at least two layers. In an earlier layer, a previous-token head attends from each position to the position directly before it and writes “the preceding token was A” into the residual stream at the position of B.
In a later layer, the induction head runs a prefix-matching search. Its query at the current token A looks for positions whose stored information says “preceded by A”, which locates B. Its output-value circuit then copies the identity of B toward the output logits. The interaction in which a later head’s keys read an earlier head’s output is called K-composition.
The table below separates the steps of the circuit and the role of each part.
| Step | Component | What it computes |
|---|---|---|
| 1 | Previous-token head | Copies the identity of token A into the position of B |
| 2 | Query of the induction head | Encodes the current token A |
| 3 | Key of the induction head | Reads the shifted information “preceded by A” |
| 4 | Attention pattern | Concentrates on the token after the earlier A |
| 5 | Output-value circuit | Copies token B toward the next-token prediction |
Evidence that induction heads drive in-context learning
The central evidence comes from training dynamics. Models with two or more layers show a sudden phase change early in training, when induction heads form within a short window. At the same moment, the in-context learning score, measured as the loss on late tokens minus the loss on early tokens of a long context, improves sharply, and a visible bump appears in the training loss curve.
Researchers combined several lines of argument, and the strength of each differs by model size. The following table summarizes them.
| Evidence type | What was observed | Strength |
|---|---|---|
| Co-occurrence | Heads and in-context learning appear at the same step | Consistent across sizes |
| Architectural change | Easier head formation shifts the phase change earlier | Strong in small models |
| Ablation | Removing heads reduces in-context learning | Causal in small models |
| Mechanistic reading | Weights implement the copying rule directly | Complete for attention-only models |
| Analogy to larger models | Similar heads found in large models | Suggestive, not conclusive |
The honest conclusion is that the causal case is strongest for small attention-only models. In large models with multilayer perceptrons, induction heads clearly exist and matter, but how much of in-context learning they explain remains partly open.
Literal and abstract induction behavior
The simplest induction heads copy exact token repeats, which is useful for names, code identifiers and repeated phrases. Larger models also contain heads that match fuzzy or abstract patterns: they find an earlier position with a similar meaning rather than an identical token and copy the corresponding continuation.
Such generalized heads can support translation-like behavior, where a word in one language triggers attention to its counterpart in a parallel passage, and few-shot tasks, where the head links a new input to earlier input-output pairs. The table below contrasts the variants.
| Variant | Matching rule | Typical effect |
|---|---|---|
| Literal induction | Exact token match | Repeats names and code symbols |
| Fuzzy induction | Similar token or subword | Handles spelling and casing variants |
| Abstract induction | Matching meaning or role | Supports translation and few-shot patterns |
How researchers detect induction heads
A standard test feeds the model a sequence of random tokens repeated twice. Because random tokens cannot be predicted from language statistics, any loss reduction on the second half must come from copying the first half, which isolates induction behavior.
Two scores are then computed for every head. The prefix-matching score measures how much attention goes to the token after the earlier copy of the current token, and the copying score measures whether the output-value circuit increases the logit of the attended token. Confirmation usually requires activation patching or ablation to show a causal effect on predictions.
| Diagnostic | Question answered | Limitation |
|---|---|---|
| Repeated random tokens | Does the model copy earlier sequences | Artificial input distribution |
| Prefix-matching score | Does the head attend to the right position | Attention alone is not causation |
| Copying score | Does the head promote the attended token | Ignores downstream components |
| Head ablation | Does removing the head hurt prediction | Other heads may compensate |
Limits and common misconceptions
Induction heads are a landmark finding but are often overstated. Several clarifications help practitioners read the literature correctly:
- They do not explain all in-context learning; larger models combine them with many other mechanisms.
- Attention visualization alone cannot prove that a head is an induction head; causal tests are needed.
- A one-layer attention-only transformer cannot form the circuit, because it needs composition between layers.
- Many heads are polysemantic and perform induction only as one of several functions.
Explained without jargon
Imagine reading a story where the phrase “Captain Rivers” appears early. Later you see “Captain” again. You expect “Rivers” next, because you remember what followed last time.
An induction head is the part of a language model that does exactly this. It looks back for the earlier spot, checks what came after it and suggests the same word. This small copying trick helps models follow names, code and patterns given in a prompt. Finding it showed that model behavior can be traced to understandable parts.
A typical use case
An interpretability team studies why a small code model keeps repeating a misspelled variable name from earlier in a file. The engineers run the repeated random token test and compute prefix-matching and copying scores for every head. Two heads in layer five score far above the rest, and a previous-token head in layer two feeds them.
Activation patching confirms the circuit: when the team patches the outputs of the two heads with activations from a clean run, the model stops copying the misspelling and predicts the correct identifier from training data instead. The finding explains the bug as faithful induction behavior rather than a defect, and the team adds a linting step to catch misspellings before code reaches the model.