Dropout on the encoder input

×

Training only, on the encoder input; P_drop = 0.1 in the base model.

x~0=r⊙x01−Pdrop\tilde{x}_0=\frac{r\odot x_0}{1-P_{\mathrm{drop}}}
ri∼Bernoulli⁡(1−Pdrop)r_i\sim\operatorname{Bernoulli}(1-P_{\mathrm{drop}})
in
x0x_0 [B batch, S source positions, 512 d]
out
x~0\tilde{x}_0 [B batch, S source positions, 512 d]

Training only: in evaluation it returns its input unchanged.

Explanation

Acts between Encoder input and Encoder: 6 layers.

Dropout is training regularization: randomly removing contributions reduces reliance on particular features or attention connections. During training, elements are independently retained with probability 1−Pdrop1-P_{\mathrm{drop}} and retained values are divided by 1−Pdrop1-P_{\mathrm{drop}}. Evaluation returns the input unchanged.

Sources

Direct evidence

Dropout with the residual rate is applied to the encoder input and the decoder input.

transformer.py 65–66 ↗ · tensorflow/tensor2tensor @ 0c66117d4297

Excerpt
    encoder_input = tf.nn.dropout(encoder_input, 1.0 - hparams.residual_dropout)
    decoder_input = tf.nn.dropout(decoder_input, 1.0 - hparams.residual_dropout)