Abstract: Scheduled sampling is a technique for avoiding one of the known problems in sequence-to-sequence generation: exposure bias. It consists of feeding the model a mix of the teacher forced embeddings and the model predictions from the previous step in training time. The technique has been used for improving the model performance with recurrent neural networks (RNN). In the Transformer model, unlike the RNN, the generation of a new word attends to the full sentence generated so far, not only to the last word, and it is not straightforward to apply the scheduled sampling technique. We propose some structural changes to allow scheduled sampling to be applied to Transformer architecture, via a two-pass decoding strategy. Experiments on two language pairs achieve performance close to a teacher-forcing baseline and show that this technique is promising for further exploration.
Introduction
Most sequence-to-sequence models are trained using Teacher Forcing, where the model predicts the next token based on the ground-truth ("gold") history. However, during inference, the model must rely on its own previous, potentially erroneous predictions. This discrepancy, known as exposure bias, can lead to compounding errors where a single mistake early in a sequence causes the entire output to derail.
While Scheduled Sampling—gradually replacing gold tokens with model predictions during training—effectively mitigates this in Recurrent Neural Networks (RNNs), it is difficult to apply to Transformers. Because Transformers process sequences in parallel rather than step-by-step, swapping a gold token for a prediction is not a simple sequential operation.
Methodology: The Two-Pass Decoder
To overcome the architectural constraints of the Transformer, this paper proposes a two-pass decoding strategy. This approach allows the model to "see" its own potential errors before the final training step.
As illustrated in Figure 1, the process involves three main stages:
- Pass One (The "Sneak Peek"): The decoder performs a standard pass using teacher forcing to generate predicted probability distributions for every position in the sequence.
- The Mix: For each position, the model decides (based on a probability schedule) whether to keep the gold token or use the prediction from Pass One. The authors explored several mixing strategies, including Argmax (hard choice), Top-k Mix (weighted average of top embeddings), and Gumbel Softmax (differentiable sampling).
- Pass Two (The Actual Training): The decoder runs a second time, conditioning on the mixed sequence. The final loss is calculated based on the output of this second pass.
Experimental Results
The researchers evaluated the approach on two benchmarks: IWSLT 2017 German–English (DE–EN) and the Kyoto Free Translation Task Japanese–English (JA–EN).
As shown in Figure 3, the choice of mixing strategy is critical. The Gumbel Softmax mix outperformed the teacher-forcing baseline on the JA–EN task, reaching 20.87 BLEU compared to the baseline's 19.46. Conversely, using a simple Argmax (hard choice) led to a significant performance drop (e.g., from ~29.6 to ~20.6 BLEU on DE–EN), suggesting that "soft" mixtures provide a more useful gradient signal for the model to learn from its mistakes.
Discussion and Key Insights
- The Parallelism Paradox: The Transformer's parallel nature makes it "blind" to its own errors within a single pass. The two-pass method successfully introduces the necessary noise of model predictions while maintaining the Transformer's core logic.
- Backpropagation: Interestingly, the authors found that backpropagating through the model's decisions in the first pass actually degraded performance. Stability was higher when only backpropagating through the second pass.
- Computational Trade-offs: The primary limitation is the increased computational cost. Since the decoder must perform two passes, training time for the decoder portion of the model effectively doubles.
Conclusion
This two-pass strategy demonstrates that scheduled sampling can be successfully adapted for Transformer architectures to combat exposure bias. While it introduces additional training overhead, the gains in translation quality—particularly in linguistically challenging pairs like Japanese-English—suggest it is a promising direction for making self-attentive models more robust.
Summary updated