Tools

Tools that run the lab's two tiny models live: type your own sentence, change a setting, and every number is computed again by the engine.

Translation playground

English in, German out: the paper's model translates your sentence with beam search, and a heat map shows where each German word looked in the English. In the paper: section 3.2.3, 6.1

Attention explorer

Every layer and head of both models as heat maps on your sentence; pick a word to see its query meet the keys, the scores, the scaling and the weights. In the paper: section 3.2

The paper's Figure 1, live

The transformer's architecture as the paper draws it, redrawn: click any box to see its numbers for your sentence, or play a whole translation through it. In the paper: section 3

Watch a translation, step by step

Your English sentence through the paper's transformer, one sub-layer at a time: Figure 1 lights up on one side, the calculation with the model's real numbers on the other, until the German is written. In the paper: section 3, 6.1

Next-word playground

The GPT-style model reads your English and ranks the next word; change the temperature and top-k, and let it write one word at a time. In the paper: section 3.1, 3.4

Beam search

The decoder's choices as a tree: change the beam width and the length penalty, and watch which translations survive. In the paper: section 6.1

BLEU calculator

Score a German translation against a reference the way the paper scored its models: matching words and phrases, and a penalty for being too short. In the paper: section 6.1

Why divide by √d_k: the experiment

Random queries and keys of growing size: watch the dot products spread out and the softmax collapse onto one word, unless they are divided by √d_k. In the paper: section 3.2.1

Positional encoding explorer

The paper's sine and cosine waves as a grid of colours, wave by wave, and how similar two positions are as they move apart. In the paper: section 3.5

Learning-rate schedule

The paper's warm-up formula as a live curve: change d_model and warmup_steps, and compare the paper's settings, ours and our recorded run. In the paper: section 5.3

Label smoothing

Spread a little of the target onto the other words and see what it does to the loss, then our model trained with and without it. In the paper: section 5.4

Dropout

Switch values off at random, rescale the rest, and see why the vector's average stays the same and why dropout is off when translating. In the paper: section 5.4

Table 1 explorer

The paper's Table 1 with your own numbers: the cost of self-attention, recurrent and convolutional layers as the sentence grows. In the paper: section 4

Table 3 explorer

Our reruns of the paper's model variations on the tiny model: heads, size, dropout, label smoothing and learned positions, three seeds each. In the paper: section 6.2

Embedding map

Every word of the shared English and German vocabulary as a point in 2D, with each word's nearest neighbours: the words the model treats alike. In the paper: section 3.4

Head gallery

The 24 heads of the paper's model, each named in plain words from what it does on the held-out sentences, with examples. In the paper: section Appendix

Matrix calculator

Multiply two small matrices step by step: each cell of the result is one row times one column. In the paper: section 3.2.2, 3.3

Translation chat

Chat with the paper's model: type English and it answers in German, with its other candidates and a walkthrough of each reply; or let the GPT-style model continue your sentence. In the paper: section 6.1

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.