Abstract
Generative Adversarial Networks (GANs) have revolutionized continuous data generation, yet their application to natural language processing remains challenging due to the discrete nature of text. Standard GAN architectures struggle with backpropagating gradients through discrete token selections. This paper introduces GAN2vec, a novel framework that bypasses the "discrete gradient" problem by training GANs to operate within a continuous word embedding space (word2vec). By generating sequences of vectors rather than discrete tokens, GAN2vec eliminates the computationally expensive softmax bottleneck and significantly improves text diversity. Our evaluation across multiple datasets demonstrates that GAN2vec achieves superior diversity compared to state-of-the-art reinforcement learning-based models while maintaining competitive linguistic quality on short-to-medium length sequences.
Introduction: The Discrete Gradient Problem
Standard GANs are highly effective at generating continuous data like images, but they struggle with text. Because text is composed of discrete tokens, backpropagating gradients from a discriminator to a generator through a "choice" (such as an argmax or softmax layer) is non-differentiable. Existing workarounds typically involve Reinforcement Learning (RL) techniques like policy gradients or approximations like the Gumbel-softmax. However, these methods often suffer from high variance, slow training, and "mode collapse," where the model repeatedly generates a limited set of "safe" sentences. Furthermore, the final softmax layer in most language models presents a massive computational bottleneck that scales poorly with vocabulary size.
The GAN2vec Framework
To address these limitations, GAN2vec shifts the generation process from the token space to the embedding space. Instead of predicting a probability distribution over a vocabulary, the Generator ($G$) outputs a sequence of continuous vectors that reside in a pre-trained word2vec space.
The Discriminator ($D$) is trained to distinguish between sequences of "real" embeddings (extracted from a corpus) and "fake" sequences produced by $G$. To ensure training stability and prevent vanishing gradients, the authors employ the Wasserstein GAN (WGAN) objective with a Gradient Penalty (GP). During inference, the generated vectors are converted back into human-readable text using a nearest-neighbor search based on cosine similarity to find the closest word in the vocabulary for each generated embedding.
Experimental Setup and Datasets
The model was evaluated on three distinct datasets to test various linguistic capabilities:
- Chinese Poetry Dataset: Simple 4-line poems with fixed lengths (5 or 7 tokens).
- CMU-SE: A collection of approximately 44,000 simple English sentences with a vocabulary of ~3,100 words.
- COCO Image Captions: A standard benchmark used to test the model's ability to handle longer, more complex sentences.
Key Insights and Results
One of the most significant advantages of GAN2vec is its "semantic safety net." By operating in embedding space, if the model's prediction is slightly imprecise, the nearest-neighbor mapping is likely to output a synonym or a semantically related word rather than a completely random token. Additionally, the architecture is inherently vocabulary-agnostic; because the generator produces fixed-size vectors regardless of vocabulary size, the model does not need to be restructured when moving between datasets.
Quantitatively, GAN2vec prioritizes diversity over exact precision. While it may not always outperform state-of-the-art (SOTA) models in raw BLEU scores (which measure exact n-gram matches), it significantly outperforms them in Self-BLEU. On the COCO dataset, GAN2vec achieved much lower Self-BLEU scores than models like LeakGAN and SeqGAN, indicating a much higher degree of creativity and a reduced susceptibility to mode collapse.
Efficiency is another key result: by removing the softmax layer, the authors observed a smaller memory footprint and faster training and inference procedures. Analysis of cosine similarity during training also revealed that the model learns sentence structure incrementally, typically mastering the start-of-sentence token <s> before progressing to more complex subsequent words.
Limitations and Future Work
The primary limitation identified is long-term coherence. While GAN2vec excels at generating short, diverse phrases, its performance on BLEU-3 scores drops more sharply than its competitors, suggesting difficulty in maintaining a consistent "thought" over longer sentences. Future work may involve exploring RNN-based or Transformer-based generators to better capture long-term dependencies, using GAN2vec as a bridge to transfer advanced computer vision GAN research into the NLP domain.
Summary updated