Part 12 / Topic 5 of 6
The transformer
The transformer is attention made into a repeatable block:
- Multi-head attention — several attentions in parallel, each with its own Q/K/V projections, so different heads track different relations (syntax here, coreference there).
- Position information — attention itself is order-blind; positional encodings (or rotary variants) tell the model where each token sits.
- Feed-forward layer — per-token MLP after the mixing.
- Residual connections + LayerNorm — around every sublayer, keeping gradients healthy through dozens of blocks (Part 11's normalization at work).
Stack the block N times and that is the architecture behind every modern LLM. Nothing in it is new to you now: matrix multiplies, softmax, LayerNorm, residuals.
🧪 Quick quiz
- What is the transformer's key building block, and how does it differ from recurrence?
Show the answer
Self-attention — every token looks at every other token in parallel, instead of a state crawling along the sequence one token at a time.
Done here? The practice set for Part 12 — 4 exercises with solutions — is on the part page.