Text Generation Based on Generative Adversarial Nets with Latent Variable

Heng Wang, Zengchang Qin, Tao WanarXiv 2017

TL;DR

The paper introduces VGAN, a text generation model that combines the strengths of Variational Autoencoders (VAEs) and Generative Adversarial Networks (GANs). By incorporating high-level latent random variables into an LSTM-based generator, VGAN successfully mitigates the common GAN issue of "mode collapse" (generating repetitive, highly similar text) and outperforms strong baselines like SeqGAN on multiple benchmark datasets.

What Problem Does This Paper Address?

Generating realistic, diverse text automatically remains a significant challenge in natural language processing. Traditional Recurrent Neural Network Language Models (RNNLMs) suffer from exposure bias because they are trained to predict the next word given ground-truth history, but must generate text from their own historical predictions during inference.

While GANs offer a solution by evaluating text at the sentence level via a discriminator, they face two major hurdles when applied to text:

  1. Discreteness: Text consists of discrete tokens, making it impossible to backpropagate gradients directly from the discriminator to the generator.
  2. Mode Collapse: Standard RNN-based generators are entirely deterministic in their state transitions, meaning they struggle to capture the complex, multimodal distributions of highly structured text. Consequently, text GANs often fall into a trap of emitting very similar, repetitive sentences.

Methods

The authors propose VGAN, which integrates a VAE architecture directly into the adversarial training loop to inject useful stochasticity into the generation process.

1. The Generator ($G_\theta$)

Instead of a standard LSTM, the generator embeds a VAE at every single timestep. Crucially, unlike a standard VAE which uses a static Gaussian prior, VGAN's prior distribution at timestep $t$ is conditioned on the previous hidden state ($h_{t-1}$). This allows the model to better capture sequential dependencies and temporal structures. The approximate posterior distribution is conditioned on both the current hidden state ($h_t$) and the current input ($x_t$). The reparameterization trick is applied to ensure the network remains differentiable during pre-training.

The architecture of the VGAN generator, combining LSTM states with a VAE at each timestep.

2. The Discriminator ($D_\phi$)

The discriminator is a Convolutional Neural Network (CNN) designed for text classification. It applies multiple convolution filters over word windows, uses max-over-time pooling to extract the most salient features, and passes them to a fully connected layer that outputs the probability of the text being real or machine-generated.

3. Adversarial Training via Policy Gradient

To bypass the discrete gradient bottleneck, the authors frame text generation as a reinforcement learning problem. The generator acts as an agent, the current generated tokens act as the state, and picking the next word is the action. Because the discriminator can only evaluate a complete sentence, the authors use Monte Carlo (MC) search to roll out and estimate rewards for incomplete, intermediate sentences.

Fig. 3. The training process of the generator via policy gradient. The dotted line denotes sampling a token from the output distribution. The sampled token is as the input at the next time. START denotes a start token.

Datasets

The model was evaluated on three distinct text benchmarks:

  • Taobao Reviews: A dataset crawled from taobao.com containing 400,000 sentences (90/10 train/test split).
  • Amazon Food Reviews: A dataset containing 300,000 sentences (90/10 train/test split).
  • Penn Treebank (PTB): A standard, relatively small benchmark consisting of 42,068 training sentences and 3,370 test sentences.

Key Insights and Ideas

  • Stochasticity Defeats Mode Collapse: Introducing high-level latent variables via the VAE breaks the strict determinism of standard RNN generators. This allows the model to learn complex, multimodal data distributions, resulting in more diverse text generation.
  • History-Dependent Priors: Making the VAE's prior distribution dependent on the previous LSTM hidden state ($h_{t-1}$) provides a powerful mechanism for tracking long-term sequential context, which is vital for coherent text generation.

Key Results

The authors evaluated performance using both the BLEU-2 score (measuring similarity to human text) and Negative Log-Likelihood (NLL). VGAN consistently outperformed RNNLM, SeqGAN, and its own pre-trained baseline (VGAN-pre) across all datasets.

  • Lower NLL (Better Distribution Fit):
  • Taobao: VGAN achieved an NLL of 191, outperforming SeqGAN (212) and RNNLM (219).
  • Amazon: VGAN reached 408, compared to SeqGAN's 467.
  • PTB: VGAN hit 423, significantly lower than SeqGAN's 490.
  • Higher BLEU-2 Scores (Better Text Quality): For 1,000 generated sentences, VGAN achieved a BLEU-2 score of 0.969 on Taobao, 0.868 on Amazon, and 0.695 on PTB, systematically beating SeqGAN and RNNLM across the board.

Limitations and Future Work

While VGAN demonstrates clear improvements, the authors note areas for future exploration:

  • Alternative RL Algorithms: They plan to experiment with Deep Deterministic Policy Gradient (DDPG) methods to optimize the generator more effectively than standard policy gradients.
  • Discriminator Architectures: The authors intend to swap out the CNN discriminator for more sequential architectures, such as Recurrent Convolutional Neural Networks (RCNNs) or standard RNNs, to see if tracking temporal dynamics in the discriminator further improves text quality.

Summary updated

BibTeX
@misc{wang2017text,
  author = {Heng Wang and Zengchang Qin and Tao Wan},
  title = {{Text Generation Based on Generative Adversarial Nets with Latent Variable}},
  year = {2017},
  eprint = {1712.00170},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1712.00170},
}
Figure