TL;DR
When steering discrete diffusion models (like those generating text or molecules) to satisfy hard constraints, you usually face a trade-off: classifier-based guidance (CBG) is fast but struggles to enforce constraints reliably, while Constrained Discrete Diffusion (CDD) enforces constraints directly but requires expensive optimization at every step. AdaDual bridges this gap by adapting the CBG guidance strength on the fly using a lightweight scalar dual optimization problem, achieving substantially lower constraint violations than CBG and better generative quality than CDD at a fraction of the computational cost.
What Problem Does This Paper Address?
Discrete diffusion models—particularly masked diffusion models—generate structured data like text and molecular SMILES strings by starting from a fully masked sequence and iteratively unmasking tokens. In many real-world applications, however, generating plausible samples isn't enough; outputs must also satisfy strict user-specified constraints (e.g., non-toxic text or easily synthesizable molecules) while preserving the relative probabilities of the pretrained model.
In continuous diffusion, constraints are often handled with gradients, projections, or Langevin dynamics. None of these transfer cleanly to discrete spaces, where tokens are categorical and projecting onto a feasible set can become a combinatorial nightmare.
In discrete diffusion, the exact conditional sampler is characterized by a Doob $h$-transform, which reweights transitions by the probability that a partially denoised state will eventually reach the feasible set. Because this probability is intractable, existing methods approximate it in two ways:
- Classifier-Based Guidance (CBG): Replaces the intractable probability with a learned, time-conditioned classifier score and tilts the transition using a globally fixed guidance strength $\gamma$. It is lightweight, but a single fixed $\gamma$ cannot adapt to varying states and denoising steps, often leading to high constraint violation rates.
- Constrained Discrete Diffusion (CDD): Directly optimizes the predicted token probabilities at every reverse step using an augmented-Lagrangian projection. This gives tight control over constraints, but solving a high-dimensional optimization problem at every step slows down generation and can hurt fluency.
Methods
AdaDual starts from a theoretical observation: the local CBG guidance strength $\gamma$ that best approximates the exact Doob transition is not constant—it depends on both the current state $x$ and the diffusion step $k$.
Instead of fixing $\gamma$ globally, AdaDual reverses the problem:
-
Budgeted KL Projection: At each step $k$ and state $x$, AdaDual seeks the transition distribution $q_k(\cdot \mid x)$ that minimizes the KL divergence from the pretrained transition $p_\theta(\cdot \mid x)$, subject to an explicit, interpretable budget $C_k$ on the expected learned constraint cost: $$\mathbb{E}_{q_k(\cdot \mid x)}\big[-\log \widehat{r}_{t_{k+1}}(X_{t_{k+1}})\big] \le C_k$$ where $\widehat{r}_{t_{k+1}}$ is the learned classifier score.
-
Scalar Dual Optimization: By strong duality, the optimal solution to this constrained problem is still a CBG kernel, where the guidance strength is simply the optimal scalar dual multiplier $\gamma_k^\dagger(x)$.
- Projected Stochastic Gradient Ascent: To avoid checking feasibility at every state, AdaDual restricts $\gamma$ to a compact box $\Gamma = [\gamma_{\min}, \gamma_{\max}]$ and solves the 1D dual problem at each step using $J$ iterations of projected stochastic gradient ascent (drawing $n$ Monte Carlo samples per iteration and warm-starting from the previous step). Because the pretrained transition $p_\theta(\cdot \mid x)$ is cached, the inner loop requires no extra evaluations of the diffusion model.
- Budget Schedules & AdaDual-Lite: The authors test both a constant budget ($C_k \equiv C$) and a log-linear schedule that gradually tightens the budget as denoising progresses. In the appendix, they also introduce AdaDual-Lite, which replaces the $J$-step inner loop with a single online update using the already-sampled next state.
Datasets
- Molecule Generation (QM9): Evaluated on 133,885 canonical SMILES strings (127,190 training, 6,695 held-out) using a pretrained masked discrete diffusion model (MDLM). The constraint is synthetic accessibility: $\text{SA}(x) \le 3.0$, evaluated offline with RDKit.
- Text Generation (RealToxicityPrompts & Jigsaw): Evaluated on prompts from RealToxicityPrompts with prompt toxicity $> 0.5$, using the pretrained
mdlm-owtmodel. The constraint is toxicity $\le 0.25$ (scored offline by a fine-tuned GPT-Neo-1.3B surrogate), with the guidance classifier trained on 60,000 comments from the Jigsaw Toxic Comment Classification dataset.
Key Insights and Ideas
- Why fixed $\gamma$ fails: A fixed global $\gamma$ implicitly induces a state- and step-dependent constraint budget. AdaDual flips this around: by fixing an explicit, interpretable budget $C_k$, it lets $\gamma$ adapt naturally to local uncertainty.
- Favorable Error Accumulation: The authors establish a terminal total-variation (TV) bound that separates inner-solver error, systematic guidance error, and pretrained-model error. Because masked diffusion reveals each token at most once, the accumulated inner-solver error scales with the sequence length $L$ rather than the number of diffusion steps $K$, and converges geometrically in $J$ up to a controllable stochastic error floor.
- Implicit Regularization: In ablations, AdaDual-Lite sometimes matches or outperforms full AdaDual. Solving the local dual problem too accurately against an imperfect learned classifier can amplify local classifier errors, whereas a single stochastic update acts as implicit regularization.
Key Results
- Molecule Generation (QM9, $K=256$): Both constant and log-linear AdaDual schedules achieve a 2.86% constraint violation rate ($\text{Viol}_{3.0}$) and an 81.40% effective sample rate (valid and feasible), outperforming the best fixed-strength CBG ($\gamma=3$: 6.95% violation, 75.00% effective rate) and CDD (25.87% violation, 55.60% effective rate), while achieving the highest constraint-aware drug-likeness ($\text{QED}^* = 0.440\text{–}0.441$).
- Text Generation (RealToxicityPrompts, $K=512$): AdaDual reduces the toxicity violation rate to 19.4% (constant) and 19.2% (log-linear), beating both CDD (22.4%) and the unguided model (32.8%). Crucially, AdaDual maintains fluency with a perplexity (PPL) of 68.8–69.1 (even lower than the unguided model's 76.0), whereas CDD's PPL degrades sharply to 189.3.
Limitations and Future Work
- Classifier Imperfections: AdaDual's systematic error depends on the quality of the learned classifier $\widehat{r}_{t_k}$; over-optimizing against a noisy classifier can degrade sample quality.
- Hyperparameter Choices: The method requires specifying a budget schedule $\{C_k\}$ and a guidance range $\Gamma = [\gamma_{\min}, \gamma_{\max}]$.
- Future Directions: The authors suggest exploring automatic budget selection and extending AdaDual to handle multiple interacting constraints simultaneously.
Summary updated