Reading order

You do not have to read everything, or read it in textbook order. Pick the line closest to what you are doing and follow it. When something does not make sense, the table at the bottom says where to go back to.

Building a product on an LLM

What you need to build a service that retrieves documents and hands them to an LLM. The only math is vectors and the dot product.

  1. Vectors in n dimensions
  2. Dot product
  3. Embeddings
  4. Vector search
  5. RAG
  6. Chunking
  7. Keyword and hybrid search
  8. Retrieval metrics
  9. AI agents

How an LLM writes text

From text cut into tokens to the next token being picked.

  1. Tokenization
  2. Embeddings
  3. Attention
  4. Transformers and LLMs
  5. Encoders and decoders: three kinds of transformer
  6. Embedding models: one vector per sentence
  7. How LLMs are trained
  8. Softmax and sampling
  9. Context windows and the KV cache
  10. Structured output
  11. Fine-tuning and LoRA
  12. Hallucination and evaluating LLMs

How a model learns

Measure how wrong the model is, then nudge the weights to make it less wrong.

  1. Functions and graphs
  2. Derivatives and the chain rule
  3. Partial derivatives and the gradient
  4. Neural networks
  5. Backpropagation
  6. Gradient descent
  7. Overfitting and generalization
  8. Normalization and standardization

Models that answer with probabilities

A model's answer is a probability. How to read one and how to score it.

  1. Probability and Bayes' theorem
  2. Normal distribution
  3. Entropy and cross-entropy
  4. Logistic regression
  5. Softmax and sampling

Linear algebra from the start

The textbook order, from linear systems to the singular value decomposition.

  1. Linear systems and elimination
  2. Matrix basics
  3. Matrix multiplication
  4. Inverse matrix
  5. Determinant
  6. Cramer's rule
  7. Vectors
  8. Dot product
  9. Cross product
  10. Vectors in n dimensions
  11. Vector spaces and subspaces
  12. Linear combinations and span
  13. Basis and change of coordinates
  14. Rank
  15. Linear transformations
  16. Eigenvalues and eigenvectors
  17. Orthogonal matrices and inner product spaces
  18. Projection and least squares
  19. Singular value decomposition
  20. Tensors and shapes: axes, shape and broadcasting

Calculus from the start

From functions to slopes, areas, and many inputs.

  1. Functions and graphs
  2. Limits and continuity
  3. Derivatives and the chain rule
  4. Integrals
  5. Partial derivatives and the gradient
  6. Taylor approximation
  7. Jacobian and Hessian

Images and other ways of learning

Networks that read images, models that make them, and learning from reward.

  1. Convolution and CNNs
  2. Diffusion models
  3. Reinforcement learning
  4. Principal component analysis

Statistics from the start

From summarizing data to tests and designing experiments.

  1. Descriptive statistics
  2. Samples, sampling distributions and the standard error
  3. Confidence intervals
  4. Hypothesis testing and the p-value
  5. Type I and type II errors, and statistical power
  6. The t-test
  7. Analysis of variance (ANOVA)
  8. The chi-square test
  9. Nonparametric tests
  10. Correlation and regression
  11. Multiple comparisons
  12. Risk, relative risk and odds ratio
  13. Survival analysis
  14. Diagnostic tests and the ROC curve
  15. Sample size calculation
  16. Randomization and control groups
  17. Block designs
  18. Factorial designs and interaction
  19. Repeated measures and crossover designs
  20. Confounding and bias
  21. Clinical trial design

When a deep network will not train

What to check, one by one, when training does not work.

  1. The training loop: one step, one epoch
  2. Activation functions
  3. Vanishing and exploding gradients
  4. Weight initialization
  5. Batch norm and layer norm
  6. Residual connections (ResNet)
  7. Learning rate schedules
  8. Batch size and gradient accumulation
  9. Dropout
  10. Weight decay and L1/L2 regularization
  11. Early stopping and reading learning curves
  12. Data splits and leakage
  13. Confusion matrix, precision, recall and F1

Models for images

From convolution to detection, segmentation and vision transformers, then on to video and 3D.

  1. Convolution and CNNs
  2. Pooling and receptive fields
  3. Reading CNN architectures
  4. Batch norm and layer norm
  5. Residual connections (ResNet)
  6. Data augmentation
  7. Transfer learning and fine-tuning
  8. Object detection
  9. Detector architectures: the R-CNN family and YOLO
  10. Image segmentation
  11. Vision Transformer (ViT)
  12. Self-supervised learning: representations without labels
  13. Metric learning: learning a distance
  14. Multimodal learning: how CLIP puts images and text in one space
  15. Video classification: convolution with a time axis
  16. 3D vision: voxels, point clouds and NeRF
  17. Registration: from rigid to non-rigid

If you get stuck

Read the topics on the right first.

TopicRead first
EmbeddingsVectors in n dimensions, Dot product
Vector searchDot product, Vectors in n dimensions
AttentionDot product, Matrix multiplication, Softmax and sampling
Transformers and LLMsAttention, Neural networks, Entropy and cross-entropy
Fine-tuning and LoRARank, Singular value decomposition, Matrix multiplication
BackpropagationDerivatives and the chain rule, Partial derivatives and the gradient
Gradient descentPartial derivatives and the gradient, Jacobian and Hessian
Neural networksMatrix basics, Functions and graphs
Entropy and cross-entropyFunctions and graphs, Probability and Bayes' theorem
Logistic regressionEntropy and cross-entropy, Partial derivatives and the gradient
Normalization and standardizationNormal distribution, Principal component analysis
Principal component analysisEigenvalues and eigenvectors, Projection and least squares
Diffusion modelsNormal distribution, Neural networks
Projection and least squaresDot product, Basis and change of coordinates
Jacobian and HessianPartial derivatives and the gradient, Eigenvalues and eigenvectors, Determinant