Unsupervised Text Style Transfer using Language Models as Discriminators

Zichao Yang, Zhiting Hu, Chris Dyer, Eric P. Xing, Taylor Berg-Kirkpatrick

TL;DR

This paper introduces a novel approach to unsupervised text style transfer by replacing traditional binary Generative Adversarial Network (GAN) discriminators with target-domain Language Models (LMs). By leveraging the token-level feedback of an LM and a continuous Gumbel-softmax approximation, the authors achieve more stable training and significantly better fluency across tasks like sentiment modification and related language translation.

The Challenge of Text Style Transfer

Text style transfer aims to change a specific attribute of a sentence (such as sentiment or formality) while preserving its underlying content. The "unsupervised" aspect means this must be achieved without parallel pairs—for instance, without having the exact same sentence written in both positive and negative styles to train on.

Existing methods often rely on GANs. In a standard GAN setup, a discriminator (usually a Convolutional Neural Network) evaluates a generated sentence and attempts to classify it as "real" or "fake." However, this approach has two major flaws when applied to text:

  1. Sparse Feedback: A binary classifier outputs a single scalar value for the entire sentence. This makes it incredibly difficult for the generator to determine which specific word or phrase ruined the target style.
  2. Instability: Discrete text tokens are non-differentiable, making backpropagation difficult and rendering the training process notoriously "jittery" and unstable.

Proposed Method: The Language Model Discriminator

The authors propose an encoder-decoder architecture where content and style are disentangled. The core innovation lies in replacing the standard binary classifier with a Language Model Discriminator.

Architecture of the proposed model showing reconstruction and transfer phases.
  • LM as Critic: Instead of a binary classifier, the researchers train a Language Model on the target domain. The generator is then trained to produce sentences that yield a low Negative Log Likelihood (NLL) according to that specific LM. Because LMs decompose sentence probability into a product of conditional probabilities, the generator receives a signal for every single token. The LM can effectively point to specific words that do not fit the target style.
  • Continuous Approximation: To solve the non-differentiability of discrete words, the model employs the Gumbel-softmax trick. Instead of picking one discrete word at each step, the generator passes a "soft" probability distribution of words to the LM. This continuous approximation allows gradients to flow smoothly back to the generator.
  • Forgoing Adversarial Steps: Interestingly, the authors found that because LMs are naturally trained to assign low probabilities to "bad" or ungrammatical sequences (due to their normalization constant), they could often skip the adversarial step of training on negative samples entirely. This implicit negative training leads to much more stable convergence.

Key Insights

  • Structured vs. Unstructured Discriminators: A CNN discriminator is "unstructured"—it learns a black-box function to separate real from fake. An LM is "structured" because it inherently models the sequential probability of language. This structure acts as a powerful prior that guides the generator toward fluency.
  • The "Where" Matters: Token-level feedback is vastly more informative than a single "thumbs up/down" from a classifier, allowing the generator to make precise, localized edits to the text.

Datasets and Key Results

The researchers evaluated their model on three distinct tasks using several well-known datasets, including the Yelp Review Dataset (for sentiment modification and decipherment), the Leipzig Corpora Collections (for Bosnian-Serbian translation), and the Chinese Gigaword Corpus (for Simplified-Traditional Chinese translation).

The LM-based approach consistently outperformed previous state-of-the-art methods across multiple metrics:

Performance comparison on the sentiment modification task.
  • Sentiment Modification: As shown in the results above, the model achieved a superior balance between sentiment accuracy (91.2%) and content preservation (BLEU score of 57.8) when combining the LM with a classifier, outperforming previous baselines by a wide margin.
  • Decipherment: In the word substitution task, the LM approach proved significantly more robust, particularly when the percentage of substituted words was high.
  • Related Language Translation: This was a standout result. For Simplified to Traditional Chinese translation, the model reached an impressive 81.6 BLEU, representing a massive jump over the previous best score of 60.1.

Limitations and Future Work

While highly effective, the approach is not without limitations:

  • Length Bias: LMs naturally prefer shorter sentences because they yield a lower total NLL. The authors had to employ "tricks" such as length normalization and fixing the output length to match the input to prevent the model from collapsing into generating very short, "safe" phrases.
  • Mode Collapse: Although more stable than traditional GANs, the generator can still suffer from mode collapse, occasionally learning to output a limited set of high-probability sentences.

For future work, the authors suggest extending this framework to semi-supervised learning, where even a small amount of parallel data could be injected to further refine the style transfer process and mitigate mode collapse.

Summary updated

BibTeX
@inproceedings{yang2018unsupervised,
  author = {Zichao Yang and Zhiting Hu and Chris Dyer and Eric P. Xing and Taylor Berg-Kirkpatrick},
  title = {{Unsupervised Text Style Transfer using Language Models as Discriminators}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
  url = {https://openreview.net/forum?id=S1VKsIb_-B},
}
Figure