Two attention heads wired into one trick: a previous-token head in layer 1 tags every position with the token before it, and an induction head in layer 2 uses your current token to find where it last appeared and copies what came next. Feed it [A][B]…[A] and it answers [B]. This is the mechanism Olsson et al. tied to the sudden onset of in-context learning — the copy engine, built here by hand so every readout has a closed form.
source Olsson et al., In-context Learning and Induction Heads (2022), Anthropic / transformer-circuits.pub — arxiv.org/abs/2209.11895 rendered, not quoted: [A][B] … [A] → [B]
Attention-only, two layers, no MLP, hardmax attention (the zero-temperature limit of softmax — exact, deterministic).
Layer 1 — previous-token head. Attention matrix is the sub-diagonal: position i attends to i−1. It copies that token's identity into a separate "prev" channel. So position k now carries token[k−1].
Layer 2 — induction head. Query = current token[i]. Key at k = the prev-channel token[k−1]. They match exactly when token[k−1]=token[i], i.e. k−1=j is a prior occurrence of the current token — so it attends to k=j+1, the position after the match, and outputs token[j+1].
Two the-attention-heads given a concrete job. Neither head alone copies anything; composed — layer 2 reading the channel layer 1 wrote — they become a pattern-completer. This sphere is the-attention-heads with the composition made load-bearing: the circuit Olsson et al. named as the engine of in-context learning.
neighbour the-attention-heads → the-induction-head
Live re-check of the running panel against the closed-form expectation. Green while the circuit copies correctly; flips red the instant the wiring is tampered.
A repeated sequence. The block A B C appears, then repeats — the induction head should complete the repeat from the second occurrence onward.
Per-position prediction from the live circuit. A green outline = a confident copy; the attended source cell (the position after the prior match) is highlighted.
Proven result: after the circuit predicts the repeat.
Shift the previous-token head to the wrong offset (attend to i−2). Now the induction head keys on the wrong position and the copy [A][B]…[A]→[B] breaks. The WITNESS (7) catches it live.