Adversarial Text Generation via Sequence Contrast Discrimination

Ke Wang, Xiaojun Wan

Introduction

Text generation is a fundamental task in Natural Language Processing (NLP), yet it remains challenging. Traditional methods like Maximum Likelihood Estimation (MLE) often lead to "exposure bias," where small errors during inference compound over time, resulting in repetitive or nonsensical text. While Generative Adversarial Networks (GANs) have revolutionized image generation by introducing a discriminator to judge realism, their application to text is hindered by the discrete nature of language. Because tokens are discrete, gradients cannot flow directly from a discriminator back to a generator. Current solutions typically rely on Reinforcement Learning (RL) to estimate rewards, but RL-based GANs are notoriously unstable, sensitive to hyperparameters, and computationally expensive.

The SLGAN Framework

To address these challenges, the authors propose SLGAN (Sequence Contrastive GAN). SLGAN departs from the traditional binary "Real vs. Fake" classification paradigm. Instead, it employs a Sequence Contrast Discrimination framework.

The Siamese Discriminator ($G_d$)

The core innovation is the Siamese Discriminator, which is itself a sequence generator rather than a simple classifier. It acts as a "refiner" or "amplifier" that highlights features of realism. When presented with either real text ($x$) or generated text ($y$), it produces a discriminative sequence ($\hat{y}$).

The SLGAN architecture featuring a Siamese Discriminator ($G_d$) that provides sequence-level feedback to the generator ($G$).

Sequence Contrast Loss and Direct Guidance

The discriminator is trained using a contrastive objective: it minimizes the distance between its output for real text and the real text itself (intra-class similarity) while maximizing the distance between its outputs for real and fake text (inter-class contrast).

Crucially, because the discriminator provides a full sequence, the generator ($G$) receives a much richer gradient signal. It can directly compare its output to the discriminator's "refined" version. This direct guidance bypasses the high-variance reward estimation of RL, leading to a more stable training process. The final training objective for the generator is a hybrid loss, combining standard MLE loss for basic linguistic structure with the adversarial sequence contrast loss for high-level realism.

Experimental Setup

The performance of SLGAN was evaluated on two distinct benchmarks:

  1. Synthetic Dataset: Utilizing the Texygen platform, this controlled environment allows for evaluation against a known "oracle" distribution.
  2. Real-World Dataset: The COCO Image Captions dataset was used to test the model's ability to capture the nuances and complexities of human language.

Results and Discussion

SLGAN demonstrates significant improvements in both training stability and output quality compared to state-of-the-art baselines like SeqGAN, LeakGAN, and TextGAN.

Training Stability

One of the most prominent advantages of SLGAN is its convergence behavior. Unlike RL-based models that often exhibit erratic loss patterns, SLGAN's Negative Log-Likelihood (NLL) loss drops rapidly and remains stable throughout the training process.

Learning curves comparing SLGAN's NLL loss against several state-of-the-art baselines, demonstrating superior stability and convergence.

Quality and Diversity

On the COCO dataset, SLGAN achieved superior diversity, as evidenced by its low Self-BLEU scores. Furthermore, human evaluations favored SLGAN in terms of "Topicality" (semantic consistency) and "Overall Quality." The model successfully maintains low perplexity—ensuring grammatical fluency—while producing more creative and less conservative text than MLE-trained models.

Conclusion

SLGAN represents a shift in adversarial text generation by moving from scalar rewards to sequence-level contrastive signals. By avoiding the RL bottleneck, it achieves greater stability and produces higher-quality, more diverse text. Future work will focus on adapting this framework for conditional tasks, such as dialogue systems, and optimizing the computational overhead associated with the Siamese architecture.

Summary updated

Abstract

In this paper, we propose a sequence contrast loss driven text generation framework, which learns the difference between real texts and generated texts and uses that difference. Specifically, our discriminator contains a discriminative sequence generator instead of a binary classifier, and measures the ‘relative realism’ of generated texts against real texts by making use of them simultaneously. Moreover, our generator uses discriminative sequences to directly improve itself, which not only replaces the gradient propagation process from the discriminator to the generator, but also avoids the time-consuming sampling process of estimating rewards in some previous methods. We conduct extensive experiments with various metrics, substantiating that our framework brings improvements in terms of training stability and the quality of generated texts.
BibTeX
@inproceedings{wang2020adversarial,
  author = {Ke Wang and Xiaojun Wan},
  title = {{Adversarial Text Generation via Sequence Contrast Discrimination}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.findings-emnlp.5},
}
Figure