Sequence to Better Sequence: Continuous Revision of Combinatorial Structures

Jonas Mueller, David K. Gifford, Tommi S. JaakkolaICML 2017

Introduction

Revising discrete sequences—such as text sentences, molecular strings, or genetic codes—to improve a specific outcome is a notoriously difficult challenge. Because these structures are combinatorial, traditional calculus and gradient-based optimization cannot be directly applied. Instead, researchers have historically relied on discrete search heuristics like genetic algorithms or random word swapping. These methods are often inefficient and prone to producing "gibberish" that violates domain rules, such as ungrammatical sentences or unstable proteins.

This paper introduces REVISE, a framework for revising discrete sequences to improve a specific outcome (like sentiment or biological activity) by performing gradient-based optimization in a continuous latent space. By combining a Variational Autoencoder (VAE) with an outcome-prediction network, the model can "nudge" a sequence toward a better version while ensuring it remains natural-looking and semantically similar to the original.

The REVISE Framework

The authors shift the problem from discrete combinatorial search to continuous gradient-based optimization. The model consists of three main components trained jointly:

  1. Encoder ($E$): Maps a discrete sequence $x$ to a continuous latent representation $z$.
  2. Decoder ($D$): Maps a latent vector $z$ back into a discrete sequence $x$. Together with the encoder, this forms a Recurrent VAE.
  3. Outcome Predictor ($F$): A neural network that predicts the outcome $y$ directly from the latent vector $z$.
Graphical Model and Revision Procedure

Joint Training and Invariance

A key innovation in this architecture is the Invariance Loss. The authors force the predictor $F$ to be "invariant" to the encoding-decoding process. Essentially, $F(z)$ should yield the same result as $F(E(D(z)))$. This ensures that the continuous optimization actually corresponds to changes that the decoder can realize in the discrete space.

The Revision Algorithm

To revise a sequence $x_0$, the framework follows a straightforward procedure:

  1. Encode: Find the starting point in latent space, $z_0 = E(x_0)$.
  2. Optimize: Use gradient ascent to move $z$ in the direction that increases the predicted outcome $F(z)$.
  3. Constrain: To keep the sequence "natural," the optimization is constrained to a "feasible region" (a level-set of the VAE's posterior distribution). A log-barrier penalty method keeps the search within these bounds, avoiding "holes" in the latent space that decode into nonsense.
  4. Decode: Once an optimal $z^*$ is found, pass it through the decoder $D$ to generate the revised discrete sequence $x^*$.

Key Insights and Results

The authors evaluated their approach on three distinct tasks: a synthetic grammar task, sentiment improvement on BeerAdvocate reviews, and style transfer from modern English to Shakespearean prose.

  • Gradients over Search: By mapping sequences to a continuous space, the model leverages the "direction" of improvement provided by gradients. This is far more efficient than guessing-and-checking discrete changes.
  • Theoretical Naturalness: The paper provides a mathematical proof showing that if the optimization is properly constrained, the resulting sequence is guaranteed to have a high likelihood under the original data distribution.
  • Superior Outcomes: In the beer review task, the REVISE method achieved a significantly higher sentiment improvement compared to combinatorial search baselines. It successfully balanced making changes with staying "natural," turning phrases like "this smells pretty bad" into "smells pretty delightful!" while maintaining a low edit distance.
Performance Comparison Table

In the Shakespeare task, the model demonstrated the ability to gradually transform modern sentences (e.g., "where are you, henry??") into Shakespearean-style prose ("where art thou, keeper??") by taking successive gradient steps in the latent space.

Limitations and Future Work

While the revisions are "natural," the model does not explicitly guarantee that the meaning of the sentence is preserved. For instance, changing "bad" to "delightful" is a successful sentiment revision but a total reversal of the original meaning (semantic drift). Furthermore, the quality of the revision is strictly capped by the quality of the VAE; if the VAE cannot reconstruct the original sequence perfectly, the revision starts from a "blurry" version of the input.

Future directions suggest incorporating additional similarity labels or more sophisticated VAE architectures (like those that disentangle style from content) to help preserve semantics more effectively.

Summary updated

BibTeX
@inproceedings{mueller2017sequence,
  author = {Jonas Mueller and David K. Gifford and Tommi S. Jaakkola},
  title = {{Sequence to Better Sequence: Continuous Revision of Combinatorial Structures}},
  booktitle = {International Conference on Machine Learning},
  year = {2017},
  url = {https://openreview.net/forum?id=HyW9BhWO-r},
}
Figure