Skip to content
Research Papers

Attention Is All You Need Explained: The Paper Behind the Transformer

AIblogly Team October 12, 2026
Attention Is All You Need Explained: The Paper Behind the Transformer

In short: "Attention Is All You Need" is the 2017 Google paper that introduced the transformer, the design behind ChatGPT, Claude, Gemini and almost every current language model. Its key idea, self-attention, lets every word in a sentence look at every other word at once, instead of reading one word at a time. That made models faster to train on graphics chips and better at linking words far apart. The paper tested it on translation and reported better results than earlier models at a fraction of the training cost.

What is "Attention Is All You Need"?

It is a research paper that proposed building language models from attention alone, and named the result the Transformer. Attention Is All You Need was submitted to arXiv on 12 June 2017 and presented at the NeurIPS 2017 conference. Its eight authors (Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin) were at Google Brain, Google Research and the University of Toronto.

Almost every model in our AI models directory is built on the design it introduced. For how those models are trained and used, see how LLMs work.

What problem did the transformer solve?

Before 2017, the leading translation models read text one word at a time, which was slow to train and bad at linking distant words. These were recurrent neural networks (RNNs): each step depended on the one before, so the work could not be split up and run in parallel on graphics chips (GPUs), and information from the start of a long sentence faded by the end.

The paper's proposal was to drop recurrence and convolutions entirely, and build the model from attention alone.

What is self-attention, in simple words?

Self-attention lets each word decide which other words in the sentence matter for understanding it. In "The animal didn't cross the street because it was too tired", the word "it" needs to be linked to "animal", not "street". Attention computes a score between "it" and every other word and mixes in information from the highest-scoring ones.

For each token (word or word-piece), the model computes three lists of numbers:

  • a query - what this token is looking for;
  • a key - what this token offers to others;
  • a value - the information it passes on.

Each token's query is compared against every key; the scores are scaled by the square root of the key size, turned into weights that add up to 1 (a softmax), and used to blend the values. The paper calls this scaled dot-product attention:

Attention(Q, K, V) = softmax(QK^T / sqrt(d_k)) V

Because every token's attention is calculated at the same time, as one large matrix multiplication, the whole sequence is processed in parallel.

What are multi-head attention and positional encoding?

Multi-head attention runs several attention calculations side by side; positional encoding tells the model the order of the words.

  • Multiple heads. Instead of one attention calculation, the model runs several in parallel, each with its own learned settings, so different heads can track different kinds of relationship: one might link pronouns to nouns, another verbs to their objects. Their outputs are joined and combined.
  • Positions. Attention on its own has no sense of word order: "dog bites man" and "man bites dog" would look the same. The paper adds positional encodings (patterns built from sine and cosine waves of different frequencies) to each token's numbers so the model knows where each one sits.

How is the transformer built?

The original transformer has two halves: an encoder that reads the input sentence and a decoder that writes the output one token at a time. For translation, the encoder reads the English sentence; the decoder generates the German one, paying attention both to what it has written so far and to the encoder's output. Each layer pairs attention with a small feed-forward network, with shortcut (residual) connections and normalisation around each.

The base model's size:

SettingBase model
Encoder layers6
Decoder layers6
Model dimension512
Attention heads8
Feed-forward dimension2,048

What results did the paper report?

On the WMT 2014 English-to-German translation task it reported 28.4 BLEU, ahead of earlier published results including ensembles; on English-to-French, 41.8 BLEU for a single model. BLEU is a score for how closely a machine translation matches human translations. The English-to-French model trained for 3.5 days on eight GPUs, which the authors describe as a fraction of the training cost of the best earlier models.

How did the transformer lead to ChatGPT, Claude and Gemini?

Later models kept the attention mechanism and used one half of the design.

  • Encoder only: BERT (2018). Built for understanding text, such as classifying it or finding answers in it.
  • Decoder only: the GPT series. Generates text left to right, one token at a time. Most of today's chat and coding models descend from this layout.
  • Images: the Vision Transformer (2020). Applied the same encoder to patches of an image; see Vision Transformers explained.

What are the transformer's limits?

The cost of attention grows with the square of the input length, because every token attends to every other. Doubling the length of the input roughly quadruples the attention work. Much later research, and the engineering behind today's long context windows, is about reducing that cost.

Words to know

  • Transformer: a neural network design built from attention layers.
  • Attention / self-attention: each token weighing every other token in the input.
  • Token: a word or piece of a word, the unit a model reads.
  • Query, key, value: the three lists of numbers attention computes for each token.
  • Multi-head attention: several attention calculations run side by side.
  • Positional encoding: information added so the model knows word order.
  • Encoder / decoder: the half that reads the input / the half that writes the output.
  • RNN: recurrent neural network, the older one-word-at-a-time design.
  • BLEU: a score comparing machine translation with human translation.

Frequently asked questions

What is "Attention Is All You Need" about?+

It is a 2017 research paper by eight researchers at Google Brain, Google Research and the University of Toronto that introduced the Transformer, a neural network built entirely from attention instead of the step-by-step recurrent networks used before. It is the basis of today's large language models.

Who wrote "Attention Is All You Need"?+

Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin. The paper was submitted to arXiv on 12 June 2017 and presented at NeurIPS 2017.

What is self-attention in simple terms?+

Self-attention lets every word in a sentence look at every other word and decide how much each one matters for understanding it, such as linking "it" to the noun it refers to. All words are processed at once, which makes training fast on GPUs.

Is ChatGPT a transformer?+

Yes. ChatGPT runs on OpenAI's GPT models, which use the decoder half of the transformer design from "Attention Is All You Need" to generate text one token at a time.

Why is it called "Attention Is All You Need"?+

Because the paper showed that a translation model could be built from attention mechanisms alone, with no recurrent or convolutional layers, which earlier leading models relied on.

What is the main limitation of transformers?+

The cost of attention grows with the square of the input length, because every token attends to every other token. Reducing that cost is the subject of much later research and of the engineering behind long context windows.

Enjoyed this? Get more in your inbox.

Up to ten of the week's AI news stories, by email once a week.