micrograd, mapped
Karpathy builds a scalar autograd engine from an empty notebook, backpropagates through it by hand until the rule is obvious, then automates it, wraps it in Neuron, Layer and MLP, and trains a network by hand. This map splits the lecture into eight parts you can read before, during or after watching: what each stretch answers, the worked numbers, the code it arrives at, where people get stuck, and exercises. Every timestamp opens the video at that moment.
Tick a part when you've worked through it; this browser remembers.
Derivatives, and a data structure that remembers
What a derivative measures, numerically, before any calculus; then a Value object that records how every number was made, so the graph of an expression can be drawn and, later, walked backwards.
Backpropagation, by hand and then automated
The heart of the lecture. Gradients computed manually node by node until the chain rule is obvious; then a _backward closure per operation, a topological sort, a bug when a value is used twice, and the same thing checked against PyTorch.
A neural net, trained by hand
Neuron, Layer and MLP on top of Value; a four-example dataset; a mean-squared-error loss; the parameters collected; and gradient descent stepped manually, including the classic mistake of not zeroing the gradients.
The real code
The finished micrograd repository read top to bottom, then a dig into PyTorch's own backward for tanh to show it is the same rule in C++.
The exercise
Karpathy sets one, in the video description: a Colab notebook you should be able to complete after the lecture. Each part above also sets its own smaller exercises.
- The official exercise notebook. Open the Colab: derive the gradient of a function analytically and numerically, extend Value with the operations needed for a softmax-and-negative-log-likelihood loss, and verify against PyTorch. Sections map to P1, P5 and P7.
- Next in the series. makemore part 1 builds a bigram character model on this foundation; the seventh video is mapped at Let's build GPT, mapped.