Translation playground

Type a short English sentence and the paper's model, in miniature, translates it into German, then shows where each German word looked in the English while it was written.

Examples

English sentence
The model knows 86 English words: see the list below.
The words the model knows

The model's German

Anna hat einen kleinen Hund . Sie mag ihn .

The model writes one German word at a time and keeps the four best beginnings at every step, as the paper's beam search does; the finished translations are ranked by their score.

The beam's finished translations

# Translation Log-probability Score
1 Anna hat einen kleinen Hund . Sie mag ihn .
chosen
−0.8043 −0.4465
2 Anna hat einen öffnen einen kleinen Hund . Sie mag ihn . −7.9367 −4.1055
3 Anna hat einen kleinen Hund . Sie mag ihn . Lampe . −8.3971 −4.3437
4 Anna hat einen kleinen Hund . Sie mag ihn . Auto . −8.4355 −4.3635
5 Anna hat einen kleinen Mann . Sie mag ihn . −7.9613 −4.4198
6 Anna hat einen Eine Hund . Sie mag ihn . −8.0386 −4.4627

The log-probability adds up how sure the model was of each word (0 would be certain). The score divides it by the paper's length penalty, so a longer sentence is not punished just for having more words.

Where each German word looked

Each row is a German word as the decoder wrote it; each column an English word it could look at. The darker the cell, the more of that word went into the decision. This is the encoder–decoder attention of the paper's section 3.2.3.

Decoder layer
Head
Encoder–decoder attention, decoder layer 2, All 4 heads, averaged A heat map with one row for each word of the German translation “Anna hat einen kleinen Hund . Sie mag ihn .” and one column for each English word; each cell shows how much attention the German word paid to the English word.Annahasasmalldog.Shelikesit.</s>Anna100 %hat100 %einen73 %25 %kleinen100 %Hund100 %.49 %51 %Sie13 %75 %12 %mag100 %ihn25 %12 %46 %13 %.48 %51 %</s>24 %26 %50 %

The strongest link of each German word:

The model reads English and writes German, the paper's own task, whatever language this page is in. It is about a quarter of a million weights, trained in minutes on a laptop; the paper's base model had 65 million.

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.