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

Controlled Text Generation as Continuous Optimization with Multiple Constraints

Sachin Kumar, Eric Malmi, Aliaksei Severyn, Yulia Tsvetkov

TL;DR

MUCOCO (MUltiple COnstraints through Continuous Optimization) is a flexible decoding algorithm that treats text generation as a constrained optimization problem. By relaxing discrete tokens into a continuous space and using Lagrangian multipliers, it allows researchers to plug in multiple differentiable constraints (like formality, sentiment, or semantic similarity) to guide pre-trained language models without the need for expensive fine-tuning.

The Challenge of Multi-Objective Control

Large-scale language models (LLMs) are excellent at generating coherent text, but "steering" them toward specific attributes—such as making a translation formal or ensuring a paraphrase preserves the original meaning—is notoriously difficult.

Standard approaches usually involve:

  1. Fine-tuning: This is computationally expensive and requires massive labeled datasets for every specific combination of attributes.
  2. Weighted Decoding: This involves adding a "reward" for certain attributes during the search process. However, when optimizing for multiple goals simultaneously (e.g., "be formal" AND "stay close to the source"), simply summing these rewards often fails. The different scales of the objectives typically lead to one goal dominating the others.

The authors tackle this challenge of multi-objective control, where a model must satisfy several potentially conflicting constraints simultaneously during the inference (decoding) phase.

The MUCOCO Approach

The core innovation of this paper is MUCOCO, which moves away from traditional discrete decoding (like beam search) toward continuous optimization.

  • Continuous Relaxation: Instead of picking one word at a time, the algorithm represents each token position as a "soft" probability distribution (a simplex) over the entire vocabulary. This makes the generation process differentiable.
  • Lagrangian Formulation: Rather than just adding up different loss functions with fixed weights, the authors frame the problem as: "Minimize the negative log-probability of the language model subject to the attribute constraints being below a certain threshold."
  • Modified Differential Method of Multipliers (MDMM): They use a gradient-descent-based approach to update both the token distributions and the Lagrangian multipliers simultaneously. A "dampening" term is included to prevent the optimization from oscillating wildly.
  • Threshold Annealing: To prevent the model from finding "adversarial" solutions (strings of gibberish that technically satisfy a classifier but aren't real language), they start with relaxed constraints and gradually tighten them during the optimization process.
  • Exponentiated Gradient Descent: This specific optimization technique ensures that the "soft" token representations always stay valid probability distributions.

Key Insights and Ideas

The Pareto Front Problem: The authors demonstrate that a simple linear combination of losses (e.g., $Loss = \alpha \cdot Loss_A + \beta \cdot Loss_B$) is often unsuccessful because the "Pareto front" (the set of optimal trade-offs) is non-convex. MUCOCO’s Lagrangian approach is much better at finding these optimal trade-offs without getting stuck or oscillating.

Optimization trajectories comparing linear combinations and MUCOCO

Plug-and-Play Modularity: Because MUCOCO only requires the constraints to be differentiable, you can plug in any pre-trained classifier or similarity model (like BERTScore or Word Mover’s Distance) without changing the underlying generative LLM.

Global vs. Local Context: Unlike autoregressive methods (like FUDGE) that look at one token at a time from left to right, MUCOCO optimizes the entire sentence at once, allowing it to satisfy sentence-level constraints more effectively.

Experimental Results

The authors evaluated MUCOCO across three distinct tasks: Style Transfer (Informal to Formal), Style-controlled Machine Translation, and Multi-attribute Paraphrasing.

  • Style Transfer: MUCOCO achieved a 92% transfer accuracy on the GYAFC formalization task, significantly outperforming the FUDGE baseline (85%) and the unconstrained STRAP model (78%), while maintaining higher fluency (93%).
Style transfer results comparing MUCOCO against baselines
  • Machine Translation: In French-to-English tasks, adding a formality constraint increased the formality of the output from 0% (baseline beam search) to 30%, while actually improving the BERTScore (a measure of translation quality) compared to other controlled methods.
  • Human Evaluation: In a head-to-head comparison for machine translation, human annotators preferred MUCOCO’s outputs 37% of the time, compared to only 18% for standard beam search.

Limitations and Future Work

While powerful, MUCOCO has some practical limitations:

  • Computational Overhead: This is the primary drawback. MUCOCO takes about 90 minutes to decode 1,200 sentences on a single GPU, whereas simpler methods like FUDGE take about 20 minutes.
  • Memory Intensity: Optimizing a $Length \times Vocabulary$ matrix is memory-heavy, especially for large vocabularies.
  • Fixed Length: The current implementation requires the target sequence length to be somewhat pre-determined (the authors use a heuristic based on greedy decoding).

For future directions, the authors suggest exploring more efficient optimization techniques and moving toward optimizing token embeddings rather than the full vocabulary distribution to save memory.

Summary updated

BibTeX
@inproceedings{kumar2021controlled,
  author = {Sachin Kumar and Eric Malmi and Aliaksei Severyn and Yulia Tsvetkov},
  title = {{Controlled Text Generation as Continuous Optimization with Multiple Constraints}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=4MZ8XZ1MHB},
}
Figure