Professor Forcing: A New Algorithm for Training Recurrent Networks

Anirudh Goyal, Alex Lamb, Ying Zhang, Saizheng Zhang, Aaron C. Courville, Yoshua Bengio

TL;DR

Professor Forcing is a training algorithm for Recurrent Neural Networks (RNNs) that uses an adversarial framework to bridge the gap between training and inference. By employing a discriminator to ensure the model's internal dynamics look the same whether it's being fed ground-truth data or its own predictions, the method significantly improves the quality and stability of long-term sequence generation.

The Problem: Exposure Bias in Teacher Forcing

The standard way to train generative RNNs is a technique called Teacher Forcing. During training, the model is given the "ground truth" previous character or note as input to predict the next one. However, at test time (inference), the ground truth isn't available. The model must instead rely on its own previous—and potentially erroneous—predictions.

This creates a discrepancy known as exposure bias. Small errors during generation compound over time, leading the model into "uncharted territory" (hidden states) it never saw during training. This often results in the model "hallucinating" or generating gibberish. While "Scheduled Sampling" (gradually replacing ground truth with model predictions during training) was a popular fix, it is a biased estimator and doesn't always converge to the correct distribution.

Methods: Enter the "Professor"

The authors introduce Professor Forcing, which borrows the "Generator vs. Discriminator" logic from Generative Adversarial Networks (GANs) to align the training and inference distributions.

Architecture of Professor Forcing
  1. The Generator: A standard RNN (the authors use GRUs) that operates in two modes: Teacher Forcing (clamped to ground truth) and Free-running (sampling from its own predictions).
  2. The Discriminator (The "Professor"): A bidirectional RNN that examines the sequences of hidden states and outputs produced by the Generator. Its job is to determine whether a given sequence came from the Teacher Forcing mode or the Free-running mode.
  3. The Objective: The Generator is trained with a dual objective. It must maximize the likelihood of the training data (standard Negative Log-Likelihood) and it must "fool" the discriminator by making its hidden state dynamics in Free-running mode indistinguishable from those in Teacher Forcing mode.

Essentially, the "Professor" (discriminator) forces the "Student" (generator) to behave the same way during practice as it does during the exam.

Key Insights and Ideas

  • Hidden State Divergence: Using T-SNE visualizations, the authors proved that in standard Teacher Forcing, the hidden states during sampling occupy a completely different region of space than during training. Professor Forcing successfully collapses these two regions into one.
  • Acting as a Regularizer: Surprisingly, the adversarial objective doesn't just help with sampling; it improves test likelihood (NLL) on benchmarks like Penn Treebank. This suggests that forcing the dynamics to be consistent acts as a powerful form of regularization.
  • Long-Term Robustness: The method is particularly effective when the sequences to be generated at test time are much longer than those seen during training (e.g., training on 50 steps of handwriting but generating 1000).
  • Discrete Variable Advantage: Unlike standard GANs, which struggle with discrete data (like text) because you cannot backpropagate through a discrete sample, Professor Forcing operates on the hidden states, which are continuous. This allows it to train generative models for text and music more easily.

Key Results

The authors evaluated the algorithm across several diverse generative tasks, including language modeling, handwriting generation, and vocal synthesis.

  • Sequential MNIST: Generating handwritten digits pixel-by-pixel (treating the image as a sequence). The model achieved a test NLL of 79.58, outperforming several complex generative models like DRAW and DARN, and coming close to the state-of-the-art PixelRNN.
Sequential MNIST samples generated by the model
  • Language Modeling: On character-level Penn Treebank, Professor Forcing achieved a validation BPC (bits-per-character) of 1.48, compared to 1.50 for the baseline.
  • Human Evaluation (Handwriting): In a blind study for handwriting generation (IAM-OnDB), humans preferred Professor Forcing samples over Teacher Forcing samples by a massive margin (roughly 77% of the time).
  • Vocal Synthesis: Human annotators gave Professor Forcing samples of raw audio waveforms an average quality score of 2.20/3.0, compared to 1.30/3.0 for the baseline.

Limitations and Future Work

While powerful, Professor Forcing comes with trade-offs:

  • Computational Overhead: Training the discriminator (a bidirectional RNN) adds significant computational cost. The authors noted that training took about 3 times longer than standard Teacher Forcing.
  • Sequence Length Sensitivity: The authors found no significant benefit when training on very short sequences (less than 100 steps) for certain tasks like speech synthesis.
  • Word-Level Performance: Interestingly, the method did not show improvements on word-level language modeling, possibly because long-term structural consistency is less of a bottleneck there than at the character or pixel level.

Future directions suggest that combining Professor Forcing with architectures like PixelRNN could be a promising, albeit computationally expensive, area for further research.

Summary updated

BibTeX
@inproceedings{goyal2016professor,
  author = {Anirudh Goyal and Alex Lamb and Ying Zhang and Saizheng Zhang and Aaron C. Courville and Yoshua Bengio},
  title = {{Professor Forcing: A New Algorithm for Training Recurrent Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2016},
  url = {https://openreview.net/forum?id=H1NrnObubS},
}
Figure