ml.lab
Python sleeps until you run code

Part 1 of the ML Lab suite

From matricesto memory.

Rebuild the math, then build the machine. Linear algebra, calculus and neural networks, up to an LSTM you design and train yourself.

10 modules · 32 lessons · about 19 hours · Python runs in your browser · no signup

Work it on paper

Short derivations and hand calculations, with each step of the worked solution revealed one at a time.

Check your answer

Type a number, vector or matrix and find out right away. Unlimited practice sets generate fresh problems.

Write the code

Real Python and numpy, running in this tab. You implement each piece; tests tell you exactly what is off.

Prove it

Each module ends in a checkpoint. Pass it before moving on, or come back to the parts that slipped.

Part 1. From matrices to memory

Course overview
  1. 00The mapWhere the field is, and how this lab works40 min
  2. 01Vectors and the dot productLists of numbers that are also arrows85 min
  3. 02Matrices are machinesA matrix is a function you can write down95 min
  4. 03Determinants, inverses and rankWhat a transformation does to space65 min
  5. 04Eigenvectors and eigenvaluesThe directions a matrix does not turn105 min
  6. 05Derivatives, gradients and JacobiansHow outputs move when inputs move135 min
  7. 06Neural networks from scratchLayers, losses and backpropagation, by hand155 min
  8. 07Recurrent networksA network with a memory, unrolled through time115 min
  9. 08LSTMsMemory with gates225 min
  10. 09From LSTMs to today's modelsAttention, pretraining, post-training and vision120 min

The whole suite

Roadmap
Part 1

From matrices to memory

The math refresher and the first real models: vectors, matrices, eigenvalues, Jacobians, backpropagation, recurrent networks and LSTMs trained in your browser.

Available now
Part 2

Attention and transformers

Build a small GPT: tokenization, embeddings and positions, self-attention, the transformer block, training, sampling and the KV cache.

Planned
Part 3

Pretraining at scale

What changes when the model and data get large: data pipelines, scaling laws, optimizers and schedules, mixed precision and parallelism.

Planned
Part 4

Post-training

Turning a base model into an assistant: supervised fine-tuning, reward models, RLHF and DPO, reinforcement learning with verifiable rewards, LoRA and distillation.

Planned
Part 5

Vision

Convolution, CNNs, detection from sliding windows to the R-CNN family, segmentation with FCN, U-Net and Mask R-CNN, vision transformers and CLIP.

Planned
Part 6

Models in products

Inference, quantization, retrieval, evaluation and agents: the engineering between a trained model and something a customer relies on.

Planned