1706.03762 arXiv
Attention Is All You Need
- L09
- L138
- L238
- L333
97 concepts, grouped into 8 themes that follow the paper's own order.
- Why recurrence had to goSets up the task the paper cares about — turning one sequence into another — and the models that dominated it.
- The shape of the modelThe outline of the Transformer before any of the math.
- How attention is computedThe one operation the model is built from. Attention maps a query and a set of key-value pairs to a weighted sum of the values, with the weights coming from how well the query matches…
- Where attention is used in the modelThe same attention function appears in three places.
- Position, embeddings, and the feed-forward layerThe parts of a layer that act on each position on its own.
- Why self-attention, compared to the alternativesThe paper's argument for the swap, made on three criteria: computation per layer, how many operations must run in sequence rather than in parallel, and the longest path a signal…
- Training the thingEverything needed to reproduce a trained model: the translation datasets, subword vocabularies built with byte-pair encoding or word pieces, batching by sequence length, and eight GPUs…
- What the numbers showHow outputs are produced at test time and what they score.
The 19 concepts the paper's argument rests on, of 97 in all.
- The TransformerThe architecture this paper proposes: an encoder-decoder built entirely from stacked self-attention and position-wise feed-forward layers, with no recurrence and no convolutions.
- Encoder-decoder architectureA two-part model design: an encoder turns the input sequence into continuous representations, and a decoder generates the output sequence from them, one symbol at a time.
- Sequential computation bottleneck of RNNsBecause an RNN's hidden state at position t depends on the hidden state at position t-1, positions within one training example cannot be computed in parallel.
- Attention mechanism (query, key, value)A function that maps a query vector and a set of key-value vector pairs to an output: a weighted sum of the values, with weights set by how well the query matches each key.
- Scaled dot-product attentionThe Transformer's attention: dot the query with every key, divide by $\sqrt{d_k}$, softmax the scores, and use them to weight the values.
- Multi-head attentionRunning $h$ attention functions in parallel on different learned linear projections of the queries, keys, and values, then concatenating and projecting the results.
- Self-attention (intra-attention)Attention where the queries, keys, and values all come from the same sequence, so every position can gather information from every other position in that sequence.
- Encoder stackThe Transformer's encoder: $N=6$ identical layers, each containing a multi-head self-attention sub-layer followed by a position-wise feed-forward sub-layer.
- Decoder stackThe Transformer's decoder: $N=6$ identical layers, each with masked self-attention, attention over the encoder output, and a feed-forward sub-layer.
- Positional encodingVectors added to the input embeddings that inject information about each token's position, since the model itself has no recurrence or convolution to sense order.
- Three criteria for comparing layer typesSection 4's framework: judge self-attention, recurrent, and convolutional layers by per-layer complexity, minimum sequential operations, and maximum path length.
- Byte-pair encoding (BPE)A subword tokenization scheme that builds a vocabulary by repeatedly merging the most frequent pair of symbols, so rare words split into known pieces.
- BLEU scoreThe standard automatic metric for translation quality: n-gram overlap precision against reference translations with a penalty for overly short outputs.
- Transformer training recipeThe complete set of choices the paper used to train its models: data, batching, hardware, optimizer schedule, and regularization.
- Warmup learning-rate scheduleThe learning rate rises linearly for the first warmup_steps steps, then decays as the inverse square root of the step number, all scaled by the model width.
- Label smoothingA training target modification: instead of putting probability 1 on the correct token, the target gives it 1 - eps and spreads eps = 0.1 over other tokens, penalizing overconfidence.
- Beam searchA decoding procedure that keeps the k best partial output sequences at each step instead of committing to a single best token; the paper uses beam size 4.
- Model variation ablations (Table 3)Experiments that change one component of the base model at a time and measure the effect on English-to-German translation, to see which parts matter.
- English constituency parsingThe task of producing a sentence's syntactic tree — nested phrases like noun phrases and verb phrases — used as a generalization test for the Transformer beyond translation.
Every figure, table and equation, rewritten so it can be read on its own — each term and number in it defined.
- Figure 1 — The two-stack data pathThe figure shows the entire model in one picture: two towers of identical layers, each layer built only from attention and a position-wise feed-forward network.
- Figure 2 — Attention as a wiring diagramThe figure draws the paper's attention math as data flow.
- Table 1 — Layer types by cost and path lengthThe table is the paper's argument for replacing recurrence with self-attention.
- Table 2 — Translation quality against training costOn the WMT 2014 newstest2014 benchmarks, the big Transformer reports the best English-to-German BLEU in the table: 28.4, more than 2.0 BLEU above every earlier model listed, ensembles…
- Table 3 — One-knob-at-a-time ablationsTable 3 changes one design choice of the base Transformer at a time and reports the effect on English-to-German development-set quality.
- Table 4 — The parsing leaderboardTrained on the ~40K-sentence WSJ treebank with almost no task-specific tuning, a 4-layer Transformer reaches 91.3 F1 on WSJ Section 23.
- Figure 3 — Heads tracking "making … more difficult"This is one query word's attention pattern in a single encoder self-attention layer, drawn as lines running from that word to the positions it attends to, each line colored by the head…
- Figure 4 — Two heads that resolve "its"Two different attention heads in the same encoder layer put almost all of the word "its" attention on two different words — head 5 on "Law", head 6 on "application".
- Figure 5 — Two heads, one sentenceTwo attention heads from the same encoder self-attention layer, run on the same sentence, produce visibly different attention patterns.
- The scaled dot-product attention formulaThis is the paper's whole attention function in one line: score every query against every key with a dot product, shrink the scores by $\sqrt{d_k}$, softmax them into weights, and…
- Attention in h parallel subspacesInstead of one attention function over full-width 512-dimensional vectors, the Transformer runs $h=8$ attention functions in parallel.
- The per-position feed-forward blockEquation (2) defines the second sub-layer in every encoder and decoder layer: a two-layer MLP with a ReLU in between, applied to each position's vector on its own.
- Position as a bank of sinusoidsA model with no recurrence and no convolution has no idea what order its tokens are in.
- The warmup-then-decay learning rateEquation (3) makes the learning rate a function of the training step rather than a constant.
The main tour walks the paper from problem to verdict, in the order the paper tells it.
- Most of the model's numbers are consequences, not choicesThe base model reads like a list of settings: $d_{model}=512$, $h=8$, $d_k=d_v=64$, $N=6$, 4000 warmup steps, a 37000-token vocabulary.
- A few design claims are measured, several rest on one hand-picked example, and some are only assertedSort the paper's design claims by what sits under them and they fall into three piles of very different weight.
- Three parts of the model exist only to undo damage the design did to itselfRemoving recurrence removed things that came with it for free.
- Positions mix in exactly three places; everything else touches one position at a timeGo through the model part by part and ask of each one whether it can see any position but its own.
- The paper picks the faster scoring rule, patches it with one divisor, and then reports a number that questions the ruleThe compatibility function is chosen for speed, defended with a hedge, and then quietly undercut by one of the paper's own ablation rows.
- Of the three criteria the paper sets up, only one gives self-attention an unconditional winSection 4 names three criteria and table-1 prices them, which reads as a clean sweep.
- Much of the training recipe is a set of numbers whose mechanisms live in other papersRead Section 5 for what it defines and it defines almost nothing.
- The paper reports on three scales that disagree, and accepts losing on one of themNothing in the results is a single number improving.
- The generalization claim rests on one task where everything except the model is borrowedConstituency parsing is the paper's only evidence that the architecture works outside translation, since translation — on English-German and English-French — is the whole of the rest.