Training

Pinned sources arXiv:1706.03762v7 §5 · tensorflow/tensor2tensor v1.0.14 @ 0c66117 · English–German runs

  1. Training, base≈ 2.5B256NTPlabel smoothing 0.1What trains: all
  2. Transformer, base
  3. Training, big≈ 7.5B256NTPlabel smoothing 0.1What trains: all
  4. Transformer, big
  • tokens, log scale
  • derived: computed from stated numbers
  • checkpoint

Training, big

×

The same training from scratch for the big model, dmodel=1,024d_\text{model} = 1{,}024: 300,000 steps, 3.5 days on 8 GPUs.

Next-token prediction

L=−1T∑i=2T+1log⁡Pi[ti]\mathcal L=-\frac1T\sum_{i=2}^{T+1}\log P_i[t_i]
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.

tit_i: the token at position ii; Pi[ti]P_i[t_i]: the probability the model, reading the tokens before it, gave that token; TT: 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 1/step1/\sqrt{\text{step}}
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

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