Stage 1 With one query, get the lower of the two as high as it will go (it goes up to 0.250)
Stage 2 Switch to two queries and get both coffee and newspaper above one half
with a single attention head, averaging inhibits thisThe word Fig. 4 is about is 'its'. Head 5 is looking at 'Law' and head 6 at 'application' — two heads dividing the work.
Isolated attentions from just the word 'its'
① Attention is the only new part. ②③④ are pieces you handled in Chapters 1 and 2.
Attention does not see the order of the words. So a mark for the order is added
at the entrance (positional encoding).
Without it, “the hand hits the coffee” and “the coffee hits the hand”
stop being distinguishable.
The old way (RNN) went through the words one at a time.
Which is why the title is “Attention Is All You Need”
= you do not need the RNN.
| What you often hear | In the original paper |
|---|---|
| the “it → animal” picture | Not there. "animal" gets 0 hits in a full-text search |
| “head 1 does dependencies, head 3 does tense” | Not written. No head is given a task name |
| “the more heads the stronger” | It goes the other way too. One head is 0.9 below the best, but 32 heads (25.4) score lower than 8 (25.8) |
| “the dot product is the best way to measure” | The paper leaves it open (the discussion of row B in Table 3) |
individual attention heads clearly learn to perform different tasks(end of §4 / Table 3 row A).
| Item | Source |
|---|---|
| α = softmax(q·k / âd_k), z = Σ α v, q = W_q x and the rest | |
| why ÷âd_k (the variance of the dot product is d_k) | same paper, §3.2.1 footnote 4 |
| the dot product is not claimed to be optimal | same paper, Table 3 row B |
| with a single head, averaging inhibits this | same paper, §3.2.2 |
| one head is 0.9 lower / 32 heads score lower than 8 | same paper, Table 3 row A and others |
| Fig. 4 is about the word 'its' (looking at Law and application) | same paper, Figure 4 |
| the block equation and positional encoding | same paper, §3.1 / §3.5, Table 3 row E |
| RNNs went through the words one at a time | same paper, §1 / Table 1 |
| why it works as well as it does is not known |
The words, the scores, the directions of the tags and the contents are all numbers this problem placed. They are not measurements. This is not “what an LLM puts out”. The list: the six words and scores in Problem 12 (Pacific 3.0 and so on), the directions of the tags (coffee 0° / desk 90° / newspaper 180° / hand 270°), the contents (coffee→spilled 3.0 / newspaper→tore 3.0), and the targets (above one half = 0.500, and the 8.0 times and 2.5 sentences in Problem 12).
Put three words into the same formula (cat 0° / sat 90° / it 60°) with the query at 0° and you get 0.456 / 0.225 / 0.320, matching the worked example in our reference notes, Part 1 §6 (0.46 / 0.22 / 0.32).
The real thing uses d_k = 64 in 8 sets, with tens of thousands of words. Here it is 2 dimensions, 4 words and at most 2 sets, and the tags are placed by hand rather than learned as W.