Recurrent Networks, LSTMs, and the Memory Problem
CNNs (last course) conquered images — data with spatial structure. But a huge fraction of the world's data is sequential: text (a sequence of words), speech (a sequence of sounds)…
Sequence Models and Generative Models covers: Recurrent Networks, LSTMs, and the Memory Problem, Attention and the Sequence-to-Sequence Revolution, The Transformer, Transformer Variants, Generative Models. Year 4, Quarter 15. Includes 12 exercises and 2 projects.
This course unlocks once you've finished its prerequisite. Open prerequisite →
CNNs (last course) conquered images — data with spatial structure. But a huge fraction of the world's data is sequential: text (a sequence of words), speech (a sequence of sounds)…
The last lesson left LSTMs with two limits: they process sequentially (slow, unparallelizable) and still struggle with long ranges. This lesson introduces the idea that began to f…
This is the most important architecture in modern AI — the one behind every large language model (ChatGPT, Claude, Gemini), the one that conquered vision too (ViT, last course), t…
The transformer (last lesson) is one architecture — but it comes in three flavors, and the difference between them explains the whole landscape of modern language AI, including wh…
Everything in this course so far — and most of classical ML — has been discriminative: given an input, predict a label ("what is this?"). Generative models do something profoundly…
- [ ] Implement an RNN cell from scratch in PyTorch — Single timestep forward, concatenate hidden state + input - [ ] Train a character-level LSTM on Shakespeare text — Generate n…
- [ ] Karpathy Lecture 7: Build GPT from scratch — Transformer decoder: token/position embeddings, multi-head attention, feed-forward, train on Shakespeare - [ ] Karpathy Lecture …
- [ ] Implement a full Transformer (encoder-decoder) for machine translation — English to French on a small parallel corpus - [ ] Train a diffusion model on MNIST — Forward noisin…
- [ ] Build a story generator — Train a small GPT model (following Karpathy) on a text corpus of your choice; implement temperature sampling, top-k, top-p; build a simple web UI f…
Follow Karpathy's lecture 7. Implement a decoder-only Transformer: token embeddings, positional embeddings, multi-head self-attention, feed-forward layers, layer norm. Train on Sh…
Follow Karpathy's lecture 8. Implement byte-pair encoding from scratch: start with bytes, iteratively merge most frequent pairs, build vocab. Encode and decode text. Compare token…
- [ ] Explain the Transformer architecture: self-attention, multi-head attention, positional encoding, feed-forward layers. - [ ] What is scaled dot-product attention? Why do we d…
- [ ] Course 15.1 knowledge check passed - [ ] Course 15.2 knowledge check passed - [ ] Course 15.3 knowledge check passed - [ ] Train and Deploy Neural Networks capstone completed
13 lessons. Read in order; spiral back when you need to. By the end you'll have used the core ideas twice — once on the abstract, once on something you'll meet at work next week.