The paper's Figure 1, live
This is the transformer as the paper draws it: the encoder reads the English on the left, the decoder writes the German on the right, both from the bottom up. Click any box to see what it computes for your sentence, or press Play to watch a whole translation pass through it.
The model's German: Anna hat einen kleinen Hund . Sie mag ihn .
Playback speed
Multi-Head Attention
In the encoder, paper section 3.2.2
Every English token looks at every other one through four heads at once, mixes in what it finds, and the heads' results are joined and projected back to 64 numbers.
| Token | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | … 56 more |
|---|---|---|---|---|---|---|---|---|---|
| Anna | −0.29 | 0.61 | −0.56 | −0.10 | −0.09 | −0.46 | 0.35 | −0.12 | … |
| has | −0.11 | 0.32 | −0.35 | −0.06 | −0.04 | −0.30 | 0.28 | −0.07 | … |
| a | −0.56 | 0.39 | −0.43 | −0.37 | 0.05 | −0.55 | 0.81 | −0.33 | … |
| small | −0.78 | 0.09 | −0.46 | −0.54 | −0.17 | −0.69 | 0.62 | −0.44 | … |
| dog | −0.32 | 0.41 | −0.49 | −0.16 | 0.13 | −0.47 | 0.25 | −0.10 | … |
| . | −0.45 | −0.29 | −0.32 | −0.35 | −0.54 | −0.11 | 0.23 | −0.20 | … |
| She | −0.14 | 0.51 | −0.43 | −0.03 | −0.01 | −0.29 | 0.25 | −0.10 | … |
| likes | −0.23 | 0.35 | −0.44 | −0.08 | −0.15 | −0.38 | 0.32 | −0.12 | … |
| it | −0.58 | 0.17 | −0.13 | −0.39 | 0.06 | −0.35 | 0.49 | −0.28 | … |
| . | −0.80 | −0.64 | 0.17 | −0.52 | −0.48 | 0.10 | 0.01 | −0.36 | … |
| </s> | −0.85 | 0.08 | −0.63 | −0.69 | −0.41 | −0.84 | 0.83 | −0.47 | … |