micrograd answers how a network learns. It does not show you how you get to a GPT. That path is nn-zero-to-hero, a course of eight lectures. The official syllabus is on karpathy.ai/zero-to-hero.html. The notebooks live in the repo under lectures/.
Hao's advice is to watch lecture 1 alongside the micrograd stop, because lecture 1 is the spelled-out build of that engine. The rest of the series then moves into language models. This lesson is a map, not a substitute for the videos. Do not try to finish all eight in one sitting.
The first two lectures
Lecture 1 builds micrograd. It assumes basic Python and a vague memory of high-school calculus. Video: The spelled-out intro to neural networks and backpropagation. Notebooks: lectures/micrograd.
flowchart LR
L1["Lecture 1: micrograd"] --> Engine["A working autograd engine"]
Lecture 2 starts language modelling. It builds a character-level bigram model, introduces torch.Tensor, and sets up the loop you will keep seeing: train, sample, and evaluate a loss such as negative log likelihood. Video: The spelled-out intro to language modeling. Notebook: makemore_part1_bigrams.ipynb. Related repo: makemore.
flowchart LR
L1["Lecture 1: micrograd"] --> L2["Lecture 2: bigram language model"]
L2 --> Loop["Train, sample, evaluate a loss"]
The makemore lectures
Lectures 3 to 6 stay with character-level language models and make the net more capable, one idea at a time.
- Lecture 3 builds a multilayer perceptron, and introduces training practice such as learning rates, train and validation splits, and underfitting or overfitting. Video: Building makemore Part 2: MLP. Notebook: makemore_part2_mlp.ipynb.
- Lecture 4 looks at activation and gradient statistics, and introduces Batch Normalization, which made deep nets much easier to train. Video: Activations and Gradients, BatchNorm. Notebook: makemore_part3_bn.ipynb.
- Lecture 5 asks you to backpropagate through that net by hand, without
loss.backward(). You walk the loss, the linear layers, tanh, BatchNorm, and the embedding table on tensors, not only on scalars. Video: Becoming a Backprop Ninja. Notebook: makemore_part4_backprop.ipynb. There is also a Colab exercise. - Lecture 6 deepens the MLP into a tree-like structure similar to DeepMind's WaveNet (2016). You also get a better feel for
torch.nn. Video: Building WaveNet. Notebook: makemore_part5_cnn1.ipynb.
flowchart TD
L1["1 micrograd"] --> L2["2 bigram model"]
L2 --> L3["3 MLP"]
L3 --> L4["4 activations, BatchNorm"]
L4 --> L5["5 manual backprop"]
L5 --> L6["6 WaveNet-style net"]
L6 --> L7["7 GPT"]
L7 --> L8["8 tokenizer"]
GPT, then the tokenizer
Lecture 7 builds a Generatively Pretrained Transformer, following Attention Is All You Need and OpenAI's GPT-2 and GPT-3. Video: Let's build GPT: from scratch, in code, spelled out. Karpathy recommends the earlier makemore videos first, so the language-modelling loop and torch.nn already feel familiar.
Lecture 8 builds the tokenizer used in the GPT series. A tokenizer is a separate stage, with its own training set and its own algorithm, Byte Pair Encoding. After training it exposes two functions: encode, which maps strings to token IDs, and decode, which maps IDs back to strings. Video: Let's build the GPT Tokenizer. Code: minbpe, which is the next stop. Colab: lecture notebook.
Hao's gate still holds. If you can rebuild micrograd's engine without looking, you are ready for stop 3, the tokenizer repo. You do not have to finish lectures 2 to 8 first. Those lectures will make stops 3 and 4 much easier, and lecture 8 is the spoken version of minbpe. Use the map, then go as deep as you have time for.
Key concepts
- nn-zero-to-hero is eight lectures. The official syllabus is on karpathy.ai/zero-to-hero.html.
- Lecture 1 builds micrograd. Watch it with lesson 1 of this course.
- Lectures 2 to 6 build character-level language models, then stronger nets, better training practice, manual backprop, and a WaveNet-style architecture.
- Lecture 7 builds a GPT. Lecture 8 builds the GPT tokenizer, and leads into the minbpe repo.
- Hao's suggested gate: if you can rebuild the micrograd engine without looking, you are ready for the tokenizer stop.
Takeaways
- Keep the syllabus and the repo open while you watch: karpathy.ai/zero-to-hero.html and github.com/karpathy/nn-zero-to-hero.
- Treat this lesson as a map. The videos and notebooks are the course.
- Move to minbpe when the engine is in your fingers, even if later lectures are still in progress.