Skip to content

Tokenizer to trained transformer, with code you run

Build an LLM from Scratch

Write a BPE tokenizer, attention, a GPT block, a training loop and a sampler in plain Python first, then see how the same ideas map to PyTorch and to modern upgrades like RoPE, RMSNorm, SwiGLU and grouped-query attention.

4 tracks · 10 lessons · about 4 hours · 1 free lessons · 0 animated diagrams

What you will be able to do

  • ✓Implement tokenisation, attention and a transformer block yourself
  • ✓Train a tiny language model and read its loss curve
  • ✓Generate text with temperature, top-k and top-p, and a KV cache
  • ✓Map your code to production architectures and fine-tuning methods

Who it is for

Developers who want to understand exactly what happens inside a language model.

Prerequisites

Python. High-school calculus helps; the course teaches the rest.

Curriculum