A realistic sample is not necessarily a valid one
Diffusion models are excellent at learning what their training data looks like. Scientific and engineering systems demand something stricter: every output may also need to satisfy equations, geometric relationships, safety margins, or logical rules.
That distinction is easy to miss. A protein backbone can look natural while violating a bond-angle requirement. A robot path can be smooth while crossing an obstacle. A generated material can resemble the training distribution while having impossible interatomic distances.
Our work inserts constraint enforcement inside the generative trajectory so that plausibility and feasibility are negotiated at every step.
Generate, then filter
Simple, but wastes samples and can collapse diversity when feasible outputs are rare.
Condition or retrain
Powerful when data and compute are abundant, but expensive and tied to a particular constraint family.
Constrain while sampling
Wrap a pretrained model with projections, proximal steps, solvers, or simulators that steer each generation.
Turn every denoising step into a small constrained optimization problem
A diffusion model gradually transforms noise \(x_T\) into a structured sample \(x_0\). One view of a reverse step is noisy ascent along the model’s learned score:
\[x_t \leftarrow x_t + \gamma_t \nabla_{x_t} \log p(x_t) + \sqrt{2\gamma_t}\,\epsilon.\]If valid outputs live in a set \(C\), we can pair that model step with a projection:
\[\mathcal{P}_C(x_t) = \arg\min_{y \in C} \lVert y-x_t \rVert_2^2.\]The model says, “this direction looks more like the data.” The constraint operator replies, “this nearby point is valid.” Repeating that conversation lets the pretrained model supply realism while optimization supplies guarantees.
Technical depth: what changes when constraints are difficult?
Convex constraints. Exact projections are often efficient, and the distance to the feasible set can be shown to contract. Under the assumptions in our analysis, an \(\varepsilon\)-feasible sample is reached in \(\mathcal{O}(\gamma_{\min}^{-1}\log(1/\varepsilon))\) steps.
Non-convex constraints. Augmented Lagrangian and ADMM-style updates replace a single exact projection with local primal–dual corrections.
Latent-space models. A constraint such as porosity or stress is evaluated after decoding \(z_t\), then differentiated back through the decoder. This makes the constraint visible to a model operating in a compressed representation.
Black-box simulators. When a finite-element or physics simulator is not differentiable, calibrated perturbations estimate a useful correction direction.
One principle, several kinds of constraints
The framework is best understood as a research program rather than a single algorithm. Different domains change the representation, the constraint operator, and the appropriate solver—but preserve the same division of labor between a learned prior and explicit domain knowledge.
Protein design with hard structural constraints
The challenge is not merely to generate a plausible backbone. It is to preserve the exact geometric relationships that make a functional motif work while allowing the surrounding scaffold to vary.
Our constrained RFdiffusion work combines proximal feasibility updates with ADMM decomposition. On a benchmark for PDZ-domain motif scaffolding and pocket design, it achieved 100% satisfaction of bonding and geometric constraints, compared with 0% for three baselines across nearly 100,000 generated samples.
Read the paper · Christopher et al., ICLR 2026 →
Materials discovery with properties in the loop
Material validity is often revealed only by an expensive evaluator: a stress–strain simulation, an energy model, or a structural surrogate. The constraint operator can turn that evaluator into feedback during sampling.
Across microstructure generation, mechanical metamaterial design, and safety-aware image generation, latent constrained diffusion improves feasibility without retraining the base model. The key move is to evaluate a property after decoding and propagate the resulting correction back to the latent sample.
Read the paper · Zampini et al., NeurIPS 2025 Spotlight →
Safe motion planning at generative speed
A multi-robot plan must satisfy many coupled constraints at once: obstacles, inter-robot collisions, velocity and acceleration limits, and the dynamics connecting one state to the next.
SMD projects diffusion trajectories toward simultaneous feasibility. On dense nine-robot maps it reaches 96% success, versus 27% for the best baseline. DGD adds guidance from a discrete multi-agent path-finding solver, decomposing a difficult non-convex problem into tractable subproblems and scaling to 100 robots.
Figure 5 Motion is the one place where animation materially improves understanding: feasibility is about an entire trajectory, not a single final frame.
Read the papers · SMD, ICML 2025 · DGD, AAAI 2026 →
Constraints in discrete spaces: molecules, text, and code
In discrete diffusion, “move to the nearest feasible point” cannot mean nudging coordinates. It means changing probability mass over tokens without destroying the model's learned preferences.
Constrained Discrete Diffusion (CDD) projects token probabilities onto a feasible region while minimizing KL divergence from the model’s original logits. This allows rules such as chemical valency, toxicity thresholds, token counts, or syntax to be enforced during generation.
Read the papers · CDD, NeurIPS 2025 · Constrained code generation, 2026 →
From correcting a pretrained model to training for constraints
Training-free guidance is flexible, but it creates a mismatch: the model learns unconstrained trajectories during training and encounters projected trajectories only at inference. Two newer directions attack that mismatch from opposite sides.
Constraint-Aware Flow Matching
CAFM includes projection in the training objective, teaching the velocity field to anticipate the constrained sampler. The aim is a better quality–feasibility trade-off with strict per-sample guarantees.
Christopher et al., 2026 →Search-Augmented Diffusion
SearchDiff combines masked diffusion with tree search, spending extra computation to explore alternative token sequences when direct projection is not enough.
Ta et al., 2026 →
What guarantees do—and do not—buy us
Constraint satisfaction is only as meaningful as the constraint itself. A mathematically feasible output can still be undesirable if the evaluator is incomplete, misspecified, or only a surrogate for the real scientific objective.
Evaluator fidelity. How should uncertainty in learned surrogates or approximate simulators propagate into a feasibility claim?
Competing constraints. What happens when requirements are mutually inconsistent, or feasibility leaves too little room for diversity?
Non-convex scale. Can local projection and decomposition methods retain useful guarantees on the largest scientific design spaces?
Training–sampling alignment. When is a training-free wrapper enough, and when is end-to-end constraint-aware training worth the added cost?