Content preserving text generation with attribute controls

Lajanugen Logeswaran, Honglak Lee, Samy Bengio

Introduction

Modifying specific attributes of a sentence—such as its sentiment, tense, or voice—while preserving its underlying meaning is a complex challenge in natural language processing. In computer vision, changing an image attribute (like hair color) is relatively straightforward because pixels are continuous. Text, however, is discrete and sequential; changing a single word can completely destroy a sentence's meaning or grammar.

The core challenge in this domain is content preservation. Most existing models for controlled text generation suffer from two primary issues:

  1. The "Copy" Trap: Models trained on auto-encoding often learn to simply copy the input, ignoring the target attribute entirely.
  2. The "Vacuous" Generation: Models might generate a sentence that successfully matches the target attribute (e.g., "This is great!") but completely loses the original content (e.g., "The food was cold").

Furthermore, most prior work requires parallel data (the exact same sentence written in two different styles), which is incredibly rare in the real world. This paper introduces a novel, unsupervised framework for "style transfer" in text that successfully controls multiple attributes simultaneously without requiring parallel training data.

Methods

The authors propose an encoder-decoder architecture utilizing Gated Recurrent Units (GRUs) with three key innovations designed to separate content from style in the latent space.

Model Architecture featuring Interpolated Reconstruction and Adversarial Discriminator
  • Interpolated Reconstruction Loss ($L^{int}$): This is the core mechanism for content preservation. Instead of relying solely on standard auto-encoding (reconstructing $x$ from $x$) or back-translation (reconstructing $x$ from a generated $y$), the model interpolates between the latent representations of the original and the generated sentences. This acts as a powerful regularization technique, forcing the model to learn a robust latent space where content is separated from style, preventing the decoder from relying on trivial "copying" shortcuts.
  • Unified Adversarial Discriminator ($L^{adv}$): Unlike previous methods that required a separate discriminator for every single attribute value, this framework uses a single projection discriminator. It evaluates whether a sentence is both realistic and compatible with a given set of attribute labels. This makes the model highly data-efficient and scalable to multiple attributes.
  • Hard-sampling: Many models use "soft-sampling" (continuous approximations) during training to allow gradients to flow. The authors found that using "hard-sampling" (actual discrete word tokens) during training better aligns the model's training behavior with inference, leading to significantly more fluent text.

Datasets and Tasks

The model's versatility was evaluated across several diverse tasks:

  • Sentiment Modification: Using Yelp and IMDB review datasets.
  • Monolingual Style Transfer: Translating between Old English and Modern English using a Shakespeare dataset.
  • Multi-attribute Control: Using a subset of the BookCorpus (~2M sentences) annotated for tense, voice, mood, and negation.

Key Insights and Results

The proposed model significantly outperformed state-of-the-art baselines, such as Cross-align and Ctrl-gen, across almost all metrics.

Human Assessment of Generated Sentences
  • Content Preservation & Fluency: Human evaluations demonstrated that the proposed model achieved superior attribute accuracy (92.8%), content preservation (55.10%), and fluency (3.19) compared to baselines. On automated metrics for Yelp reviews, the model achieved a BLEU-1 score of 53.0, nearly double the performance of the Ctrl-gen baseline (11.5). It also produced sentences with much lower perplexity (133 on Yelp vs. 180 for Cross-align), indicating more natural, human-like text.
  • Scalability to Multi-Attribute Control: The paper demonstrates that users do not need to choose between controlling sentiment or tense. The model can handle complex combinations like "Positive Sentiment + Past Tense + Passive Voice" simultaneously. In the multi-attribute task, the model achieved high accuracies (90%–98%) across four different attributes (mood, tense, voice, negation) while maintaining the sentence's core meaning. For example, it successfully flipped "John was born in the camp" to "John wouldn't live in the camp" by changing mood, negation, and tense all at once.

Limitations and Future Work

While highly effective, the authors noted that "Voice" (active vs. passive) remains the most difficult attribute to control. Changing voice often requires reordering the entire sentence's global structure (subject-verb-object), which sometimes leads the model to distort the underlying content.

Additionally, the current work focuses on categorical labels (e.g., Past vs. Present). Future work could explore continuous attributes, such as the intensity of a sentiment or the complexity of the language, as well as expanding the model's semantic breadth beyond syntactic and stylistic attributes.

Summary updated

BibTeX
@inproceedings{logeswaran2018content,
  author = {Lajanugen Logeswaran and Honglak Lee and Samy Bengio},
  title = {{Content preserving text generation with attribute controls}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
  url = {https://openreview.net/forum?id=S1ZLgYWuZS},
}
Figure