Abstract
Neural text generation models are often autoregressive language models or seq2seq models. These models generate text by sampling words sequentially, with each word conditioned on the previous word, and are state-of-the-art for several machine translation and summarization benchmarks. These benchmarks are often defined by validation perplexity even though this is not a direct measure of the quality of the generated text. Additionally, these models are typically trained via maximum likelihood and teacher forcing. These methods are well-suited to optimizing perplexity but can result in poor sample quality since generating text requires conditioning on sequences of words that may have never been observed at training time. We propose to improve sample quality using Generative Adversarial Networks (GANs), which explicitly train the generator to produce high quality samples and have shown a lot of success in image generation. GANs were originally designed to output differentiable values, so discrete language generation is challenging for them. We claim that validation perplexity alone is not indicative of the quality of text generated by a model. We introduce an actor-critic conditional GAN that fills in missing text conditioned on the surrounding context. We show qualitatively and quantitatively, evidence that this produces more realistic conditional and unconditional text samples compared to a maximum likelihood trained model.
Introduction
Traditional neural text generation models, such as those used in machine translation or summarization, typically operate autoregressively. They generate text one token at a time, conditioned on the preceding sequence. While effective, this approach suffers from two primary limitations: exposure bias and the perplexity trap. Exposure bias arises from "teacher forcing" during training, where the model is always provided with ground-truth history. At inference, however, the model must rely on its own potentially erroneous previous outputs, leading to error accumulation and a lack of long-term coherence. Furthermore, these models are optimized for validation perplexity, a metric that does not always correlate with human-perceived quality or semantic coherence.
Generative Adversarial Networks (GANs) offer a potential solution by explicitly training a generator to produce high-quality samples. However, applying GANs to discrete text is difficult because the non-differentiable nature of word tokens prevents standard backpropagation. MaskGAN addresses these challenges by reframing text generation as an in-filling task within an actor-critic reinforcement learning framework.
Methodology: The In-filling Task
MaskGAN shifts the paradigm from simple sequential prediction to a "fill-in-the-blank" task. In this setup, portions of a text sequence are masked, and the model is tasked with filling these blanks such that the resulting sequence is indistinguishable from real data.
The architecture consists of a seq2seq (encoder-decoder) setup. The encoder processes the known context, while the decoder generates the missing tokens autoregressively. To handle the discrete nature of text, the authors employ an Actor-Critic GAN framework:
- Generator (Actor): Learns to fill blanks realistically.
- Discriminator (Critic): Evaluates filled-in tokens. Crucially, the discriminator is provided with the original context to ensure the generated text is semantically appropriate for its specific environment.
- Reinforcement Learning: The model uses Policy Gradients (REINFORCE) where the generator receives rewards from the discriminator. An actor-critic setup is used to estimate future rewards, significantly reducing variance during training.
Experimental Results
The model was evaluated on the Penn Treebank (PTB) and IMDB Movie Reviews datasets. A key finding was the disconnect between perplexity and quality: MaskGAN models often exhibited higher (worse) validation perplexity than standard Maximum Likelihood Estimation (MLE) models, yet produced qualitatively superior samples.
In human evaluations, MaskGAN was significantly preferred over MLE benchmarks. On the IMDB dataset, human raters preferred MaskGAN's overall quality at a rate of 58.0%, compared to 40.3% for the MLE model. Additionally, when using a pretrained language model to score sample realism, MaskGAN outputs achieved a perplexity of 108.3, far lower (better) than the 273.1 achieved by the MLE benchmark, indicating that MaskGAN's samples more closely resemble natural human language.
Conclusion and Future Work
MaskGAN demonstrates that framing text generation as a conditional in-filling task provides a more granular training signal for GANs, leading to improved sample quality and coherence. While the model significantly outperforms traditional MLE and previous GAN approaches like SeqGAN, it still faces challenges such as mode collapse and occasional grammatical glitches at the boundaries of filled-in text. Future research may involve integrating attention-based architectures like Transformers to better capture long-range dependencies and further enhance global coherence.
Summary updated