Head gallery
Nobody tells a head what to look for: each one finds a job during training. We measured what each of the paper model's 24 heads does on 805 sentences it never saw in training, and named it in plain words. Pick a head to see the numbers and three examples.
Encoder self-attention
Layer 1, head 1
Spreads its attention evenly over the sentence, with a slight lean towards each word itself and its neighbours.
Strongest: the word itself, 15.8 % of its attention (even spread: 11.8 %)Layer 1, head 2
Spreads its attention widely: the word itself and the words beside it get only a little more than the rest.
Strongest: the word itself, 15.9 % of its attention (even spread: 11.8 %)Layer 1, head 3
Looks at the word itself and at the word after it.
Strongest: the word itself, 23.5 % of its attention (even spread: 11.8 %)Layer 1, head 4
Leans a little towards the word before, but mostly spreads its attention.
Strongest: the word before, 17.2 % of its attention (even spread: 11.8 %)Layer 2, head 1
From “it”, looks back at the noun it stands for about half of the time; other words look at their neighbours.
Strongest: from “it”, the noun it stands for, 54.0 % of its attention (even spread: 9.3 %)Layer 2, head 2
Spreads its attention, with some extra weight on the word itself and on the punctuation.
Strongest: the word itself, 20.1 % of its attention (even spread: 11.8 %)Layer 2, head 3
Links “it” to the noun it stands for in the sentence before; other words rest on the full stops and the end.
Strongest: from “it”, the noun it stands for, 84.3 % of its attention (even spread: 9.3 %)Layer 2, head 4
From “it”, partly looks back at its noun; other words look at the next word and the punctuation.
Strongest: from “it”, the noun it stands for, 31.2 % of its attention (even spread: 9.3 %)Decoder masked self-attention
Layer 1, head 1
Looks at the German word just before.
Strongest: the word before, 43.3 % of its attention (even spread: 24.1 %)Layer 1, head 2
Looks at the word itself, and at <s> and the full stops.
Strongest: the word itself, 41.0 % of its attention (even spread: 24.1 %)Layer 1, head 3
Rests mostly on <s> and the full stops: a place to park attention when no word is needed.
Strongest: punctuation and sentence ends, 59.8 % of its attention (even spread: 26.1 %)Layer 1, head 4
Looks mostly at the word itself.
Strongest: the word itself, 41.8 % of its attention (even spread: 24.1 %)Layer 2, head 1
Looks mostly at the word itself, and partly at the word before.
Strongest: the word itself, 39.6 % of its attention (even spread: 24.1 %)Layer 2, head 2
Spreads its attention over everything written so far.
Strongest: punctuation and sentence ends, 26.7 % of its attention (even spread: 26.1 %)Layer 2, head 3
Looks at the word just before.
Strongest: the word before, 42.0 % of its attention (even spread: 24.1 %)Layer 2, head 4
When the next word is the German for “it”, looks at the German noun it stands for, every time; otherwise often at the word before.
Strongest: from “it”, the noun it stands for, 100.0 % of its attention (even spread: 11.4 %)Encoder–decoder attention
Layer 1, head 1
Looks at the English word being translated, and at the English full stops and end.
Strongest: the English word being translated, 43.9 % of its attention (even spread: 12.9 %)Layer 1, head 2
Looks at the English word being translated.
Strongest: the English word being translated, 61.4 % of its attention (even spread: 12.9 %)Layer 1, head 3
Partly looks at the English word being translated; the rest is spread out.
Strongest: the English word being translated, 37.8 % of its attention (even spread: 12.9 %)Layer 1, head 4
Looks at the English word being translated and at the English punctuation.
Strongest: the English word being translated, 46.3 % of its attention (even spread: 12.9 %)Layer 2, head 1
Looks at the English word being translated; when writing “it” as ihn, sie or es, it looks at the English noun instead, which decides the gender.
Strongest: from “it”, the noun it stands for, 99.9 % of its attention (even spread: 9.3 %)Layer 2, head 2
Looks almost only at the English word being translated.
Strongest: the English word being translated, 99.4 % of its attention (even spread: 12.9 %)Layer 2, head 3
Looks at the English word being translated; for “it”, splits between “it” and its noun.
Strongest: the English word being translated, 75.1 % of its attention (even spread: 12.9 %)Layer 2, head 4
Looks at the English word being translated.
Strongest: the English word being translated, 84.4 % of its attention (even spread: 12.9 %)Encoder–decoder attention, layer 2, head 1
| Pattern | Share | Even | Tokens measured |
|---|---|---|---|
| from “it”, the noun it stands for | 99.9 % | 9.3 % | 29 |
| the English word being translated | 82.5 % | 12.9 % | 5,801 |
| punctuation and sentence ends | 28.2 % | 26.8 % | 5,801 |
Share: how much of the head's attention goes to the pattern's tokens, on average over the tokens it applies to. Even: what the same tokens would get if the head spread its attention evenly. A head is named by the pattern furthest above even, when it is at least 10 points above.
Paul has the bird . He draws it . · 100.0 % of its attention on the pattern
Lena has the small bird . She sees it . · 100.0 % of its attention on the pattern
Paul has a big dog . He likes it . · 100.0 % of its attention on the pattern
How far to trust the names
Each name comes from a few simple measurements: how much attention a head gives the word before, the word itself, the word after, the English word being translated, the noun that “it” stands for, and the punctuation. A head can do things none of these measures, and a head that spreads its attention may still matter. The paper's appendix shows the same kind of picture for its own model; ours is small enough to measure every head.
The clearest finding is the pronoun. In German, “it” becomes ihn, sie or es, depending on the gender of the noun it stands for, so the model must look back at that noun to write it. One encoder head, one decoder head and one encoder–decoder head do exactly that.