Stage 1 · From scratch · MA7
Reading the math
The formula inside every chat model fits on one line, and you can learn to read it aloud.
12 lessons · 118 minSteady
About this chapter
Most people stop at the formulas, so this chapter teaches you to read them. You will say a formula out loud, find what every letter holds, follow little numbers to their seats, and turn a sigma into a loop. Then come the symbols of change and chance, and three real lines from real papers: a loss, the attention formula behind chat models, and the optimizer most models train with. You work each one with tiny numbers by hand, then in code.
What you will be able to do
- 18 min
A formula is a sentence
Read a short formula out loud and say what each letter is doing.
- 29 min
Little numbers above and below
Read subscripts as addresses and tell a power from a label up high.
- 39 min
Whole lists in one letter
Tell a number, a list and a grid apart by how they are written, and read their shapes.
- 410 min
Adding up a thousand things
Read a sum or a product with its limits, and turn one into a loop.
- 59 min
Functions inside functions
Read $f(g(x))$ from the inside out and follow data through a layer.
- 69 min
The best, and where it is
Tell $\max$ from $\arg\max$ and read training as an $\arg\min$.
- 79 min
Bars around letters
Read $|x|$, $\lVert \mathbf{x} \rVert_1$ and $\lVert \mathbf{x} \rVert_2$, and say what a penalty on weights does.
- 810 min
Symbols of change
Read $\Delta$, $\frac{dL}{dw}$, $\partial$ and $\nabla$, and the update rule they build.
- 910 min
Symbols of chance
Read $P(A \mid B)$, $\mathbb{E}[X]$ and $X \sim \mathcal{N}(\mu, \sigma^2)$ aloud and work each one out.
- 1011 min
Reading a loss
Read mean squared error and cross-entropy piece by piece, and tell what a loss number means.
- 1112 min
Reading attention
Read $\operatorname{softmax}(QK^{\top} / \sqrt{d_k})\,V$ piece by piece and work one row by hand.
- 1212 min
Read any formula
Use a five-step habit to read a formula you have never seen, and code it.