Style Transfer from Non-Parallel Text by Cross-Alignment

Tianxiao Shen, Tao Lei, Regina Barzilay, Tommi S. Jaakkola

TL;DR

This paper introduces a method for performing text style transfer (e.g., changing a sentence's sentiment from negative to positive) without requiring parallel training data. By using a novel "cross-alignment" technique with adversarial training, the authors successfully disentangle a sentence's content from its style, allowing for high-quality transfers in sentiment modification, decipherment, and word order recovery.

The Challenge of Non-Parallel Data

Most breakthroughs in text generation, like machine translation, rely on massive "parallel" datasets—pairs of sentences that mean the exact same thing but are written in different languages or styles. However, for many tasks, parallel data simply doesn't exist. We might have a million positive Yelp reviews and a million negative ones, but we lack a dataset where the exact same review is written in both styles.

The core challenge here is disentanglement: how do you separate the "content" (what is being said) from the "style" (how it is being said)? In natural language, these two are often tightly woven together. The authors aim to learn a mapping that can take a sentence in one style, extract a style-independent content vector, and then "re-render" that content in a target style.

Methodology: Cross-Alignment

The authors propose a framework based on the assumption of a shared latent content space across different text corpora. They introduce two main variants of an auto-encoder to tackle this:

  1. Aligned Auto-encoder: This uses a standard encoder-decoder setup but adds an adversarial discriminator. The discriminator's job is to ensure that the latent content vectors produced from different styles are indistinguishable. If the discriminator can't tell which style a content vector came from, the encoder has successfully "stripped away" the style.
  2. Cross-aligned Auto-encoder (The Core Innovation): Instead of just aligning the latent vectors, this model aligns the generated sentences. It forces the distribution of "transferred" sentences (e.g., positive sentences turned negative) to match the distribution of real sentences in the target style (e.g., actual negative sentences).
Cross-alignment concept

To handle the "discreteness" of text—which usually breaks the gradient flow needed for adversarial training—the authors employ Professor-Forcing. Instead of looking at the specific discrete words generated, the discriminator evaluates the sequence of continuous hidden states in the recurrent neural network (RNN). This allows the model to be trained end-to-end using standard backpropagation.

Key Insights

  • Population-Level Alignment: You don't need sentence-to-sentence pairs if you can match the distributions of the two populations. If the underlying "content" being discussed is generally the same across two corpora, the model can learn to swap the stylistic "veneer."
  • Rich Latent Spaces: Unlike Variational Auto-encoders (VAEs) which often constrain the latent space to a simple Gaussian distribution (potentially losing information), this method encourages a rich, unperturbed latent representation. The authors argue this is better for preserving complex content.
  • Decipherment as Style Transfer: One of the most innovative framing choices is treating a substitution cipher as just another "style." This allows the model to "crack" ciphers purely by looking at the statistical distributions of words, without any prior knowledge of the encryption rules.

Experimental Results

The model was evaluated on three distinct tasks: Sentiment Modification (using Yelp reviews), Word Substitution Decipherment, and Word Order Recovery.

  • Sentiment Modification: In human evaluations, the cross-aligned model achieved an "overall transfer" success rate of 41.5%, outperforming the previous state-of-the-art (41.0%) while maintaining better content preservation and grammatical consistency.
Sentiment modification results
  • Decipherment: The model showed remarkable strength on synthetic tasks. On a 100% word substitution task, it achieved a BLEU score of 57.4, while a standard aligned auto-encoder managed only 7.2.
  • Word Order: The model reached a BLEU score of 26.1 for recovering word order from a shuffled "bag of words" version of a sentence, a task where most other non-parallel models failed completely (scoring around 5.0).

Limitations and Future Work

  • Content Distribution Assumption: The method relies heavily on the assumption that the two corpora share a similar distribution of content. If you try to transfer style between a corpus of "cooking recipes" and "legal documents," the alignment will likely fail because the underlying content is fundamentally different.
  • Evaluation Metrics: Evaluating style transfer remains difficult. While human judges and BLEU scores provide a baseline, these metrics don't always perfectly capture the nuance of "style" versus "meaning."
  • Theoretical Recovery: The paper poses a deep theoretical question: under what exact conditions can a joint distribution be recovered from marginal distributions? While they provide some proofs for Gaussian mixtures, the general case for natural language remains an open and fertile ground for future research.

Summary updated

BibTeX
@inproceedings{shen2017style,
  author = {Tianxiao Shen and Tao Lei and Regina Barzilay and Tommi S. Jaakkola},
  title = {{Style Transfer from Non-Parallel Text by Cross-Alignment}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2017},
  url = {https://openreview.net/forum?id=Bk4sTdb_ZH},
}
Figure