Skip to content

Attention Is All You Need

Written by GPT-6 Luna from the web 17 of 65 sentences cited

An AI wrote this article, and it can be wrong.

Attention Is All You Need is a 2017 research paper that introduced the Transformer, a neural-network architecture for processing sequences using attention rather than recurrent or convolutional layers. Its central contribution was to show that a model could compare sequence elements directly, making training more parallelizable while achieving strong machine-translation results.1

The paper helped redirect research in language processing toward models that can learn contextual relationships across a sequence without reading it one element at a time during training. Later Transformer-based systems applied the architecture to tasks beyond translation, including language understanding and text generation; research has also adapted it to other kinds of data. The original work remains notable both for its experimental results and for the design that subsequent researchers developed in many different ways.234

Background

The paper was written by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser and Illia Polosukhin. Most authors were affiliated with Google Brain or Google Research; Gomez was affiliated with the University of Toronto. The paper records equal contributions among the authors and describes several different roles in developing and evaluating the model.1

The authors submitted the paper to arXiv on June 12, 2017, and it appeared in the proceedings of the 2017 Conference on Neural Information Processing Systems, then known as NIPS. Its research question arose from sequence-to-sequence machine translation, where systems convert an input sequence, such as a sentence in one language, into an output sequence in another. Recurrent neural networks were widely used for this work, but their step-by-step processing made training less parallelizable. The paper proposed an alternative that retained an encoder–decoder structure while removing recurrence and convolution.21

The work did not introduce attention as a general idea. Earlier researchers had used attention mechanisms in neural machine translation, including a 2014 model that learned to align input and output words. The 2017 paper’s distinctive step was to build a sequence-transduction model whose representations relied entirely on attention, without recurrent or convolutional layers. In doing so, it shifted attention from a component that helped other architectures to the main mechanism for relating elements in the sequence.1

Architecture

The original Transformer has an encoder that processes the input and a decoder that produces the output. Each is made of stacked layers: the encoder combines self-attention with a position-wise feed-forward network, while the decoder also uses attention to consult the encoder’s representations. In the paper’s standard configuration, both stacks contain six layers. Residual connections and normalization surround the sublayers, and positional encodings are added because attention alone does not specify the order of sequence elements.1

In self-attention, the model calculates how strongly elements in a sequence relate to one another, then uses those scores to combine information into contextual representations. The paper’s scaled dot-product attention computes scores from queries and keys, scales them, and applies them to values. Multi-head attention runs several learned attention operations in parallel, allowing the model to represent different relationships at once. During training, the encoder can process all input positions together; the decoder is autoregressive, producing output tokens in order and masking future positions so they cannot inform earlier predictions.15

This parallel processing was a key part of the paper’s argument. A recurrent layer requires sequential operations across a sequence, whereas self-attention can connect all positions within a layer using a fixed number of sequential steps. That makes it easier to use hardware designed for parallel computation and shortens the path through which information can travel between distant positions. The trade-off is that standard self-attention computes relationships between pairs of positions, so its computational cost rises rapidly as sequences become longer.16

Experiments

The authors evaluated the Transformer on the WMT 2014 English-to-German and English-to-French machine-translation benchmarks. These were substantial but different-sized datasets: the English-to-German set contained about 4.5 million sentence pairs, while the English-to-French set contained 36 million. The paper reported translation quality using BLEU, a metric for comparing machine-generated translations with reference translations. Its experiments compared Transformer models with contemporary recurrent, convolutional and attention-based systems.1

In the published conference paper, the larger Transformer scored 28.4 BLEU on English-to-German, exceeding the best previously reported result, including ensembles, by more than two points. It scored 41.0 BLEU on English-to-French and outperformed previously reported single models on that task. The authors reported training the larger English-to-German model for 3.5 days on eight P100 GPUs. The paper also tested English constituency parsing, a task that analyzes sentence structure, and reported that the architecture performed well with both large and limited training data.1

The version history is relevant to one of the reported figures. The NeurIPS conference paper gives the English-to-French score as 41.0, while the later arXiv abstract gives it as 41.8. These are figures from different versions of the work, rather than a single identical claim repeated across the records. The paper’s wider argument was that the architecture combined translation quality with more efficient training than the systems it compared against; the results were tied to the particular benchmarks, model configurations and hardware reported by the authors.12

Subsequent research

Researchers soon adapted the Transformer’s design for language tasks other than translation. BERT, introduced in 2018, used a Transformer encoder to learn bidirectional representations of text. GPT systems used a decoder-oriented Transformer for language modeling and text generation. These models applied different training objectives and configurations; they were not simply the original translation system reused unchanged. Their development illustrated how the paper’s architecture could serve as a basis for varied methods of training on large text collections.789

The architecture also spread beyond text. A 2024 historical survey describes Transformer-based work in computer vision, audio, time-series analysis and biomedical applications, alongside language models. Such systems adapt the basic operations to different inputs; for example, a vision model can represent an image as a sequence of patches. This broadening did not mean every later model used the original encoder–decoder design or all of its components. Rather, researchers treated the Transformer as a family of designs that could be modified for different tasks and data types.4

Constraints

The efficiency advantage identified in the paper does not make attention inexpensive for every use. Standard self-attention compares sequence positions pairwise, so its work and memory demands grow substantially with sequence length. This can constrain applications involving long documents or other lengthy inputs. Research on faster and lighter Transformers has explored ways to reduce these costs, including restricting or approximating attention, but such alternatives involve design choices about the balance between computational requirements and model performance.16

The original experiments established results on defined translation and parsing benchmarks, not a general guarantee of performance on all language tasks. Later work has examined theoretical and practical limits of self-attention and Transformer models. These analyses address questions such as which computations particular architectures can perform and how performance or resource needs change as input sequences grow. Such results concern specific assumptions and model variants; they do not negate the experimental results in the 2017 paper, but they show that the architecture’s strengths do not remove the need to study its limitations.110

Significance

The paper’s lasting significance lies in the combination of an architectural proposal and evidence that it could work at competitive translation quality while supporting more parallel training. Later research expanded the design into models trained for language understanding and generation, and then adapted Transformer-based approaches to other domains. A historical survey published in 2024 describes this progression from the architecture’s original sequence-to-sequence setting into a broad range of machine-learning applications.14

The title’s claim that attention was “all” that was needed referred to the architecture’s removal of recurrence and convolution for sequence transduction, not to the elimination of every other model component or training technique. The original system still used feed-forward networks, embeddings, positional information, normalization and residual connections. Later models also changed how Transformers were trained and structured. The paper is therefore best understood as the introduction of a new design principle for sequence processing, rather than as a complete recipe for the many systems that followed it.1

References

10 sources
  1. Attention Is All You Needarxiv.orgJun 12, 2017· cited 3×