teacher
Sign in

The Transformer Architecture

How attention, a small neural network, residual connections and normalisation stack into the block that every modern LLM repeats dozens of times.

35 min4 interactive

The big picture

A transformer is a neural network built from one repeated unit, the block. Stack 12, 32 or 96 identical-shaped blocks and you have most of today's language models.

The path of a piece of text:

  1. Split into tokens (pieces of text; see the tokenization lesson) and look up each token's vector in an embedding table.
  2. Add information about each token's position.
  3. Pass the vectors through LL blocks.
  4. Turn the last vectors into scores over the vocabulary, one score per possible next token.
1 of 7