GPT-2 Small: one head's attention

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. One head's attention: a row per word that looks (top to bottom, in order), a column per word looked at, each cell the percent of that row's attention. An induction head shows a bright stripe just below the diagonal in the second half: each word looks at the word after its earlier copy.

One head's attention: a row per query token, a column per key token, each cell the weight in percent. Heads are named layer.head, from 0.

head 5.1

The circuit's heads:

attention heatmap of one head
Every head as a link

0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.10 0.11 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 6.11 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 8.10 8.11 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 9.10 9.11 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.11 11.0 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.10 11.11