Paths, 17 steps in four parts after an overview
Attention paper
In 2017 Vaswani and colleagues at Google replaced the recurrent networks of machine translation with a model built from attention alone, the Transformer, and nearly every large model since descends from it. This path builds the paper from its pieces: what came before, each part of the model, how it was trained, and what it achieved.
none read yet
Before 2017 a translation model read a sentence one word at a time, each step waiting for the one before. The Transformer lets every position read every other position at once, through attention, so a whole sentence is processed in parallel. The path starts with the paper in brief, then the networks it replaced, then each of its pieces in turn, how it was trained, and at the end the whole model with its results.
The steps
The paper in brief
Step 1
Part 1 Before the Transformer
Steps 2 to 3
-
Recurrent networks
The networks that read a sequence one step at a time, which the paper set out to replace.
-
Encoder-decoder networks
One network reads the input and another writes the output: the shape of every translation model, the Transformer included, and why recurrence was its bottleneck.
Part 2 The pieces
Steps 4 to 11
-
Tokens and embeddings
How words become vectors; the paper shares one embedding matrix between the input, the output and the final layer.
Crossing: also step 2 of DNA-Socket
Crossing: also step 1 of Inside a language model
-
Softmax
Turns scores into weights inside attention, and into the probabilities of the next word at the output.
Crossing: also step 3 of DNA-Socket
Crossing: also step 2 of Inside a language model
-
Attention
The paper’s scaled dot-product attention: queries, keys and values, and why the scores are divided by the square root of their width.
Crossing: also step 4 of DNA-Socket
Crossing: also step 3 of Inside a language model
-
Multi-head attention
Eight attention heads side by side, each reading the sequence in its own way.
-
Position encoding
Attention alone does not know word order; the paper adds sine and cosine waves to say where each word stands.
-
Residual connections
Each layer adds its result to what it received, so a deep stack still trains.
-
Normalisation layers
Layer normalisation keeps the numbers in range; the paper applies it after each residual addition.
Part 3 Training
Steps 12 to 16
-
Byte-pair encoding
How the training sentences were cut into a shared vocabulary of about 37,000 tokens.
-
Cross-entropy
The loss the model was trained to lower: how surprised it is by the right next word.
Crossing: also step 11 of AMAP-APP
-
Optimisers
Adam, with a learning rate that rises for the first 4,000 steps and then falls.
-
Regularisation
Dropout, as the paper used it, against learning the training sentences by heart.
-
Label smoothing
Training towards slightly softened targets: worse perplexity, better translations.
Part 4 The model
Step 17
-
Transformers
The pieces put together: the base and big models, their translation results, the paper’s ablations, and what came after.
Crossing: also step 5 of DNA-Socket
Crossing: also step 5 of Weight-space programming
Crossing: also step 4 of Inside a language model
At the end of the path
At the end of the path you can draw the Transformer from memory and explain each of its parts: why attention replaced recurrence, what the heads, the position waves, the residual additions and the normalisation do, how the model was trained, and what its results showed.
Now see the researchAttention Is All You Need (Vaswani et al., 2017)
What you mark as read is kept in this browser only, never sent.