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 [A][B]…[A]→[B]? 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

  1. Task: the context contains …[A][B]…[A] and the model should predict [B]. The pattern was never seen in training, so it must be copied from the context.
  2. Layer 1, previous-token head: at each position j it attends to j−1 and writes the identity of the previous token into the residual stream at j. So the position of [B] now carries the label "preceded by [A]".
  3. Layer 2, induction head: the query at the final [A] is built from the current token [A]. Its keys come from layer 1's output, so the key at [B] matches "preceded by [A]". The attention is large on [B].
  4. The value (OV circuit) then copies the identity of [B] to the output, which raises the logit of [B].
  5. 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.
  6. 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

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, xl+1=LN(xl+Fl(xl)), or pre-LN, xl+1=xl+Fl(LN(xl)). How do gradients flow back through L 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 K negatives per positive pair, has an optimum at w⊤c=PMI(w,c)−log⁡K for each (word, context) pair, so it implicitly factorises a shifted PMI matrix (Levy and Goldberg). What assumptions do you need?