Paper summary
Attention Is All You Need
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, Illia Polosukhin
In short
The paper introduces the Transformer, a neural sequence-to-sequence model that uses only attention and no recurrence or convolutions. It shows strong machine translation results and also works well on English constituency parsing while training faster and in a more parallel way than prior models.
Research question. Can a sequence transduction model based entirely on attention replace recurrent and convolutional architectures while improving translation quality and training efficiency?
Highlights in the PDF
Read these first
Main claims
“We propose a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely.”
The Transformer is a simple architecture based solely on attention mechanisms, dispensing with recurrence and convolutions entirely.
“Experiments on two machine translation tasks show these models to be superior in quality while being more parallelizable and requiring significantly less time to train.”
The model is more parallelizable and requires significantly less time to train than prior sequence transduction models.
“Our model achieves 28.4 BLEU on the WMT 2014 Englishto-German translation task, improving over the existing best results, including ensembles, by over 2 BLEU. On the WMT 2014 English-to-French translation task, our model establishes a new single-model state-of-the-art BLEU score of 41.8 after training for 3.5 days on eight GPUs, a small fraction of the training costs of the best models from the literature.”
The Transformer achieves new state-of-the-art translation results on WMT 2014 English-German and English-French.
“We show that the Transformer generalizes well to other tasks by applying it successfully to English constituency parsing both with large and limited training data.”
The Transformer generalizes beyond translation and performs well on English constituency parsing.
“As noted in Table 1, a self-attention layer connects all positions with a constant number of sequentially executed operations, whereas a recurrent layer requires O(n) sequential operations.”
Self-attention provides favorable computational properties and shorter paths for long-range dependencies than recurrent or convolutional layers.
Conclusion
“For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers. On both WMT 2014 English-to-German and WMT 2014 English-to-French translation tasks, we achieve a new state of the art.”
The paper concludes that an attention-only architecture can outperform recurrent and convolutional sequence models on translation while training more efficiently, and that the same design transfers well to parsing. It also points toward broader use of attention-based models and future work on local attention and non-text modalities.
Key figures and tables
Main methods
“The Transformer follows this overall architecture using stacked self-attention and point-wise, fully connected layers for both the encoder and decoder, shown in the left and right halves of Figure 1, respectively.”
Encoder-decoder Transformer architecture
Builds stacked encoder and decoder blocks using multi-head self-attention, residual connections, layer normalization, and position-wise feed-forward networks.
“We compute the dot products of the query with all keys, divide each by √dk, and apply a softmax function to obtain the weights on the values.”
Scaled dot-product attention
Computes attention weights from query-key dot products scaled by the square root of key dimension and normalized with softmax.
“Instead of performing a single attention function with dmodel-dimensional keys, values and queries, we found it beneficial to linearly project the queries, keys and values h times with different, learned linear projections to dk, dk and dv dimensions, respectively.”
Multi-head attention
Projects queries, keys, and values into multiple learned subspaces, applies attention in parallel, then concatenates and reprojects the outputs.
“Since our model contains no recurrence and no convolution, in order for the model to make use of the order of the sequence, we must inject some information about the relative or absolute position of the tokens in the sequence.”
Sinusoidal positional encoding
Adds fixed sine and cosine position signals to token embeddings so the model can represent order without recurrence or convolution.
“We trained on the standard WMT 2014 English-German dataset consisting of about 4.5 million sentence pairs.”
Translation and parsing experiments
Trains on WMT English-German and English-French translation data and on Penn Treebank constituency parsing, using beam search, checkpoint averaging, dropout, label smoothing, and Adam with warmup scheduling.
References to read next
Epistemological & authority foundations
Seminal work 2
Standard / benchmark 2
State of the art 2
Methodological & tooling references
Methodological 3
Data or software 1
Passages to read
11 of 11“The dominant sequence transduction models are based on complex recurrent or convolutional neural networks that include an encoder and a decoder.”
This frames the problem the paper is trying to solve and the baseline it aims to replace.
Essential“The fundamental constraint of sequential computation, however, remains.”
This explains why the authors think a different architecture is needed.
“In this work we propose the Transformer, a model architecture eschewing recurrence and instead relying entirely on an attention mechanism to draw global dependencies between input and output.”
This states the architectural shift in a concise form.
“We employ residual connections around each of the sub-layers, followed by layer normalization.”
This identifies a standard stabilization choice used throughout the network.
“We used beam search with a beam size of 4 and length penalty α = 0.6 [38].”
This describes the decoding setup used for the reported translation scores.
“On the WMT 2014 English-to-German translation task, the big transformer model (Transformer (big) in Table 2) outperforms the best previously reported models (including ensembles) by more than 2.0 BLEU, establishing a new state-of-the-art BLEU score of 28.4.”
This is one of the paper’s strongest quantitative results.
Essential“On the WMT 2014 English-to-French translation task, our big model achieves a BLEU score of 41.0, outperforming all of the previously published single models, at less than 1/4 the training cost of the previous state-of-the-art model.”
This shows the model’s efficiency and performance on a second benchmark.
Essential“In row (E) we replace our sinusoidal positional encoding with learned positional embeddings [9], and observe nearly identical results to the base model.”
This ablation suggests the positional encoding choice is not the main driver of performance.
“Our results in Table 4 show that despite the lack of task-specific tuning our model performs surprisingly well, yielding better results than all previously reported models with the exception of the Recurrent Neural Network Grammar [8].”
This supports the claim that the architecture transfers beyond translation.
“The heads clearly learned to perform different tasks.”
This is a qualitative observation from the attention visualizations that supports interpretability claims.
“For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers.”
This is the paper’s final synthesis of the main practical advantage.
EssentialKeywords
Get a Summary of Your Own Paper
Upload a paper and Thesify writes the digest, reading guide and review