A real, working transformer, small enough to see every number. Walk through it layer by layer, with a voice that explains each step. Part of the free Deep Learning and NLP courses.
Every cube is a real number from a real model. It is a tiny GPT-style transformer trained on short stories in a 10-word language (the, cat, dog, bird, said, saw, meow, woof, tweet and a full stop), so it fits on one screen:
| Part | Size |
|---|---|
| Vocabulary | 10 words |
| Vector per word | 8 numbers |
| Layers | 2, each with attention (2 heads) and a feed-forward network (8 → 32 → 8) |
| Prediction | "the cat said" → meow, 100% |
The interesting part is how it gets there: to choose the sound, the word said must find out who is talking. In the second layer one attention head sends 97% of its attention back to cat, and that is what the tour shows.
A large language model is built from exactly the same parts. It has far more words, much longer vectors and many more layers, but nothing new.