# Primal-Dual Guided Decoding for Constrained Discrete Diffusion

*Federico Tomasi, Dmitrii Moor, Alice Wang, Mounia Lalmas*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/152632) · [Open on the map](../papers.html#p152632)

Category: [Diffusion & Image Generation](../pcat/5.md) › [Discrete Diffusion Constrained Generation](../pgroup/694.md) · Type: new method · Keywords: discrete diffusion, constrained generation, primal-dual optimisation, KL regularisation, token bias

Areas: [Generative Models (Diffusion & Flows)](../areas/generative-models.md) › Flow Matching and Diffusion › Training-Free Generative Guidance

## Summary
Primal-Dual Guided Decoding introduces an inference-time algorithm that solves constrained generation as a KL-regularised optimisation problem, adding a bias to token logits without retraining.

## Explained to a 5-year-old
Imagine a robot that builds sentences, molecules, or music one piece at a time. Sometimes we want these pieces to follow special rules, like using only certain words or making sure a molecule is safe. The robot can change its choices as it works, using a clever math trick that keeps the rules in mind without having to learn anything new. This helps the robot make things that follow the rules while still sounding or looking interesting. It works for many kinds of creations, from stories to medicines to songs, and it does not need extra time or training.

## Explained to a 5-year-old, longer
A computer program can make new things like words, molecules, or songs by adding pieces one at a time. These pieces are hidden at first, and the program slowly reveals them, like uncovering a secret picture. Sometimes we want the final result to follow certain rules, for example only using certain letters or making sure a chemical is safe. The program can adjust its choices as it goes, using a special math idea that keeps track of how well the rules are being followed. This adjustment happens without the program having to learn new information or run extra calculations. It works like a guide that tells the program when it is getting close to breaking a rule and helps it stay on track. Because the guide only changes a little at each step, the final result still looks natural and varied. The method can handle many rules at the same time, so you can make a sentence that is both short and uses specific topics. It also works for making new medicines, where the rules might be about safety and how the molecules interact. In music, you could ask the program to create a playlist that follows a certain mood or rhythm. All of this is done without having to train the program again, which saves time and computer power. This makes it easier for people to create useful and interesting things while respecting the constraints they care about.

## For a technical reader
The system treats constrained generation as an optimisation problem, balancing the model’s natural output with user-defined rules. At each step of the denoising process, a small bias is added to the token scores based on how far the current output is from satisfying the constraints. The bias is updated on-the-fly using a simple iterative rule, so no extra training or model evaluations are needed. This allows a single algorithm to enforce multiple constraints across text, molecules, or music while keeping the output diverse and valid.

## Problem
Generating structured sequences with global property constraints is challenging because existing diffusion models struggle to enforce these constraints during generation. The problem is to produce sequences that satisfy multiple constraints while preserving the model's distribution.

## Method
The approach formulates constrained generation as a KL-regularised optimisation problem and solves it online using adaptive Lagrangian multipliers. At each denoising step, a constraint-dependent bias is added to token logits, while the multipliers are updated via mirror descent based on constraint violation. This yields formal bounds on violation without extra model evaluations.

## Results
The approach achieves high constraint satisfaction while preserving diversity and validity across all three domains, with no extra training or inference overhead.

## Contributions
A training-free, inference-time method that enforces multiple global constraints via KL-regularised optimisation, supports simultaneous constraints, provides formal violation bounds, and works with any discrete diffusion model. The method adds an additive bias to logits, preserving the model's distribution while steering generation.

## Practical relevance
Enables practitioners to generate constrained sequences without costly retraining, making constrained generation accessible for text, molecules, and music.

## Research questions this paper is counted under

- [How can diffusion models enforce complex constraints during generation without compromising desired outputs?](../q/249.md)

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/152632)
