Skip to content

The 2017 paper behind the transformer was trying to improve translation

Explainers
A glass paperweight magnifies two colored tiles in rows of otherwise blank white tiles.
A glass paperweight magnifies two colored tiles in rows of otherwise blank white tiles. AI-generated editorial illustration by AI World Today.
In June 2017, a team put out a paper on a new way to translate text. The transformer used attention to link parts of a sentence. It could also train on many positions at once. Those choices gave other researchers a design they could try on tasks far from translation.
The eight authors of Attention Is All You Need posted it on June 12, 2017. They used tests for translation from English to German and French. The work later appeared in that year’s Neural Information Processing Systems proceedings.

What the model needed to do

Languages express the same ideas in different ways. A sentence may put a name, place, or action in a different order once you translate it. The model needs a way to keep those links while it makes a new sentence.
The transformer in the paper had two parts. An encoder built a set of views of the input. A decoder used those views as it wrote the output. The two parts had to share enough about the source for the result to stay close to its meaning.
The team reported a BLEU score of 28.4 on the English-to-German test. BLEU scores text by checking how well some runs of words match human reference translations. It gave the authors a check they could compare with earlier work. A reader who wants to know how the model would handle one hard sentence would need to look at that case in more detail.
Many earlier models used a series of steps in which the state at one position helped form the state at the next. That can make two words far apart in the text hard to link. A long chain of steps also gives a processor less work it can do at the same time.

Earlier work had shown a role for attention

Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio’s 2014 preprint showed how a translation model could draw on the most useful parts of the source as it wrote. That helped with the problem of trying to keep all the facts about a sentence in a single fixed-size form.
Say you are trying to put a verb in the right form. To do that, you may need to know who did the action. A model can use attention to give more weight to the source words that hold that detail. At the next step, another part of the input might be worth more weight.

What self-attention does

In Google Research’s 2017 explanation, Jakob Uszkoreit shows how each position can draw on other positions in the same sentence. The model learns which links can help it form a better view of the text.
Take the sentence “The camera beside the empty boxes needs a new battery.” The camera needs the battery. The boxes are closer to the verb in the line of text. The link between the verb and camera still matters most for that part of the meaning.
Self-attention gives positions a direct way to share information. Several sets of weights, known as heads, can learn to look for different kinds of links. Other layers in the design do more work with what the heads find. The model also gets information about where each part sits in the sentence.
Order makes a big difference. “The pen is under the book” and “The book is under the pen” use the same words. A useful model has to tell the two cases apart. The design gives it cues about positions to use with what it has learned about the words.
The toy sentence helps show why a link can be useful. It would take a separate check to say which head in a trained model handled that link on a real run. The paper lays out the operation that makes those links possible.

Why the change helped with training

Think about sending a stack of pages to several people to read. They can work on many pages at once if each has what they need to start. If each page depends on someone having finished the last, there is less room for the work to happen at the same time.
In training, the team can give the model text examples in which the earlier target words are known. That lets it do parts of the work at many positions at once. When it writes a fresh answer step by step, the decoder still needs words it just wrote before it can go on.
The Tensor2Tensor project gave people tools and software to try these ideas. For a wider view of the research group and how its work reached products, see our guide to Google and its AI work.

What people built with the design

The same parts can serve different goals once teams change how they train them. BERT, described in a 2018 preprint, learned from context on both sides of a position. A team could then adapt it to tasks such as finding an answer in a passage.
Another project, T5, asked how much could be done if each task took text in and gave text back. A translation could give a sentence in a new language. A reading task could give a short answer. That common form gave the team a way to compare its choices across tasks.
When you see the word transformer in a new paper, it helps to look at what part of the design the team uses and what it learned to do. A model that reads both sides of a text and a model that writes one piece at a time can share ideas from the same work.

Why the first test still matters

Translation gave the team a way to check an idea about how to lay out the work. The 2017 result gave other people a reason to run more tests. A product showed up only after more choices about training, data, features, and access.
To trace one of those later ideas back to the paper, follow a part such as attention. See how each new model uses it and where it adds its own rules. That makes it easier to spot which change brought a particular result.
Our account of early reactions to ChatGPT covers one later stage, when many people tried a new way to use such models. See our AI history collection for other cases where a well-defined test set a new line of work in motion.
loading

Loading