← All research

Attention Is All You Need

Model architecture · 2017

How does a model find the relevant fact in changing context? Train a small attention head, change a delivery schedule, and watch its answer follow the record—not a memorized date.

Google Brain · Google Research · University of Toronto · Affiliations in the paper

TRY THIS
  • Change Mira’s delivery day without retraining.
  • Reorder the records: the answer should stay the same.
  • Compare learned attention, equal attention and untrained weights.

START WITH THE IDEA

The idea in brief.

The Transformer is a sequence-to-sequence architecture built around attention. At each layer, a token can gather information from other positions by comparing a query with their keys, then mixing their values. Multiple heads, position information and feed-forward layers make this more than a single lookup.

Recurrent path · schematic

  1. Position 1 → state
  2. Position 2 → state
  3. Position 3 → state

Self-attention · one position’s view

  1. Query ↔ all keys
  2. Normalize relevance
  3. Mix their values
A conceptual comparison, not a runtime benchmark. The original Transformer also needs position encodings, multiple heads, feed-forward layers and masking. RNNs and CNNs remain useful in other settings.

THE SIGNIFICANCE

Why it matters.

01

A different route through a sequence

Recurrent networks pass state through successive positions; convolutional models connect positions through local layers. This paper used attention throughout its encoder and decoder, allowing distant positions to interact directly within a layer.

Sections 1 and 4 ↗
02

More parallel work during training

Removing recurrence reduced the sequential work within a training sequence. The authors reported strong translation results with less training time than the systems they compared. Autoregressive generation still predicts successive output tokens; parallel training does not mean every part runs at once.

Sections 3 and 6 ↗
03

A mechanism you can inspect

Our small labs expose scores, weights and contributions. They isolate attention’s selection and mixing operation, so you can change inputs and follow each result. They do not reproduce the full Transformer or its translation results.

Hopper implementations ↗