Skip to the content

fatehi.devx2Learning

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

StartMap

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

  1. Recurrent networks

    Deep learning

    The networks that read a sequence one step at a time, which the paper set out to replace.

  2. Encoder-decoder networks

    Deep learning

    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.

  3. Tokens and embeddings

    Deep learning

    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

  4. Softmax

    Deep learning

    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

  5. Attention

    Deep learning

    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

  6. Multi-head attention

    Deep learning

    Eight attention heads side by side, each reading the sequence in its own way.

  7. Position encoding

    Deep learning

    Attention alone does not know word order; the paper adds sine and cosine waves to say where each word stands.

  8. Residual connections

    Deep learning

    Each layer adds its result to what it received, so a deep stack still trains.

  9. Normalisation layers

    Deep learning

    Layer normalisation keeps the numbers in range; the paper applies it after each residual addition.

  10. Cross-attention

    Deep learning

    How the decoder reads the encoder’s output while it writes.

  11. Byte-pair encoding

    Deep learning

    How the training sentences were cut into a shared vocabulary of about 37,000 tokens.

  12. Cross-entropy

    Deep learning

    The loss the model was trained to lower: how surprised it is by the right next word.

    Crossing: also step 11 of AMAP-APP

  13. Optimisers

    Deep learning

    Adam, with a learning rate that rises for the first 4,000 steps and then falls.

  14. Regularisation

    Deep learning

    Dropout, as the paper used it, against learning the training sentences by heart.

  15. Label smoothing

    Deep learning

    Training towards slightly softened targets: worse perplexity, better translations.

  16. Transformers

    Deep learning

    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.