octlm
A language model taken apart and rebuilt from scratch, one hand-drawn field guide per unit. Unit I builds the classic Transformer decoder and unit II upgrades it into the Llama 3 block. Units III to VI train it, serve it, teach it to use tools, and test changes to its design.
- unit I · chapter 1 · 13 partsInside Attention
How a decoder-only Transformer turns raw text into a guess for the next token: tokenization, embeddings, positions, attention, masking, heads, the KV cache, the decoder block and training, explained from zero with hand-drawn diagrams.
- unit II · chapter 2 · 7 partsThe Modern Block
Every upgrade between the 2019 GPT-2 block and the 2024 Llama 3 block, one at a time: RoPE in practice, RMSNorm, SwiGLU, grouped-query attention, SDPA and FlashAttention, then the finished block, counted and coded.
- unit III · chapter 3 · 10 partsTraining the Model
From feature mixing to a trained language model: all 33 syllabus topics, with Finch-24 calculations, hand-drawn diagrams, optimizer mechanics, numerical precision, reproducible evaluation and generation.
- unit IV · chapter 4 · 10 partsInference Engineering
From a trained checkpoint to a chat reply you can trust: prefill and decode, the KV cache in practice, attention kernels, quantization, reading and loading a real Qwen3 checkpoint, proving parity with the reference, production tokenizers, chat templates and the full inference pipeline.
- unit V · chapter 5 · 12 partsTeaching a Model to Act
A complete tool-use system, tested before and after training: schemas, execution, state, evaluation, LoRA, supervised fine-tuning, synthetic traces, merging and quantization.
- unit VI · chapter 6 · 8 partsChanging the Decoder
Multi-token prediction, sparse and compressed attention, latent KV memory, speculative decoding, and the experiments needed to tell an improvement from noise.