Research area guide · Fioretto Lab

Constraint-aware
generative AI

How to make diffusion and flow-matching models obey physics, geometry, logic, and safety requirements—without giving up the diversity that makes generative models useful.

8 projects synthesized 4 application areas ~18 min read
The recurring idea
Denoise
Correct
Learned priorConstraint set

Let the model propose. Let optimization enforce. Repeat throughout generation.

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.

The thesis Generation should be treated as a constrained decision process—not as “sample first, repair later.”

Our work inserts constraint enforcement inside the generative trajectory so that plausibility and feasibility are negotiated at every step.

A

Generate, then filter

Simple, but wastes samples and can collapse diversity when feasible outputs are rare.

B

Condition or retrain

Powerful when data and compute are abundant, but expensive and tied to a particular constraint family.

C

Constrain while sampling

Wrap a pretrained model with projections, proximal steps, solvers, or simulators that steer each generation.

Figure 1 Standard sampling can leave the feasible set even when the output remains visually plausible. Constraint-aware sampling repeatedly returns the trajectory toward the set of valid solutions.

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.\]
In plain language

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.

Figure 2 The reusable pattern: a learned generative update alternates with an explicit feasibility update throughout the reverse process.
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.

100%protein constraint satisfaction
4.6×better stress–strain error
100robots planned jointly
0%toxicity-rule violations
Application 01

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.

Constraint satisfaction100%vs. 0% for all three baselines
Usable pocket designs97.8%about 4× the nearest baseline
Well-posed ligands83%viable motif-scaffolding designs
Figure 3 Constraint-aware RFdiffusion preserves the required functional geometry and produces usable structures where unconstrained and guided baselines fail the global constraints.
Application 02

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.

Figure 4a A learned surrogate checks physical requirements at every denoising step.
Figure 4b Samples move toward a target stress–strain response while invalid geometries fall to 5%.
Morphometric violations0%vs. 68.4% for conditional diffusion
Stress–strain MSE1.4 ± 0.64.6× better than a specialized baseline
Safety compliance90%vs. 67% for conditional diffusion
Application 03

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.

Basic
Dense
Corridor
Shelf
Room

Figure 5 Motion is the one place where animation materially improves understanding: feasibility is about an entire trajectory, not a single final frame.

Dense-map success96%vs. 27% for the best baseline
Maximum scale100 robotswith 104 obstacles
DGD speedup20×over SMD on comparable settings
Application 04

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.

Figure 6 Constraint checks accompany the progressive unmasking process, so the final molecule respects the specified rules.
Rule violations0%for toxicity, counting, and lexical tests
Novel safe molecules392vs. 108 for MDLM and 5 autoregressively
Beyond chemistryCodesyntax and semantic structure constraints

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.

Continuous models

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 →
Discrete models

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 →
Figure 7 CAFM aligns the learned velocity field with the constrained sampling path instead of correcting an unconstrained field only at inference.

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.

01

Evaluator fidelity. How should uncertainty in learned surrogates or approximate simulators propagate into a feasibility claim?

02

Competing constraints. What happens when requirements are mutually inconsistent, or feasibility leaves too little room for diversity?

03

Non-convex scale. Can local projection and decomposition methods retain useful guarantees on the largest scientific design spaces?

04

Training–sampling alignment. When is a training-free wrapper enough, and when is end-to-end constraint-aware training worth the added cost?

The broader principle A generative model supplies a prior over plausible designs. Domain constraints turn that prior into a decision-making tool.

Follow the research program