Decoder: 6 layers

Add encoder–decoder attention output

×

Add the mechanism’s update to the residual stream element by element.

v=sn+DPdrop(Δcross){\htmlData{light=cross-sum cross-add}{{\htmlClass{vl-stream-v}{v}}}}={\htmlData{light=after-self self-norm}{s_n}}+D_{\mathrm{P_{\mathrm{drop}}}}({\htmlData{light=cross-update cross-attention}{\Delta_{\mathrm{cross}}}})
in
sns_n [B batch, T target positions, 512 d]DPdrop(Δcross)D_{\mathrm{P_{\mathrm{drop}}}}(\Delta_{\mathrm{cross}}) [B batch, T target positions, 512 d]
out
vv [B batch, T target positions, 512 d]
Sources

In codex + tf.nn.dropout(y, …) · 60

Open pinned code ↗

Direct evidence

Post-norm: each sublayer output is dropped out, added to its input and layer-normalized.

transformer.py 59–61 ↗ · tensorflow/tensor2tensor @ 0c66117d4297

Excerpt
    def residual_fn(x, y):
      return common_layers.layer_norm(x + tf.nn.dropout(
          y, 1.0 - hparams.residual_dropout))

Incoming transform evidence

Post-norm: each sublayer output is dropped out, added to its input and layer-normalized.

transformer.py 59–61 ↗ · tensorflow/tensor2tensor @ 0c66117d4297

Excerpt
    def residual_fn(x, y):
      return common_layers.layer_norm(x + tf.nn.dropout(
          y, 1.0 - hparams.residual_dropout))