GPT-2 Small: which head feeds which

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.

How to read this page. Each grid shows edges that beat their random controls, first those confirmed on held-out seeds: a row per sending head, a column per receiving head, each cell the percent of the receiver's gap that the sender's output restores when it reaches that receiver alone (path patching). Red helps, blue pushes away; 0 means the edge was not tested or did not pass.

An edge is one head's output reaching one later head's query, key or value, or the output. Of GPT-2 Small's 29,089 edges, the 400 with the largest estimated effects were path-patched on 10 seeds, each against 20 random changes of the same size. An edge passes when its effect is at least 5% of its receiver's gap and larger than every control's, in either direction.

Confirmed on held-out seeds

The same edges, with their controls, on ten held-out seeds: an edge that passes again is confirmed.

181 of the 186 edges that pass on the 10 finding seeds pass again on the 10 held-out seeds.

into queries and keys: 174 of 176 confirmed, the 15 largest shown
4.11 5.1.k finding +36%, held-out +37%: confirmed
4.11 6.9.k finding +40%, held-out +41%: confirmed
4.11 5.5.k finding +35%, held-out +36%: confirmed
4.7 5.1.k finding -18%, held-out -20%: confirmed
4.11 7.10.k finding +25%, held-out +25%: confirmed
5.6 6.9.k finding +23%, held-out +26%: confirmed
4.11 7.2.k finding +24%, held-out +25%: confirmed
6.6 7.1.q finding -41%, held-out -41%: confirmed
4.11 5.0.k finding +38%, held-out +40%: confirmed
4.7 6.9.k finding -17%, held-out -19%: confirmed
3.7 5.1.k finding +13%, held-out +13%: confirmed
5.5 7.1.q finding +37%, held-out +41%: confirmed
4.11 5.8.k finding +38%, held-out +39%: confirmed
4.7 5.5.k finding -16%, held-out -16%: confirmed
3.7 6.9.k finding +15%, held-out +15%: confirmed

into values and the logits: 7 of 10 confirmed
10.7 logits finding -10%, held-out -9%: confirmed
7.2 logits finding +8%, held-out +8%: confirmed
9.6 logits finding +8%, held-out +7%: confirmed
9.9 logits finding +7%, held-out +7%: confirmed
6.9 logits finding +7%, held-out +6%: confirmed
7.10 logits finding +7%, held-out +7%: confirmed
10.1 logits finding +6%, held-out +6%: confirmed
10.0 logits finding +5%, held-out +5%: tested only
11.10 logits finding -5%, held-out -5%: tested only
10.6 logits finding +5%, held-out +5%: tested only
edges into keys confirmed on held-out seeds
edges into queries confirmed on held-out seeds

Which edges beat their random controls

path patching of 400 edges over 10 seeds: 186 have an effect of at least 5% of their receiver's gap and beat all 20 of their random controls; 23 are not judged (their receiver's gap is not positive on every seed).

into queries and keys: 176 pass, the 15 largest shown
4.11 5.1.k +36% (controls up to 1%), attention score +5.34
4.11 6.9.k +40% (controls up to 1%), attention score +4.56
4.11 5.5.k +35% (controls up to 1%), attention score +3.78
4.7 5.1.k -18% (controls up to 1%), attention score -2.66
4.11 7.10.k +25% (controls up to 1%), attention score +2.64
5.6 6.9.k +23% (controls up to 1%), attention score +2.62
4.11 7.2.k +24% (controls up to 0%), attention score +2.19
6.6 7.1.q -41% (controls up to 1%), attention score -2.15
4.11 5.0.k +38% (controls up to 2%), attention score +2.06
4.7 6.9.k -17% (controls up to 0%), attention score -1.97
3.7 5.1.k +13% (controls up to 0%), attention score +1.94
5.5 7.1.q +37% (controls up to 1%), attention score +1.94
4.11 5.8.k +38% (controls up to 1%), attention score +1.87
4.7 5.5.k -16% (controls up to 1%), attention score -1.69
3.7 6.9.k +15% (controls up to 1%), attention score +1.67

into values and the logits: 10 pass
10.7 logits -10% (controls up to 1%), logit difference -1.37
7.2 logits +8% (controls up to 0%), logit difference +1.18
9.6 logits +8% (controls up to 0%), logit difference +1.09
9.9 logits +7% (controls up to 0%), logit difference +1.01
6.9 logits +7% (controls up to 0%), logit difference +0.97
7.10 logits +7% (controls up to 0%), logit difference +0.96
10.1 logits +6% (controls up to 0%), logit difference +0.87
10.0 logits +5% (controls up to 0%), logit difference +0.75
11.10 logits -5% (controls up to 0%), logit difference -0.73
10.6 logits +5% (controls up to 0%), logit difference +0.72

Into keys: where to look

Into keys: where to look

Into queries: what to look for

Into queries: what to look for

Into the output

Into the output