Exercise Solutions
Worked solutions for the most concrete exercises across the path. Not every exercise — many are open-ended (“ship something public”) and don’t have a single answer. The ones here are code-shaped: the kind where seeing a working version teaches more than reading the question.
How to use: try the exercise yourself first. Then check here. Don’t look first.
If a solution disagrees with your working answer, run both and see which actually works. Solutions are sometimes wrong; tests aren’t.
Index
- Stage 01 — Math foundations — gradient descent, softmax, KL divergence, entropy
- Stage 02 — ML fundamentals — confusion matrix, AUC by hand, calibration plot, bootstrap CI
- Stage 03 — Neural networks — manual backprop, MNIST MLP, gradient norm debugging
- Stage 06 — Transformers — attention from scratch, causal masking
- Stage 09 — RAG — minimal RAG, golden eval set
- Stage 11 — Agents — agent loop in <100 lines
- Cross-stage projects — full worked projects spanning multiple stages
Each file has runnable code blocks. Code is tested for clarity; copy-paste should work in a fresh Python environment with the listed dependencies.