Training, big
×The same training from scratch for the big model, : 300,000 steps, 3.5 days on 8 GPUs.
Next-token prediction
In words
At every position the model gives each token of the vocabulary a probability of coming next; the loss is the negative logarithm of the probability it gave the token that does come next, averaged over the sequence.
: the token at position ; : the probability the model, reading the tokens before it, gave that token; : the sequence length.
Here the tokens before each target are the whole source sentence and the translation so far, and with label smoothing the target is not the next token alone: the equation above is the plain form.
- Steps
- 300,000
- Batch
- 25,000 source and 25,000 target tokens
- Learning rate
- warm-up over 4,000 steps, then
- Dropout
- 0.3
- Hardware
- 8 P100
Not disclosed Epochs · Number format
Why
Label smoothing hurts perplexity, as the model learns to be more unsure, but improves accuracy and BLEU. Vaswani et al. 2017, §5.4, p. 8
Architecture at this stageThe model as drawn, with its dropout gates active: they are training-only.
What the terms meanLabel smoothing · Perplexity · BLEU
- Label smoothing
- The training target keeps most of the probability on the correct token and spreads ε = 0.1 of it over the vocabulary, so the model is never pushed to full certainty. Vaswani et al. 2017, §5.4, p. 8
- Perplexity
- The exponential of the average loss per token: the number of tokens the model is, in effect, choosing among.
- BLEU
- A score of how many word sequences a translation shares with reference translations.
All settings12
- Data
- WMT 2014 English–German, about 4.5 million sentence pairs; byte-pair encoding with a shared source–target vocabulary of about 37,000 tokens
- Batch
- About 25,000 source and 25,000 target tokens, sentence pairs batched by approximate length
- Context
- Sentences up to 256 tokens: max_length = 256 in the code released after the paper, applied in a data reader that is not pinned; the paper states no length
- Objective
- Cross-entropy on each next target token, given the source and the target’s earlier tokens, with label smoothing ε = 0.1
- Optimizer
- Adam with β₁ = 0.9, β₂ = 0.98, ε = 10⁻⁹
- Learning rate
- d_model^−0.5 · min(step^−0.5, step · 4000^−1.5): linear warm-up over 4,000 steps, then inverse square root of the step
- Hardware
- One machine with 8 NVIDIA P100 GPUs
- Trainable
- Every parameter of the model
- Steps
- 300,000, 1.0 s each: 3.5 days
- Tokens
- About 7.5 billion target tokensderivedSteps times the batch’s target tokens (300,000 × about 25,000); the source side adds as many again. The paper states the steps and the batch, not this product.
- Peak learning rate
- About 4.9 × 10⁻⁴, at step 4,000derived1024^−0.5 · 4000^−0.5 from the schedule of §5.3 with d_model = 1,024.
- Dropout
- 0.3 for English–German (0.1 for English–French)
Sources10
- Vaswani et al. 2017, p. 7Data, Batch, Optimizer, Learning rate, Hardware, Trainable, Steps, Tokens, Peak learning rate
- tensor2tensor/models/transformer.py, line 274Context
- Vaswani et al. 2017, p. 8Objective, Dropout
- Vaswani et al. 2017, p. 3Objective
- tensor2tensor/utils/modality.py, lines 151–155Objective
- tensor2tensor/models/transformer.py, line 288Objective
- tensor2tensor/models/transformer.py, line 277Optimizer
- tensor2tensor/models/transformer.py, lines 285–286Optimizer
- Vaswani et al. 2017, p. 9Dropout
- tensor2tensor/models/transformer.py, line 317Dropout