Attention and language
-
PART 1
From characters to next-token prediction
Train a character model on names. Follow embedding lookup, a fixed context window, one hidden layer, and softmax. Then sample a name and see what temperature changes.
-
PART 2
Self-attention, from first principles
Use the bank examples to work out queries, keys, and values. Calculate the scores, apply the causal mask, and mix the values. See how context changes the representation used to predict the next token.
-
PART 3
Multi-head attention and TinyStories
See why a token can use several readings. Work through complete TinyStories examples, tokenization, special tokens, windows and batches, then the four-head model, training and generation. Compare measured loss and cost in the three-model app.
-
PART 4
Cross-attention: translate one phrase
Translate "the river bank" into "la rive". Follow a decoder query as it reads the encoder's keys and values, then use the retrieved information to predict the next French token.
Optional Part 2B: training, Transformer blocks and context cost keeps the longer reference material separate from the multi-head walkthrough.
Vision to language
Keep a small image in view as the task changes. Each part separates the worked toy from the full architecture and states what its numbers can, and cannot, demonstrate.
-
VISION I
Vision Transformer
Derive the Vision Transformer through five questions: turn a photograph into tokens, add location and CLS, reuse the encoder, then predict an ImageNet class.
-
VISION II
Learn visual representations without class labels
Hide part of the scene and ask for it back. Train a small masked-image decoder, watch a teacher collapse and recover with DINO's two tricks, predict a feature with I-JEPA, then probe what the frozen encoder learned.
-
VISION III
CLIP: From Fixed Labels to Language-Defined Vision
Start with image–text applications, follow the two encoders, and calculate every dot product, row and column probability, and contrastive-loss term. Finish by revisiting the opening experiment and bringing the encoders, training and applications together in three summary diagrams.
-
VISION IV · AFTER CLIP
From CLIP to Vision-Language Models
Turn image features into context for language generation. Derive visual prefixes, separate visual memory and learned-query compression, then connect the ideas to LLaVA, Flamingo and BLIP-2, training and inference.
-
VISION V · LANGUAGE-GROUNDED VISION
How Words Become Boxes, Regions, and Masks
Follow one scene from region–text matching to language-guided detection, Grounded SAM, generated coordinates and reasoning masks. Change the request and inspect which region the model returns.
Using these lessons
Each part is one self-contained page that works offline, including its diagrams and maths. The article and classroom presentation share the same content; there is no separate slide copy to keep in sync. Read the full explanation or switch to the lean article view.
Choose Present, or press P in an article. The slides have no permanent header or footer. Use ← and → to move through the builds, and open Controls or press C when you need navigation. Esc returns to reading. O opens the overview, S shows notes, and Presenter view opens notes and a clock in a second window.
The notation and object colours stay consistent across the lessons. Slide-PDF exports include revealed quiz answers by default, so they can be read without interactive controls.