gpt2 at revision 607a30d783dfa663caf39e06633721c8d4cfcd7e, float32, on a beginning-of-text token, then 16 random tokens, then the same 16 again. Tokens: <|endoftext|> | continued | SS | Louis | attack | vary | CD | Does | deeper | Gr | pro | shopping | clean | leadership | Is | girl | facility | continued | SS | Louis | attack | vary | CD | Does | deeper | Gr | pro | shopping | clean | leadership | Is | girl | facility
Attention pictures and scores show where heads look: observations, not causal evidence. What the model needs is tested by interventions, on the Effects and Edges pages.
A language model reads text and guesses the next word. Inside, GPT-2 Small is a stack of 12 layers. Each layer has 12 attention heads, which look back at earlier words and move information from them, and one MLP, which works on each word where it stands. Every word carries a running notepad up the stack, the residual stream: each head and MLP reads it and adds to it, and the top of the stack turns it into a guess.
Nobody wrote down which head does what; the model learned it from text. A circuit is a small group of heads (and MLPs) that together do one job. This site shows how we look for one, and how sure we are about each part of it.
Give the model a list of random words, then the same list again. The second time through, it predicts each next word almost perfectly: it looks back at what followed this word the first time, and copies it. Two kinds of heads are known to do this together:
This is the simplest way a model learns from the text in front of it. The paper behind this project, Gao and Gao's "A Circuit for In-Context Learning", studies a richer version of it in larger models.
Looking is not proving. Where a head looks, its attention, only names a suspect. So we:
Every head and every arrow between heads carries one of three evidence levels, drawn the same way in every picture:
GPT-2 Small's copying needs or uses 12 heads that pass every check (confirmed): the previous-token head, the five induction heads, and six more that the interventions found and whose roles are not yet known. Which head feeds which is tested edge by edge on the Edges page: 4.11 feeds every induction head's key, and the induction heads feed the queries of 7.6, 9.6, 9.9 and 10.1, against random controls and again on held-out prompts. The circuit's 22 arrows are confirmed.
| Head | Role | Evidence | Basis (percent effects) |
|---|---|---|---|
| 4.11 | previous token | confirmed | mean ablation confirmed (10%, held-out 13%); denoising under 5% |
| 5.1 | induction | confirmed | mean ablation confirmed (22%, held-out 22%); denoising confirmed (12%, held-out 13%) |
| 5.5 | induction | confirmed | mean ablation confirmed (6%, held-out 5%); denoising confirmed (11%, held-out 12%) |
| 6.9 | induction | confirmed | mean ablation tested only (5%, held-out 4%); denoising confirmed (15%, held-out 15%) |
| 7.2 | induction | confirmed | denoising confirmed (12%, held-out 12%); mean ablation under 5% |
| 7.10 | induction | confirmed | denoising confirmed (8%, held-out 8%); mean ablation under 5% |
| 7.6 | needed; reads the induction heads through its query | confirmed | mean ablation confirmed (9%, held-out 8%); denoising under 5% |
| 8.5 | needed, role not yet known | confirmed | mean ablation confirmed (9%, held-out 7%); denoising under 5% |
| 9.9 | restores; reads the induction heads through its query | confirmed | denoising confirmed (7%, held-out 7%); mean ablation under 5% |
| 9.6 | restores; reads the induction heads through its query | confirmed | denoising confirmed (7%, held-out 6%); mean ablation under 5% |
| 10.1 | restores; reads the induction heads through its query | confirmed | denoising confirmed (6%, held-out 6%); mean ablation under 5% |
| 0.1 | restores; feeds 6.9's query | confirmed | denoising confirmed (5%, held-out 6%); mean ablation under 5% |