Deep Learning
Follow the computations inside a network, then diagnose a training run.
Follow the computations inside a network, then diagnose a training run.
Before you start. Machine Learning and multivariable derivatives.
Use Python 3.12 for the examples. Install the dependencies with python -m pip install numpy torch. Run each week as a separate script. Try the worked example on paper first, then change one assumption in the lab and explain the result. All datasets are small or generated locally.
The 12 weeks
| Week | Lesson | What you’ll do |
|---|---|---|
| 1 | Tensors, shapes, and the forward pass | Trace a batch through two layers and catch a silent broadcast. |
| 2 | Backpropagation and autodiff | Derive one gradient, then check it with both autodiff and finite differences. |
| 3 | Losses and output layers | Match output shape and loss to the meaning of the target. |
| 4 | Initialization and gradient flow | Measure how repeated multiplication suppresses or amplifies gradients. |
| 5 | Minibatches, momentum, and Adam | Compare optimizers at the same update count and see why learning rate still matters. |
| 6 | Regularization and training diagnostics | Compare weight decay, dropout, and validation-based checkpoint selection. |
| 7 | Convolutions and residual connections | Calculate a receptive field and compare a stack with an identity path. |
| 8 | Recurrent sequence models | Learn a delayed copy task and relate the delay to repeated Jacobians. |
| 9 | Attention and transformers | Implement scaled attention and verify that future tokens stay invisible. |
| 10 | Transfer learning and fine-tuning | Compare a frozen encoder with partial and full adaptation. |
| 11 | Generative models and denoising | Learn the direction from a noisy input toward its training distribution. |
| 12 | Capstone · Diagnose a neural network with an ablation | Train a nonlinear model and reproduce a failed run with one change. |
Further reading · Goodfellow, Bengio, and Courville · Deep Learning