The book
Every chapter, from the math toolkit to frontier models.
Foundations
Representations
- 1Embeddings, Turning Things into VectorsHow a computer learns that cat is closer to kitten than to carburetor.
- 2Tokenization, What Models Actually ReadWhy chat models miscount the r's in strawberry, and how GPT and Llama really read text.
- 3From Static to Contextual MeaningHow predicting the next word taught machines to read in context, up to the arrival of attention.
The Transformer
- 4Attention from First PrinciplesThe one operation every frontier model is built on, derived from a soft lookup.
- 5The Transformer BlockResiduals, normalization, feed-forward layers, and positions, assembled and counted.
- 6Build a GPT from ScratchEvery earlier chapter, assembled into a working language model you train yourself.
- 7Encoders, Embedding Models, and RetrievalHow encoders become search engines, and search becomes the memory of language models.
Pretraining at scale
- 8Pretraining RecipesWhat frontier models learn to predict, from which data, and how training stays stable.
- 9Scaling LawsHow loss falls with parameters, data, and compute, and how to spend a training budget.
- 10Distributed TrainingHow a model too big for any GPU trains on thousands of them, every byte counted.
- 11GPU Programming for MLHow the chip works, and how to write kernels that keep it busy.
- 12FlashAttention and Efficient AttentionFlashAttention, smaller KV caches, and the road to million-token contexts.
- 13Mixture of ExpertsHow models hold hundreds of billions of parameters but use a few billion per token.
Post-training
- 14Post-training and Supervised Fine-tuningHow a model that completes documents becomes an assistant that answers you.
- 15Reinforcement Learning Foundations for LLMsThe reinforcement learning behind RLHF, DPO, and GRPO, built from scratch.
- 16Reinforcement Learning from Human FeedbackHow a model learns what people prefer when nobody can write the reward down.
- 17Direct Preference OptimizationHow RLHF collapses into a classification loss, and what that costs.
- 18Reasoning Models and RL with Verifiable RewardsWhy thinking out loud makes models smarter, and how RL turned that into reasoning models.
- 19Alignment and SafetySpecifying what we want, attacking and evaluating models, and keeping them truthful.
Inference and beyond attention
- 20Fast, Cheap InferenceQuantization, speculative decoding, and serving that make answers fast and cheap.
- 21State-Space and Linear-Time ModelsRecurrence returns, with Mamba and linear-time models that rival attention.
Evaluation and interpretability
- 22EvaluationHow to measure a model honestly, from benchmarks and judges to your own evals.
- 23InterpretabilityProbes, circuits, and sparse autoencoders for reading what a model computes.
Agents
- 24Tool Use and AgentsHow a language model becomes an agent that calls tools, plans, and acts.
- 25Memory and Long-Running AgentsContext, long-term memory, and agents that keep working for hours or days.
- 26Self-Improvement LoopsSelf-play, self-rewarding, and models that improve their own training data.
Vision
- 27Images as Tokens, Vision TransformersHow images become sequences of patches, and why Transformers now see.
- 28Self-supervised VisionHow vision models learn from images with no labels at all.
- 29Video RepresentationsHow video becomes tokens, and how models learn from motion and time.
- 30Joint Text-Image EmbeddingsOne space for images and text, and what it can and cannot do.
- 31Vision-Language ModelsHow a vision encoder is wired into a language model that sees.
Generative models
- 32Autoencoders, VAEs, and Discrete LatentsAutoencoders, VAEs, and the discrete codes that image generators build on.
- 33Diffusion and Flow MatchingHow models create by learning to remove noise, from DDPM to flow matching.
- 34Image and Video Generation at ScaleHow text becomes images and video at scale, and how to judge the results.
Audio and speech
- 35How Sound Becomes VectorsHow sound waves become spectrograms, and spectrograms become vectors.
- 36Speech to TextHow speech becomes text, from CTC to Whisper and streaming recognition.
- 37Text to Speech, Audio Tokens, and Voice ModelsHow models speak, from vocoders and audio tokens to full-duplex voice.
JEPA and world models
- 38JEPA, Predicting in Latent SpaceLearning by predicting in latent space instead of pixels.
- 39World ModelsModels that learn how the world moves, and plan with what they learned.
The interview
- Needs a plan40Classical ML that Interviews Still AskThe regression, trees, kernels, and statistics that interviews still ask about.
- Needs a plan41ML System DesignA framework and worked designs for recommendation, search, ads, and fraud.
- Needs a plan42LLM and GenAI System DesignWorked designs for RAG, serving, post-training, evaluation, and agents.
- Needs a plan43The Interview PlaybookHow AI lab interview loops work, round by round, with mock sets.