Skip to content
Series
22 posts

Reading Stanford CS229

A chapter-by-chapter reading of Stanford CS229’s official 2026 notes, spanning supervised and deep learning, foundation models, LLM reasoning, and reinforcement learning across twenty-one chapters without pretending to reconstruct a single quarter’s lecture schedule.

Stanford CS229: Notes Rewritten Every Year, Public Problem Sets Frozen at 2020, and an Official Self-Test From 2008

The three things you need to self-study CS229 run on three different clocks. The lecture notes are 278 pages and were recompiled in August 2026. The newest problem sets you can download are from summer 2020. The self-assessment Stanford Online tells you to attempt before enrolling is a PDF created in 2008. Seventeen lectures from spring 2026 are public, and the last three are mislabeled.

Linear Regression: From LMS to Locally Weighted Regression

Linear regression is more than a best-fit line: Chapter 1 connects squared loss to gradient descent, normal equations, maximum likelihood, and locally weighted regression.

Classification and Logistic Regression: Decision Boundaries and Newton's Method

Chapter 2 derives logistic loss from a sigmoid probability model, then contrasts it with the perceptron and extends it through softmax and Newton's method.

Generalized Linear Models: Unifying Regression and Classification

Chapter 3 uses exponential families, natural parameters, and link functions to place least squares and logistic regression inside one modeling template.

Generative Learning Algorithms: GDA, Naive Bayes, and Smoothing

Chapter 4 models p(x|y) and p(y), using GDA, Naive Bayes, and Laplace smoothing to expose both the power and price of generative classification.

Kernel Methods: Nonlinear Learning Without Explicit Features

Chapter 5 replaces high-dimensional feature inner products with kernels, letting inner-product-based linear algorithms learn nonlinear functions without constructing the features.

Support Vector Machines: Margins, Duality, and SMO

Chapter 6 formalizes classification confidence as geometric margin, then builds an implementable SVM through Lagrange duality, kernels, and SMO.

Deep Learning: Modules, Backpropagation, and Vectorization

Chapter 7 decomposes neural networks into composable modules and uses backpropagation and vectorization to explain how deep models can be trained efficiently.

Generalization: Bias–Variance, Double Descent, and Sample Complexity

Chapter 8 decomposes test MSE into irreducible noise, squared bias, and variance, then uses uniform convergence and VC dimension to explain when training performance transfers to new data. Double descent shows why parameter count is not a universal measure of complexity.

Regularization and Model Selection: Explicit, Implicit, and Cross-Validated

Chapter 9 presents three controls on generalization: explicit complexity penalties, optimizer-induced implicit regularization, and model selection on data excluded from training. MAP estimation then connects a Gaussian prior to an L2 penalty.

Clustering and k-Means: A First Alternating-Optimization Algorithm

Chapter 10 introduces unsupervised learning through k-means: alternating updates make distortion non-increasing and numerically convergent, but do not guarantee a global optimum.

EM Algorithms: From Gaussian Mixtures to VAEs

Chapter 11 starts from soft assignments in Gaussian mixtures, uses Jensen's inequality to construct the ELBO, interprets EM as alternating maximization over a variational distribution and model parameters, and extends the idea to VAEs through approximate posteriors and reparameterization.

Principal Components Analysis: Projection, Reconstruction, and Reduction

Chapter 12 formulates PCA as geometric optimization: maximize projected variance along a unit direction to obtain the leading eigenvector of the covariance matrix. The top k eigenvectors give both maximum retained variance and minimum linear reconstruction error.

Independent Components Analysis: Recovering Independent Sources

Chapter 13 models ICA as x=As: observations are unknown linear mixtures, and the goal is to estimate W=A^{-1} to recover independent, non-Gaussian sources. A Jacobian determinant enters the transformed density and leads to the Bell–Sejnowski likelihood update.

Diffusion Models: Forward Noise, Reverse Generation, and the ELBO

Chapter 14 starts with a fixed Gaussian noising Markov chain and learns to reverse each transition. The ELBO turns reverse-kernel matching into weighted noise prediction, while the continuous-time view explains reverse drift through the score ∇log p_t.

Foundation Models Overview: Linear Probes, Fine-Tuning, and LoRA

Chapter 15 compares linear probing, full fine-tuning, and LoRA—not only by trainable parameter count, but by representation movement, data needs, and memory cost.

Representation Learning: Contrastive Learning, Retrieval, and RAG

Chapter 16 connects representation learning to systems: contrastive objectives shape an embedding space, semantic retrieval finds neighbors in it, and RAG passes retrieved context to a generator.

Large Language Models: Tokenization, Transformers, MoE, and SFT

Chapter 17 runs from next-token loss through Transformers, KV caches, MoE, and SFT, connecting an LLM's objective and architecture to its inference costs.

Reasoning in LLMs: Chain of Thought and Long-Reasoning RLVR

Chapter 18 separates two levers for LLM reasoning: chain of thought adds test-time computation, while verifiable rewards and policy gradients train long-reasoning behavior.

Reinforcement Learning: MDPs, Value Iteration, and Continuous States

Chapter 19 uses Bellman equations to turn long-horizon decisions into one-step updates, moving from value iteration in known MDPs to model learning and continuous-state approximation.

LQR, DDP, and LQG: From Linear Control to Uncertainty

Chapter 20 exploits linear dynamics and quadratic objectives to solve LQR, then uses DDP for local nonlinearity and Kalman filtering with LQG for partially observed state.

Policy Gradient and Its Variants: REINFORCE and PPO

Chapter 21 derives REINFORCE with the log-derivative trick, then uses reward-to-go, baselines, and PPO clipping to control policy-gradient variance and update size.