The book

Every chapter, from the math toolkit to frontier models.

Foundations

  1. 0The Toolkit, Math and Code for Modern AITensors, gradients, probability, and optimizers, the tools every later chapter leans on.11 sections · 58 exercises

Representations

  1. 1Embeddings, Turning Things into VectorsHow a computer learns that cat is closer to kitten than to carburetor.10 sections · 48 exercises
  2. 2Tokenization, What Models Actually ReadWhy chat models miscount the r's in strawberry, and how GPT and Llama really read text.7 sections · 31 exercises
  3. 3From Static to Contextual MeaningHow predicting the next word taught machines to read in context, up to the arrival of attention.6 sections · 23 exercises

The Transformer

  1. 4Attention from First PrinciplesThe one operation every frontier model is built on, derived from a soft lookup.7 sections · 23 exercises
  2. 5The Transformer BlockResiduals, normalization, feed-forward layers, and positions, assembled and counted.7 sections · 31 exercises
  3. 6Build a GPT from ScratchEvery earlier chapter, assembled into a working language model you train yourself.8 sections · 29 exercises
  4. 7Encoders, Embedding Models, and RetrievalHow encoders become search engines, and search becomes the memory of language models.7 sections · 32 exercises

Pretraining at scale

  1. 8Pretraining RecipesWhat frontier models learn to predict, from which data, and how training stays stable.9 sections · 41 exercises
  2. 9Scaling LawsHow loss falls with parameters, data, and compute, and how to spend a training budget.6 sections · 24 exercises
  3. 10Distributed TrainingHow a model too big for any GPU trains on thousands of them, every byte counted.7 sections · 25 exercises
  4. 11GPU Programming for MLHow the chip works, and how to write kernels that keep it busy.7 sections · 25 exercises
  5. 12FlashAttention and Efficient AttentionFlashAttention, smaller KV caches, and the road to million-token contexts.7 sections · 31 exercises
  6. 13Mixture of ExpertsHow models hold hundreds of billions of parameters but use a few billion per token.6 sections · 25 exercises

Post-training

  1. 14Post-training and Supervised Fine-tuningHow a model that completes documents becomes an assistant that answers you.7 sections · 26 exercises
  2. 15Reinforcement Learning Foundations for LLMsThe reinforcement learning behind RLHF, DPO, and GRPO, built from scratch.7 sections · 25 exercises
  3. 16Reinforcement Learning from Human FeedbackHow a model learns what people prefer when nobody can write the reward down.6 sections · 24 exercises
  4. 17Direct Preference OptimizationHow RLHF collapses into a classification loss, and what that costs.5 sections · 20 exercises
  5. 18Reasoning Models and RL with Verifiable RewardsWhy thinking out loud makes models smarter, and how RL turned that into reasoning models.7 sections · 26 exercises
  6. 19Alignment and SafetySpecifying what we want, attacking and evaluating models, and keeping them truthful.8 sections · 30 exercises

Inference and beyond attention

  1. 20Fast, Cheap InferenceQuantization, speculative decoding, and serving that make answers fast and cheap.
  2. 21State-Space and Linear-Time ModelsRecurrence returns, with Mamba and linear-time models that rival attention.

Evaluation and interpretability

  1. 22EvaluationHow to measure a model honestly, from benchmarks and judges to your own evals.
  2. 23InterpretabilityProbes, circuits, and sparse autoencoders for reading what a model computes.

Agents

  1. 24Tool Use and AgentsHow a language model becomes an agent that calls tools, plans, and acts.
  2. 25Memory and Long-Running AgentsContext, long-term memory, and agents that keep working for hours or days.
  3. 26Self-Improvement LoopsSelf-play, self-rewarding, and models that improve their own training data.

Vision

  1. 27Images as Tokens, Vision TransformersHow images become sequences of patches, and why Transformers now see.
  2. 28Self-supervised VisionHow vision models learn from images with no labels at all.
  3. 29Video RepresentationsHow video becomes tokens, and how models learn from motion and time.
  4. 30Joint Text-Image EmbeddingsOne space for images and text, and what it can and cannot do.
  5. 31Vision-Language ModelsHow a vision encoder is wired into a language model that sees.

Generative models

  1. 32Autoencoders, VAEs, and Discrete LatentsAutoencoders, VAEs, and the discrete codes that image generators build on.
  2. 33Diffusion and Flow MatchingHow models create by learning to remove noise, from DDPM to flow matching.
  3. 34Image and Video Generation at ScaleHow text becomes images and video at scale, and how to judge the results.

Audio and speech

  1. 35How Sound Becomes VectorsHow sound waves become spectrograms, and spectrograms become vectors.
  2. 36Speech to TextHow speech becomes text, from CTC to Whisper and streaming recognition.
  3. 37Text to Speech, Audio Tokens, and Voice ModelsHow models speak, from vocoders and audio tokens to full-duplex voice.

JEPA and world models

  1. 38JEPA, Predicting in Latent SpaceLearning by predicting in latent space instead of pixels.
  2. 39World ModelsModels that learn how the world moves, and plan with what they learned.

The interview

  1. Needs a plan40Classical ML that Interviews Still AskThe regression, trees, kernels, and statistics that interviews still ask about.
  2. Needs a plan41ML System DesignA framework and worked designs for recommendation, search, ads, and fraud.
  3. Needs a plan42LLM and GenAI System DesignWorked designs for RAG, serving, post-training, evaluation, and agents.
  4. Needs a plan43The Interview PlaybookHow AI lab interview loops work, round by round, with mock sets.