Move through the deck with (i) the arrow keys, (ii) a presentation clicker, or (iii) the buttons at the bottom left. The gear at the bottom right opens the slide settings.
Read each claim twice: first in plain words, then in the standard vocabulary on the smaller line beneath.
The model has one job: give every word it knows a share of being next.
| Candidate | Share |
|---|---|
| smelled | 0.31 |
| were | 0.24 |
| looked | 0.12 |
| every other word it knows | 0.33 |
Everything between the sentence and these shares is two moves, a lookup and a rewrite, repeated, and one final scoring.
Standard terms Next token prediction: a probability distribution over the vocabulary. Real models read tokens, which are pieces of words; the example sentence splits into whole words, so each token is a word. The probabilities in the table are illustrative.
The word before the blank is they, and they is only usable once the machine knows what it stands for. The word that settles it, rolls, sits six places earlier, and the word that settles what rolls means, bread, sits beside rolls.
Two machines, (i) an older one that reads in order and (ii) the one inside every current assistant, answer that question.
Standard terms The dependency between they and rolls is a long range dependency, the case that separates the two designs.
The older machine reads the way a line of people passes a whispered message: each person hears only their neighbor, adds their own word, and whispers onward.
By the time they is reached, everything known about rolls has survived six retellings.
Standard terms A recurrent neural network carries a hidden state from each position to the next, so information between two positions travels a path as long as the distance between them.
| Cost | In the line of whisperers | The standard account |
|---|---|---|
| Fading | What bread contributed reaches they only through retellings | Gradients travel the same path backward and fade the same way (Hochreiter and Schmidhuber, 1997); the path length is O(n), which grows in step with the distance |
| Waiting | Nobody can whisper until their neighbor has finished | The 2017 paper: the "inherently sequential nature precludes parallelization within training examples" |
| The bottleneck | Everything said so far shares one person's memory | Bahdanau, Cho, and Bengio (2014) identified one fixed length vector carrying a whole sentence as a bottleneck |
The first cost limits how far back the machine can usefully look, the second limits how fast it can be trained, and the third limits how much of the sentence survives the trip.
Standard terms Vanishing gradients over long paths, sequential training, and a fixed size hidden state. Attention removes all three at once.
The current machine reads with a directory. Every word publishes one line in it, a heading saying what it is and an entry saying what it can tell, and every word arrives with a description it wants to look up.
In a phone book you look up a name you already know. Here a word looks up a description, and every heading is a description, so the lookup is a matter of fit.
Standard terms The heading is the key, the entry is the value, and the description a word looks up is the query. The three names are the ordinary vocabulary of a lookup table: a query is brought to a table of keys, and values are taken away.
A phone book lookup returns one entry. This lookup returns every entry at once, each poured in according to how well its heading fits the description.
The weights always sum to one, so the result is an average of entries and never runs away.
Standard terms The fit between a query and a key is a dot product; a softmax maps the fits to positive weights that sum to 1; the output is the weighted sum of the value vectors. Part 9 computes one such row by hand.
Every word runs its own lookup in the same way, and distance never lengthens the path: they reaches rolls in one step, six words back or sixty.
Standard terms Each position issues its own query over every position it may read, so the maximum path between any two tokens is O(1), one step whatever the distance; Table 1 of the 2017 paper sets that against O(n) for recurrence. Reaching a distant token is a single step of the mechanism.
Because every lookup is independent of every other, nobody waits for a neighbor.
A room full of processors can each take some of the lookups, so a whole sentence is processed in one go. The waiting cost of the chain is gone, one of the changes that let the models grow.
Standard terms Attention over a sequence is two matrix products with a softmax between them, and the whole computation parallelizes across positions, removing the sequential training bottleneck.
Training covers a word and scores the model on producing it. One sentence of ten words carries nine covered blanks, and the parallel step scores all nine in a single pass.
That is only honest under one rule: a word may consult only itself and the words before it, because the word one place ahead is the answer to the blank this word must set up.
Standard terms The causal mask sets every forbidden fit to -\infty before the softmax, so the forbidden share comes out exactly zero. Part 9 shows the matrix.
One description finds one kind of thing, and a word usually needs several kinds at once, so each word runs several lookups side by side.
| What they looks up | Where the weight lands |
|---|---|
| the thing I stand for | rolls |
| one thing or many? | rolls, were |
| the topic of the sentence | bread, table |
Each lookup brings back its own blend, and the blends are laid side by side before the word moves on.
Standard terms Multi head attention: each head has its own W_Q, W_K, and W_V, and the head outputs are concatenated and passed through an output projection.
Nobody writes the descriptions: each word derives its descriptions, headings, and entries from its own numbers, through learned weights shared across positions, and what a head ends up looking for is decided by training.
After the lookup, each word works alone. It takes its own numbers and everything it just gathered, and rewrites its numbers, consulting nobody.
This private step is the classic hidden layer, which reads numbers in, passes weighted sums through an activation function, and writes numbers out.
Standard terms A position wise feedforward network, the hidden layer of Part 3, applied at every position with the same weights. Most of the model's parameters live here.
The lookup decides what a word reads. The rewrite decides what the word makes of what it read.
A block is the lookup followed by the rewrite. The model stacks dozens of blocks, and here is the move the whole design turns on: because every word rewrote its numbers, the next block prints a fresh directory, with new headings, new entries, and new descriptions to look up, all derived from the rewritten numbers.
So the second block asks better questions of a better informed directory, and the third improves on the second.
Standard terms Every block computes its queries, keys, and values from the previous block's output. Real blocks also carry residual connections and layer normalization, which keep training stable and leave the lookup and the rewrite unchanged.
Watch one line of the directory across one block. In block 1, rolls looks up "the word I am attached to", and the heading of bread fits best.
The ambiguity of rolls is resolved by its nearest neighbor, and the resolved reading is what the word now advertises.
Standard terms After block 1 the vector of rolls encodes the compound bread rolls, and block 2 computes its query, key, and value from that vector.
In block 2, they looks up "the plural thing I stand for", and the fit it finds exists only because block 1 reprinted the directory.
On the directory as first printed, the heading of rolls said a noun, or perhaps a verb, and such a heading fits the description of they no better than the heading of table does. Depth is lookups building on lookups.
Standard terms Layers compose. Tenney, Das, and Pavlick (2019) locate word level grammar in earlier layers and coreference in later layers of a deep language model, and block 1 resolved grammar while block 2 resolved reference, in the same order.
The word that must set up the blank is the last one written, they. Its numbers are rewritten at every block, and each rewrite carries more of the sentence.
| Read at | What the numbers of they say |
|---|---|
| block 1 | a pronoun, just after because |
| midway | stands for the rolls; the subject of a coming verb |
| top block | a past tense verb about food on a table is due next |
By the top block, the numbers of they have stopped describing a pronoun and started describing the word that should come next.
Standard terms During generation only the last position's final vector reaches the output layer; during training every position is scored, one prediction for each of the nine targets the causal mask keeps hidden. The table lines are illustrative.
Hand the numbers of they to the scorer at different heights of the stack, and the shares over the next word sharpen.
This is what the blocks are for. Every lookup and rewrite exists to move these shares toward the right word.
Standard terms The output projection maps the final vector to one logit per vocabulary word, and a softmax maps the logits to the distribution over the vocabulary. Training adjusts every block to sharpen it.
A language model is a directory of its words, consulted and reprinted dozens of times, with the last word, as finally rewritten, scored against every word it knows.
Standard terms Once token embeddings have entered the stack, each Transformer block, attention then feedforward, revises them, until an output projection and a softmax produce the next token distribution.
| The line of whisperers | The directory | |
|---|---|---|
| Reaching a word six back | six retellings | one lookup |
| Training on a sentence | one word after another | every position in one pass |
| Carrying the sentence | one shared memory | one line per word |
| Keeping the future hidden | reading order does it | the mask does it |
The fading and the waiting disappear, and reaching a distant word, the task the chain struggled with, is one lookup.
Standard terms Path length O(1) against O(n), parallel training against sequential, per token state against a single hidden state, and an explicit causal mask.
"The attention weights show what the model understands." The weights say where the numbers came from. Whether that amounts to an explanation is contested in print: Jain and Wallace argued against reading them so, and Wiegreffe and Pinter argued the tests themselves need a definition of explanation.
"Each lookup was designed to ask its question." Nobody assigns the questions. Training decides what every head looks for, and working out what a trained head does afterwards is a research field of its own.
1. The heading, which is the key. 2. Because word six is the answer to one of the covered blanks, and the mask keeps it covered. 3. Block 1 rewrote the line of rolls to say a plural food noun, and the description they looks up fits that reprinted heading.