Subject 06 / Course

Machine learning systems

From gradients to clusters: the mathematics of training, transformers, GPU architecture and performance, and training at scale.

7 modules30 lessons≈ 4 h reading
Start with lesson 1.a

Large models are built from a few simple operations repeated at enormous scale. This course follows them from a single gradient to a training run across thousands of GPUs: what the mathematics asks for, what the hardware can deliver, and where the two meet.

It assumes you can read Python and remember a little linear algebra. It does not assume a machine-learning background.

What you need#

  • Python 3.10 or newer. Programs use only the standard library and run offline; GPU behavior is simulated with arithmetic.

The modules

1

Foundations

The mathematics every training run repeats: tensors and their shapes, gradients by backpropagation, the optimizers that use them, and how to tell learning from memorizing.

  1. 1.aTensors and shapes9 min
  2. 1.bGradients and backpropagation10 min
  3. 1.cOptimizers and learning rates9 min
  4. 1.dGeneralization and overfitting9 min
2

Transformers

The model behind modern AI systems, built up from tokens: tokenization and embeddings, attention with masks, the full block with its parameter and FLOP counts, and the scaling laws that size models and datasets.

  1. 2.aEmbeddings and tokenization10 min
  2. 2.bAttention from scratch10 min
  3. 2.cThe transformer block10 min
  4. 2.dScaling laws and compute9 min
3

GPU architecture

What is inside a modern data-center GPU: streaming multiprocessors, warps, the memory hierarchy, and tensor cores with their number formats.

  1. 3.aWhy GPUs, and the roofline8 min
  2. 3.bSMs, warps, and SIMT8 min
  3. 3.cThe memory hierarchy7 min
  4. 3.dTensor cores and number formats8 min
4

GPU performance

How GPU code is written and made fast: the CUDA programming model, coalesced access and occupancy, tiling, fusion and IO-aware kernels, and reading a profiler.

  1. 4.aThe programming model8 min
  2. 4.bCoalescing and occupancy8 min
  3. 4.cTiling a matmul9 min
  4. 4.dFusion and IO-aware kernels9 min
  5. 4.eProfiling GPU code8 min
5

Training at scale

What changes when one training run spans thousands of GPUs: feeding data, numerical stability, data, tensor, and pipeline parallelism, sharded optimizer state, and surviving failures.

  1. 5.aData pipelines8 min
  2. 5.bMixed precision and stability8 min
  3. 5.cData parallelism and all-reduce8 min
  4. 5.dZeRO and FSDP7 min
  5. 5.eTensor and pipeline parallelism8 min
  6. 5.fCheckpoints and failures8 min
6

Clusters and hardware

How GPUs are wired together, how collectives move data across that wiring, how one GPU is shared, and how to compare accelerators from their datasheets.

  1. 6.aNVLink, PCIe, and topology11 min
  2. 6.bCollectives and networking10 min
  3. 6.cSharing GPUs11 min
  4. 6.dThe accelerator landscape9 min
7

Post-training and evaluation

Adapting a pretrained model with fine-tuning and LoRA, aligning it with preference data, and measuring the result without fooling yourself.

  1. 7.aFine-tuning and LoRA10 min
  2. 7.bPreference optimization9 min
  3. 7.cEvaluation and contamination9 min
← Back to the library