Unlocking the Power of GANs in Non-Autoregressive Text Generation

Da Ren, Qing Li, Li, Qing · DOI

Abstract

Generative Adversarial Networks (GANs) have been studied in text generation to tackle the exposure bias problem. Despite their remarkable development, they adopt autoregressive structures so suffering from high latency in both training and inference stages. Although GANs have potential to support efficient generation by adopting non-autoregressive (NAR) structures, their explorations in NAR models are extremely limited. In this work, we conduct pioneering study of building language GANs based on NAR structures. We identify two issues that constrain the performance of GAN-based NAR models. Firstly, existing methods of incorporating latent variables provide highly similar representations which cannot describe the diversity of different words in sentences. We tackle this problem by proposing Position-Aware Self-Modulation, providing more diverse and effective representations. Secondly, the attention mechanism in Transformer cannot accurately build word dependencies in the unstable training of GANs, and we adopt Dependency Feed Forward Network to enhance the model capacity in dependency modeling. Armed with these two facilities, we propose a GAN-based NAR model, Adversarial Non-autoregressive Transformer (ANT). The experimental results demonstrate that ANT can achieve comparable performance with mainstream models in a single forward pass and has great potential in various applications like latent interpolation and semi-supervised learning.

Introduction

The landscape of natural language processing has long been dominated by autoregressive (AR) models like GPT, which generate text sequentially, one token at a time. While effective, this sequential nature introduces significant latency, making real-time applications challenging. Non-autoregressive (NAR) models offer a solution by generating all tokens in parallel, but they often struggle with the "multi-modality" problem, where the model fails to capture the complex dependencies between words, leading to incoherent outputs.

Generative Adversarial Networks (GANs), which have revolutionized image synthesis with their parallel generation capabilities, present a promising avenue for NAR text generation. However, applying GANs to NAR text models has been hindered by two primary challenges: representation collapse, where latent variables fail to provide diverse signals for different word positions, and unstable dependency modeling during the volatile adversarial training process.

The Adversarial Non-autoregressive Transformer (ANT)

To overcome these hurdles, we introduce the Adversarial Non-autoregressive Transformer (ANT). The framework consists of three main components: an Aligner, a Generator, and a Discriminator. The Aligner maps discrete text into a continuous latent space, enabling the use of the reparameterization trick for gradient flow. The Generator then produces text in a single parallel pass, while the Discriminator evaluates the quality and coherence of the generated sequences.

The ANT architecture, highlighting the Aligner, Generator, and Discriminator modules.

Overcoming Representation Collapse

A significant issue in NAR GANs is that a single global noise vector $z$ often results in nearly identical hidden representations for every position in a sentence. This "representation collapse" prevents the model from distinguishing between different syntactic roles (e.g., subject vs. object).

We propose Position-Aware Self-Modulation to address this. Instead of a uniform transformation, ANT employs unique mapping layers for each position. This ensures that the global latent signal is modulated into position-specific representations, allowing the model to generate diverse and contextually appropriate words across the entire sequence.

Comparison of representation similarity: (a) standard latent mapping showing high similarity (collapse), and (b) ANT's position-aware modulation showing distinct, diverse representations.

Stabilizing Word Dependencies

Standard Transformer architectures rely on self-attention to model word relationships. However, the dynamic and often unstable nature of GAN training can cause "soft" attention weights to fluctuate wildly, leading to grammatical breakdowns. To provide a more robust structural anchor, we introduce the Dependency Feed Forward Network (Dependency FFN). This module explicitly incorporates dependencies by conditioning the current word's state on the previous word's state, providing a stable inductive bias that complements the attention mechanism.

Experimental Evaluation

ANT was evaluated on benchmarks including COCO Image Caption, EMNLP 2017 News, and the Yelp dataset.

  • Efficiency: ANT achieves a remarkable 14.75x speedup over standard autoregressive Transformers, demonstrating the power of parallel generation.
  • Quality: On the COCO dataset, ANT achieved a Frechet Embedding Distance (FED) of 0.013, outperforming several established AR language GANs and other NAR baselines.
  • Latent Space Properties: As a GAN, ANT inherits a smooth latent space. This allows for semantic interpolation, where "morphing" between two latent vectors results in a coherent transition between two different sentences (e.g., smoothly transitioning from a negative to a positive sentiment).
  • Semi-Supervised Learning: ANT-generated synthetic data proved effective in boosting the performance of sentiment classifiers. In low-resource settings, using ANT-generated data improved F1 scores by up to 1.75%.

Conclusion

The Adversarial Non-autoregressive Transformer (ANT) represents a significant step forward in efficient text generation. By addressing the core weaknesses of NAR GANs through position-aware modulation and dependency-focused architectures, ANT achieves high-quality results with massive speed gains. Future work will explore scaling these techniques to larger foundation models and refining latent space control for advanced text-editing tasks.

Summary updated

BibTeX
@misc{ren2023unlocking,
  author = {Da Ren and Qing Li and Li, Qing},
  title = {{Unlocking the Power of GANs in Non-Autoregressive Text Generation}},
  year = {2023},
  eprint = {2305.03977},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.03977},
}
Figure