Table 3 explorer

The paper's Table 3 changes one thing at a time in its base model (the number of heads, the size, dropout, label smoothing, the positions) and reports what each change does. We did the same on our tiny model, three times each with different random starts, and recorded what happened.

Paper's row Our variant First step at 95 % Held-out loss What the paper found
Base Base: 4 heads, d_k 16, dropout 0.1, label smoothing 0.1, sine positions 187 (180–200) 0.0632 The reference every other row is compared with.
(A) 1 head, d_k 64 227 (180–260) 0.0658 One head is clearly worse; too many heads are worse again.
(A) 16 heads, d_k 4 207 (200–220) 0.0643 One head is clearly worse; too many heads are worse again.
(C) d_model 32 240 (240–240) 0.0699 Bigger models are better.
(C) d_model 128 180 (160–220) 0.0644 Bigger models are better.
(D) No dropout 193 (160–240) 0.1135 Dropout helps a lot against overfitting.
(D) No label smoothing 200 (180–220) 0.0005 Label smoothing hurts perplexity but improves accuracy and BLEU (section 5.4).
(E) Learned positions instead of sines 193 (180–200) 0.0637 Learned positions give nearly identical results to the sines.

Each variant trained 800 steps (warm-up 200) with seeds 2017, 2018, 2019. “First step” is the first measurement, every 20 steps, at which it translated 95 % of 200 held-out sentences word for word: the mean of the three seeds, with the range in brackets. “Held-out loss” is the plain loss (no smoothing) on those sentences at the end, the mean of the three seeds.

Held-out loss as training goes

Held-out loss during training, mean of three seeds On a logarithmic scale, for the variants: base, D-ls0, D-drop0. 1e−4 0.001 0.01 0.1 1 10 200 400 600 800 step Held-out loss
  • Base
  • (D) No label smoothing
  • (D) No dropout

What our reruns can and cannot say

Our task is easy: every variant ends up translating nearly all held-out sentences. So instead of the final BLEU the paper compares, we measure how fast each variant gets there, and how sure it ends up of the right words. Differences of 20 steps are within what a different random start does, as the ranges show.

Three results stand out. Without label smoothing, the held-out loss falls almost to zero, while every smoothed variant stays near 0.06: smoothing keeps the model unsure on purpose (row D, and the label-smoothing tool). Without dropout, the held-out loss is the highest of all: the model overfits a little, the paper's reason for dropout. And learned positions (row E) do as well as the sine waves, as the paper found.

In the paper (6.2)

“While single-head attention is 0.9 BLEU worse than the best setting, quality also drops off with too many heads.”

An unhandled error has occurred. Reload 🗙

Reconnecting…

Your connection to the Transformers and Attention Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.