Phase 4 of 7 · 14 topics

Transformers and LLMs

Build a small GPT from scratch: tokenizer, attention, training and fine-tuning. This is how modern AI works inside.

An LLM is a deep neural network with one special layer (attention), trained to guess the next token on a huge amount of text. Everything else is detail, but important detail.

0 of 14 done

Core resources for this phase

Topics, in order

  1. 4.1 Tokenisation and byte-pair encoding (BPE)

  2. 4.2 Token embeddings and positional encoding

  3. 4.3 Self-attention: queries, keys and values

  4. 4.4 Multi-head attention and the transformer block

  5. 4.5 GPT-style models and next-token prediction

  6. 4.6 Encoder models (BERT) vs decoder models (GPT)

  7. 4.7 Vision transformers and CLIP

  8. 4.8 Sampling: greedy, temperature, top-k, top-p

  9. 4.9 KV cache and the cost of generation

  10. 4.10 Pretraining data and scaling laws

  11. 4.11 Mixture of experts

  12. 4.12 Fine-tuning and LoRA

  13. 4.13 Instruction tuning and preference tuning (RLHF, DPO)

  14. 4.14 Reasoning models and test-time compute

Go deeper (optional)