Induction head

Also known as: induction heads

On this page 7

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.

StepComponentWhat it computes
1Previous-token headCopies the identity of token A into the position of B
2Query of the induction headEncodes the current token A
3Key of the induction headReads the shifted information “preceded by A”
4Attention patternConcentrates on the token after the earlier A
5Output-value circuitCopies token B toward the next-token prediction
Steps of the induction circuit

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 typeWhat was observedStrength
Co-occurrenceHeads and in-context learning appear at the same stepConsistent across sizes
Architectural changeEasier head formation shifts the phase change earlierStrong in small models
AblationRemoving heads reduces in-context learningCausal in small models
Mechanistic readingWeights implement the copying rule directlyComplete for attention-only models
Analogy to larger modelsSimilar heads found in large modelsSuggestive, not conclusive
Lines of evidence and their strength

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.

VariantMatching ruleTypical effect
Literal inductionExact token matchRepeats names and code symbols
Fuzzy inductionSimilar token or subwordHandles spelling and casing variants
Abstract inductionMatching meaning or roleSupports translation and few-shot patterns
Variants of induction behavior

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.

DiagnosticQuestion answeredLimitation
Repeated random tokensDoes the model copy earlier sequencesArtificial input distribution
Prefix-matching scoreDoes the head attend to the right positionAttention alone is not causation
Copying scoreDoes the head promote the attended tokenIgnores downstream components
Head ablationDoes removing the head hurt predictionOther heads may compensate
Common diagnostics for induction heads

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.