SentiGAN: Generating Sentimental Texts via Mixture Adversarial Networks

Ke Wang, Xiaojun Wan

Introduction

Generating text with specific emotional attributes is a cornerstone of developing more empathetic and human-like AI. However, text generation using Generative Adversarial Networks (GANs) faces significant hurdles. Unlike continuous image data, text is composed of discrete tokens, which prevents the direct application of backpropagation. Furthermore, GANs are prone to "mode collapse," where the generator produces a limited set of repetitive, "safe" samples to deceive the discriminator. Finally, maintaining high linguistic quality while strictly adhering to a specific sentiment—without the aid of parallel corpora—remains a complex optimization challenge.

Architecture and Methodology

To address these issues, the authors propose SentiGAN, a framework that utilizes a mixture of generators and a multi-class discriminator to stabilize training and enhance diversity.

Figure 1: The SentiGAN architecture featuring multiple generators and a multi-class discriminator.

The core innovation lies in its "mixture" approach:

  1. Multiple Generators ($k$): Instead of a single model attempting to learn all sentiment nuances, SentiGAN employs $k$ distinct generators, each specialized in a specific sentiment (e.g., positive or negative). This specialization allows each generator to focus on the linguistic patterns unique to its assigned emotion.
  2. Multi-Class Discriminator: A single discriminator is tasked with classifying input text into $k+1$ categories: $k$ real sentiment classes and one "fake" class. This multi-class objective provides a richer gradient signal, forcing generators to not only appear "real" but also to remain within their specific sentiment boundaries.
  3. Penalty-Based Objective: Moving away from standard reinforcement learning (RL) rewards, SentiGAN minimizes a penalty. This approach, theoretically grounded in Wasserstein distance, offers more stable training gradients and discourages generators from converging on a few high-reward sentences, thereby mitigating mode collapse.
  4. Reinforcement Learning Integration: To navigate the discrete nature of text, the model uses policy gradients combined with Monte Carlo (MC) search to estimate the value of partial sequences during generation.

Experimental Setup

The framework was evaluated across four datasets to ensure robustness:

  • Movie Reviews (MR): Derived from the Stanford Sentiment Treebank (SST).
  • Beer Reviews (BR): Scraped from BeerAdvocate.
  • Customer Reviews (CR): Covering various consumer products.
  • Synthetic Data: Generated by an "oracle" LSTM to test the model's ability to capture long-term sequential dependencies in a controlled setting.

Results and Discussion

SentiGAN demonstrates superior performance over existing baselines, including SeqGAN, Variational Autoencoders (VAEs), and Conditional GANs (C-GAN). The model's training stability is a key differentiator, as evidenced by its learning curve compared to traditional methods.

Figure 4: Learning curve comparing NLL loss across different models, highlighting SentiGAN's rapid convergence.

Key findings include:

  • Sentiment Accuracy: On the MR dataset, SentiGAN achieved an accuracy of 88.5%, significantly outperforming C-GAN (82.2%) and S-VAE (83.1%).
  • Diversity and Fluency: Metrics based on Jaccard similarity and Perplexity indicate that SentiGAN produces more varied and natural-sounding text than its predecessors, avoiding the "gibberish" often associated with early GAN text models.
  • Human Evaluation: In "intelligibility" tests, human reviewers consistently rated SentiGAN's outputs as the most coherent and readable among the tested models, confirming the quantitative results.

Conclusion and Future Work

By leveraging a mixture of specialized generators and a penalty-based objective, SentiGAN effectively overcomes the traditional pitfalls of text-based GANs. While the current work focuses on short sentences (up to 15 words) and simple LSTM architectures, the "mixture" framework provides a robust foundation for future explorations into long-form text generation and more diverse stylistic attributes, such as formal versus informal tone.

Summary updated

Abstract

Generating texts of different sentiment labels is getting more and more attention in the area of natural language generation. Recently, Generative Adversarial Net (GAN) has shown promising results in text generation. However, the texts generated by GAN usually suffer from the problems of poor quality, lack of diversity and mode collapse. In this paper, we propose a novel framework - SentiGAN, which has multiple generators and one multi-class discriminator, to address the above problems. In our framework, multiple generators are trained simultaneously, aiming at generating texts of different sentiment labels without supervision. We propose a penalty based objective in the generators to force each of them to generate diversified examples of a specific sentiment label. Moreover, the use of multiple generators and one multi-class discriminator can make each generator focus on generating its own examples of a specific sentiment label accurately. Experimental results on four datasets demonstrate that our model consistently outperforms several state-of-the-art text generation methods in the sentiment accuracy and quality of generated texts.
BibTeX
@inproceedings{wang2018sentigan,
  author = {Ke Wang and Xiaojun Wan},
  title = {{SentiGAN: Generating Sentimental Texts via Mixture Adversarial Networks}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.24963/ijcai.2018/618},
}
Figure