NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learning Extrapolative Sequence Transformations from Markov Chains

Sophia Hager, Aleem Khan, Andrew Wang, Nicholas Andrews

TL;DR

Researchers have developed a novel method to "distill" the slow, stochastic search process of Markov Chain Monte Carlo (MCMC) into a fast, efficient autoregressive model. By training on the trajectories of MCMC chains, the resulting model learns to perform "extrapolative" transformations—finding sequences with properties far beyond those seen in the original training data—in just a few steps rather than thousands.

The Challenge: Interpolation vs. Extrapolation

Most deep learning models excel at interpolation: they perform reliably on data that resembles their training set. However, scientific discovery and creative design often demand extrapolation. Whether it is engineering a protein that is more stable than any known variant or designing a molecular structure with unprecedented properties, models must venture into unseen territory.

While search methods like MCMC can explore these unseen regions by taking random, localized steps, they are notoriously slow and computationally expensive. They frequently get stuck in local optima or require thousands of iterations to yield a single high-quality candidate.

Conceptual overview of learning extrapolative transformations from MCMC search trajectories.

The authors pose a critical question: Can we train a model to learn the "direction" of improvement from these slow searches, and then apply that knowledge greedily and efficiently?

A Two-Phase Methodology

To solve this, the researchers propose a two-phase framework that treats search algorithms as teachers rather than final solutions.

  1. The Search Phase (MCMC): The process begins using a pre-trained Masked Language Model (such as BERT or ProtBert) as a "proposal distribution" to suggest local edits to a sequence. These edits are evaluated using a scoring function (an "energy" model) and accepted or rejected via the Metropolis-Hastings algorithm. This generates "chains" of sequences that gradually improve in the target quality.
  2. The Distillation Phase (Autoregressive Model): These MCMC chains are then utilized as training data. The researchers sub-sample the transitions—specifically targeting steps that significantly improve the target property—and train an autoregressive model ($q_\theta$) to predict the next improved state given the current sequence and its score.

Crucially, the team explored different episode creation strategies to select which states from the MCMC chain to show the model. These included uniform thinning (picking states at regular intervals), showing only the first and best states, and selecting states based on the magnitude of improvement they offer ($\Delta$ Energy).

Validation Across Domains

The approach was rigorously tested across three distinct domains requiring different types of sequence manipulation:

  • Protein Engineering: Mutating the human ACE2 protein to improve stability (measured by ddG). The training data was deliberately restricted to a specific range, forcing the model to extrapolate to "unseen" stability levels.
  • Sentiment Extrapolation: Transforming Yelp reviews with moderate 2-4 star ratings into extreme 1-star or 5-star reviews.
  • Text Anonymization: Rewriting Reddit posts to hide the author's identity while maintaining the original meaning, a task requiring robust generalization.

Key Results and Insights

The core insight of the paper is viewing MCMC not as the end product, but as a source of high-quality "expert" trajectories. By conditioning on the history of previous edits and scores, the model learns a conditional transformation that plans a sequence of refinements leading directly to the goal.

Performance comparison showing the learned model achieving comparable extrapolation to MCMC but in a single iteration.

In many cases, the learned model actually outperformed the MCMC search it was trained on, suggesting it generalized the underlying logic of sequence improvement rather than just mimicking the search.

  • Superior Extrapolation: In the protein stability task, the learned model ($q_\theta$) achieved a success rate of 46.4% at the most extreme extrapolation threshold (-7 ddG). In stark contrast, the original MCMC search only managed a 0.5% success rate.
  • Massive Speedups: As shown in the performance tables, MCMC required nearly 500 iterations to reach its goal in the sentiment task. The learned model achieved similar or better extrapolation results in just one iteration.
  • Better Fluency: For text tasks, the learned model produced more fluent and semantically consistent results than MCMC, which often degraded into "gibberish" while blindly trying to maximize a reward score.

Limitations and Future Work

Despite the impressive results, the framework has limitations. It suffers from the Cold Start Problem: researchers still need to run the expensive MCMC search at least once to generate the initial training data. Furthermore, the method relies heavily on an "oracle" or surrogate scoring model. If this guide is inaccurate in the extrapolated ranges, the model may learn to exploit those inaccuracies (reward hacking).

Future directions include applying this framework to more complex domains like molecular optimization and exploring "on-policy" fine-tuning, where the model iteratively improves itself by searching and learning in a continuous loop.

Summary updated

BibTeX
@inproceedings{hager2025learning,
  author = {Sophia Hager and Aleem Khan and Andrew Wang and Nicholas Andrews},
  title = {{Learning Extrapolative Sequence Transformations from Markov Chains}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=5d6Y7xxRMr},
}
Figure