A free course you do, not just read

Machine learning, from one gradient to the Jacobian lens

Twelve modules. In each one you train or break something live in your browser, then write a few lines of Python that are checked on the spot. The course starts with the derivative of a single number and ends with reading concepts out of the middle layers of a transformer.

How each module works

  1. Why it matters, in two or three sentences.
  2. The idea, with the maths written out.
  3. A live demo you can drag, slide and retrain, with “try this” prompts that each change one thing.
  4. A graded exercise in Python. Hidden tests run in your browser; a hint and a reference solution are one click away.
  5. Three questions to check yourself, and a pointer to where the idea goes next.

Every demo on the site runs on one small automatic-differentiation library that you learn to build in module 0. When the course reaches transformers and their Jacobians, they are computed by the same code.

Course map

Modules 0–9 are live. Modules 10 and 11 are being built and will open here as each one passes its tests. A tick appears next to a module once you pass its exercise; that record stays in your browser.

  1. Gradients and a tiny autograd

    You build: A 60-line reverse-mode autodiff engine (the Value class). Live demo: A computation graph that lights up as gradients flow back. Exercise: Implement the backward step for tanh and *, checked against finite differences.

  2. Linear and logistic regression

    You build: Gradient descent on squared loss and on cross-entropy loss. Live demo: Drag the data points and watch the fitted line and the loss surface move. Exercise: Write the gradient of the logistic loss; it must match autograd to 10⁻⁶.

  3. Neural networks

    You build: A multi-layer perceptron, assembled from neurons and layers. Live demo: A two-moons playground: change width, depth and activation. Exercise: Fit XOR with the fewest hidden units that reach 100%.

  4. Backpropagation

    You build: Backpropagation in matrix form for a whole network. Live demo: Step through the forward values, then each layer’s gradient. Exercise: Vectorised backprop that passes a gradient check on random networks.

  5. Optimisation and generalisation

    You build: SGD, momentum and Adam; L2, dropout and early stopping. Live demo: A race of optimisers on a Rosenbrock-style surface; train and test curves. Exercise: Implement Adam; reproduce an overfitting curve, then fix it.

  6. Support vector machines and kernels

    You build: Hinge loss, the maximum margin and the kernel trick. Live demo: The margin and support vectors update as you drag points; an RBF width slider. Exercise: A kernel SVM by subgradient descent on a ring dataset.

  7. Convolutions

    You build: Convolution and pooling layers by hand. Live demo: Edge filters on small images; a tiny CNN on 8×8 digits. Exercise: Write conv2d and its gradient.

  8. RNNs and LSTMs

    You build: A vanilla RNN, then the LSTM gates. Live demo: Vanishing gradients against sequence length; gate activations on a toy sequence. Exercise: The LSTM cell’s forward pass; learn to remember one bit across 30 steps.

  9. Autoencoders

    You build: An autoencoder, then a variational autoencoder. Live demo: A 2-D latent space of digits: click anywhere to decode. Exercise: The reparameterisation trick and the ELBO.

  10. Attention and transformers

    You build: Scaled dot-product attention, multiple heads and a 2-layer transformer. Live demo: Attention heatmaps; train a tiny transformer in the browser. Exercise: Causal masking and one attention head from scratch.

  11. Interpretability foundations coming soon

    You build: Linear probes, the logit lens, activation patching and sparse autoencoders. Live demo: The logit lens across the layers of the tiny transformer; patch a head and watch the answer change. Exercise: Train a probe; find the head that patching breaks.

  12. The Jacobian lens coming soon

    You build: Averaged Jacobians and the J-lens readout. Live demo: The logit lens and the J-lens side by side at every layer. Exercise: Compute the averaged Jacobian by autodiff and see where it beats the logit lens.