Transformers and Attention Lab

Playback speed

Press Play: the word “it” asks every word of the sentence how relevant it is, and the answers decide what it takes from each. This is attention, computed by the lab's own tiny model of the paper's design; one of its heads links “it” to “dog”.

Watch a translation, step by step

Type an English sentence and watch the paper's model translate it into German, one sub-layer at a time: the architecture of Figure 1 lights up on one side, and every calculation, with the model's real numbers, appears on the other.

Watch a whole translation step by step

An interactive course in how the transformer works, as the 2017 paper Attention Is All You Need describes it and as today's models use it. A real, tiny model built to the paper's design translates English into German in front of you, step by step, and every number on the page comes from the lab's own engine.

Written for engineers and tech leads who call an LLM every day and never studied machine learning: the little mathematics it needs comes first, with pictures. By the end you can read the paper itself and follow it, section by section.

All 25 chapters, every section of the paper and every tool are open; the lab guide shows the way around, and the notation sheet lists every symbol of the paper on one page.

Course

25 chapters in 6 parts build the transformer from zero: tokens and vectors, attention, the layer, the paper's whole model, and today's GPT-style models.

Theory

A companion to Attention Is All You Need, in the paper's own order: every section in plain words, every figure redrawn and every symbol explained.

Tools

Run the models yourself: translate a sentence and see where each German word looked, explore every head of every layer, and try the paper's simulations.

The models read English and write German, the paper's own task, whatever language this page is in: a model only knows the languages it was trained on.

An unhandled error has occurred. Reload ๐Ÿ—™

Reconnecting…

Your connection to the Transformers and Attention Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.