On the path Attention paperDropout, as the paper used it, against learning the training sentences by heart.
Learning by heart
A network with millions of weights can fit its training data almost perfectly, noise and accidents included, and then do worse on data it has not seen: overfitting. Regularisation is everything done to prefer the solution that carries over: limits on the weights, noise in training, more data, or stopping before the fit becomes too close.
The common kinds
Weight decay adds a penalty for large weights to the loss, or shrinks every weight a little at each step, so the network uses many small weights rather than a few large ones. Early stopping watches the loss on held-out data and stops when it stops falling. Data augmentation shows the network the same examples changed in ways that should not matter. And dropout (Srivastava and colleagues, 2014) adds noise inside the network itself.
Dropout
During training, dropout sets each number of a vector to 0 with probability p, a new random choice at every step, and multiplies the numbers it keeps by 1/(1 − p) so that their sum stays the same on average. At test time it does nothing. No unit can count on any particular other being there, so the network cannot build fragile arrangements of a few units; it learns more redundant, sturdier features, a little like training many thinned networks that share their weights and averaging them.
On the path Attention paper
In the paper. The Transformer uses two regularisers (section 5.4). Dropout with p = 0.1 is applied to the output of every sublayer before it is added to the residual, and to the sums of the embeddings and position encodings (the big English–German model used 0.3, the English–French one 0.1). The other is label smoothing. Without dropout the base model was clearly worse on the development set (table 3, row D):
| Dropout p | Perplexity | BLEU |
|---|---|---|
| 0.0 | 5.77 | 24.6 |
| 0.1 (base) | 4.92 | 25.8 |
| 0.2 | 4.95 | 25.5 |
Test yourself
Why are the kept numbers multiplied by 1/(1 − p)?
So that the vector’s sum stays the same on average; at test time, when nothing is dropped, the next layer then sees numbers of the same size as in training.
What does dropout do at test time?
Nothing: every number is kept and none is scaled.
Where does the Transformer apply dropout?
To each sublayer’s output before the residual addition, and to the sums of embeddings and position encodings, with p = 0.1 in the base model.
Where it leads
Kept in this browser only, never sent.
Paths through it
- Attention paperstep 15 of 17Follow this path