What is an induction head, and how can a two-layer attention-only transformer use a pair of heads to complete a pattern such as ? What evidence ties induction heads to in-context learning?
Sequence models and transformers, In-context learning
Level L4 Advanced. Length Long. Nature Th Theoretical.
What's being asked
Whether you can describe the circuit (previous-token head plus induction head) and the empirical link to in-context learning.
Key idea
An induction head finds an earlier occurrence of the current token and copies the token that followed it. It works by composing a previous-token head in layer 1 with a head in layer 2 whose keys use that information.
Steps
- Task: the context contains and the model should predict . The pattern was never seen in training, so it must be copied from the context.
- Layer 1, previous-token head: at each position it attends to and writes the identity of the previous token into the residual stream at . So the position of now carries the label "preceded by ".
- Layer 2, induction head: the query at the final is built from the current token . Its keys come from layer 1's output, so the key at matches "preceded by ". The attention is large on .
- The value (OV circuit) then copies the identity of to the output, which raises the logit of .
- Evidence (Olsson et al., 2022): early in training, models with more than one layer show an abrupt phase change. Induction heads form, a bump appears in the training loss, and the in-context learning score improves sharply at the same time. The score is the loss at the 500th token minus the loss at the 50th token, so a more negative value means more benefit from earlier context. Directly ablating the induction heads in small attention-only models removes most of the in-context learning.
- Caveat: the ablation evidence is for small attention-only models. For larger models with MLPs the evidence is correlational: induction heads appear alongside in-context learning, but a causal link to rich few-shot learning is not proven.
Common mistakes
- Saying one layer is enough. A single head cannot know what preceded each key, which is why the previous-token head in an earlier layer is needed, and why the phase change only occurs in models with more than one layer.
- Describing them as a general explanation of all in-context learning.
- Mixing up the roles: the previous-token head is in the earlier layer.
How long your answer should be
Half a page; 5–6 minutes.
Last checked on 4 December 2026.
Read this
Previous in Sequence models and transformers: A transformer block can be written post-LN, , or pre-LN, . How do gradients flow back through layers in the two, and why does post-LN usually need learning-rate warm-up?
Next in Sequence models and transformers: How do you show that skip-gram with negative sampling, with negatives per positive pair, has an optimum at for each (word, context) pair, so it implicitly factorises a shifted PMI matrix (Levy and Goldberg). What assumptions do you need?