Generative models excel at synthesizing high-fidelity samples from complex data distributions, but they often violate hard constraints arising from physical laws or task specifications. A common remedy is to project intermediate samples onto the feasible set at each sampling step. However, repeated projection can disrupt the learned sampling dynamics because this feasible set is defined for clean samples rather than noisy intermediate states. Thus, recent studies first estimate clean samples and then project them to the feasible set, but this increases algorithmic complexity and accumulates errors across steps. To address these issues, this paper proposes Chance-constrained Flow Matching (CCFM), a training-free method that formulates constraint enforcement during sampling as stochastic optimization while retaining the hard-constraint feasibility guarantee of projection-based methods. By avoiding direct projection of noisy intermediate states onto the clean-sample feasible set, CCFM mitigates the distributional distortion. Unlike approaches that first estimate and project clean samples, CCFM avoids complex multi-stage procedures. Experiments show that CCFM outperforms current state-of-the-art constrained generative models in modeling complex physical systems governed by partial differential equations, molecular docking problems, and physics-informed motion generation, delivering superior feasibility and fidelity.
Figures & tables
Figure 1: Overview of chance-constrained flow matching (CCFM). Solid arrows follow the sampling path; dashed arrows indicate projection steps. In CCFM, early states remain unchanged ( xt1 ), intermediate states are minimally corrected ( xt2→xt2′ ), and the final state is guaranteed feasible ( x1′ ) in a high-probability region. Repeated projection distorts the sampling path. ECI sampling relies on the quality of one-step prediction and may project outside high-probability regions.
Method
W2 distance ( ↓ )
Branch-mass Error ( ↓ )
RP
1.026
0.231
ECI
2.695
0.152
Post-only projection
0.671
0.080
CCFM (ours)
0.412
0.0248
Figure 2: Two-dimensional example results over five runs.
#S
#Stp
Methods
L-RMSD (%)
A-RMSD (%)
PB Valid (%)
Running
<1A˚
<2A˚
<2A˚
All
+L <2 Å
+A <2 Å
Time (s)
1
2
CCFM
8.19
32.20
74.01
47.74
22.03
35.88
0.64
FlexDock
7.06
31.36
73.73
20.34
9.32
14.97
0.52
RP
6.78
31.07
73.73
19.49
9.32
14.69
0.73
10
2
CCFM
14.69
37.01
74.86
67.51
31.36
51.98
4.34
FlexDock
12.99
38.14
73.16
43.50
21.19
33.05
4.20
Table 1: PDBBind docking results. #S denotes the number of samples generated per complex, with the best pose selected for evaluation; #Stp is the number of inference steps. L-RMSD/A-RMSD report fractions of complexes below the given thresholds, PB Valid is the proportion passing PoseBusters checks, with +L and +A further requiring L-RMSD <2 Å or A-RMSD <2 Å, respectively.
Figure 3: Structures generated by CCFM (ours) and FlexDock. CCFM enforces the ligand–protein distance constraint, while FlexDock violates it.
Problem
Metric
CCFM
PCFM
DPDE
FFM
RP
RD
MMSE ×10−2 ( ↓ )
3.3
3.6
5.2
5.3
8.1
SMSE ×10−2 ( ↓ )
2.7
2.9
3.8
3.8
8.5
CV (IC) ×10−2 ( ↓ )
0
0
8.0
8.2
0
CV (CL) ×10−15 ( ↓ )
9.5
9.5
3.9 ×1010
3.9 ×1010
10.8
NS
MMSE ×10−1 ( ↓ )
0.8
1.7
1.4
1.5
1.0
SMSE ×10−1 ( ↓ )
0.8
1.6
8.8
9.0
0.9
Table 2: Comparison of model performance in solution generation tasks for 1D Reaction–Diffusion equation and 2D Navier–Stokes equation across metrics. A lower value indicates better performance. Bold indicates the best (smallest) value in each row.
Figure 4: MMSE (the darker the better) of Reaction–Diffusion solutions over physical time, with the horizontal axis representing time evolution and the vertical axis indicating errors at each point.
Figure 5: MMSE (the darker the better) of Navier–Stokes solutions over physical time, downsampled from 50 to 25 frames for clarity. Each frame corresponds to the error at a given physical time.
Unconstrained
RP
CCFM
Constraint Violation (MSE) ( ↓ )
278.46
0.8333
0.0100
FID ( ↓ )
16.985
27.184
26.767
Table 3: Comparison of model performance in the physics-informed motion task.
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
Table 9
Mean
Median
95th percentile
0.8622%
0.8544%
1.2987%
Appendix
Table 6: Normalized deviations from straight interpolation between the initial noise and clean sample.
Figure 6: Comparison of CCFM (solid lines) and FlexDock (dashed lines) under different sampling budgets and evaluation metrics.
Metric
CCFM(0.7)
CCFM(0.9)
CCFM(1.0)
CCFM(1.1)
CCFM(1.3)
PB Valid ( +L <2 Å )
29.85
30.16
30.79
30.48
30.48
PB Valid ( +A <2 Å )
58.19
57.85
58.19
58.19
58.88
Appendix
Table 7: Sensitivity analysis for probability of constraint satisfaction. The probability is determined by the function ϕn(t)=21tn , and we adjust n to observe the results. Results are reported using #S=1 and #Stp=10. PB Valid (+L <2 Å or +A <2 Å) denotes the percentage of physically valid samples that also satisfy the respective RMSD thresholds.
Methods
L-RMSD (%)
A-RMSD (%)
PB Valid (%)
<1A˚
<2A˚
<2A˚
All
+L <2 Å
+A <2 Å
CCFM
7.80±(0.31)
32.57±(0.57)
72.27±(0.69)
79.15±(0.41)
30.45±(0.68)
58.53±(0.49)
FlexDock
7.45±(0.43)
31.92±(0.81)
72.65±(0.81)
58.07±(1.24)
24.57±(1.13)
40.96±(1.38)
RP
7.80±(0.34)
32.19±(0.79)
72.26±(0.99)
56.48±(0.72)
27.68±(0.81)
42.93±(0.85)
Appendix
Table 8: PDBBind docking results with standard deviation (#S=1, #Stp=10).
Figure 7: Visualization for the generated complexes(6HHR, 6I65, 6I66, 6JSE, 6JSG, and 6OD6) from the PDBBind test dataset. Predicted protein structures are shown in pink, predicted ligands in teal, ground-truth proteins in dark blue, and ground-truth ligands in melon.
Problem
Metric
CCFM (ours)
PCFM
Reaction–Diffusion
Running Time (s) ( ↓ )
2.703
3.874
Navier–Stokes
Running Time (s) ( ↓ )
3.065
3.077
Appendix
Table 9: Comparison of running time between CCFM and PCFM on Reaction–Diffusion and Navier–Stokes equations.
Problem
Metric
CCFM (0.1)
CCFM (0.3)
CCFM (0.5)
CCFM (0.7)
CCFM (0.9)
Reaction–Diffusion
MMSE ×10−2 ( ↓ )
3.6
3.6
3.3
3.2
3.2
SMSE ×10−2 ( ↓ )
2.8
2.9
2.7
2.6
2.6
CV (IC) ×10−2 ( ↓ )
0
0
0
0
0
CV (CL) ×10−15 ( ↓ )
9.9
9.6
9.5
9.5
9.5
Appendix
Table 10: Sensitivity analysis for probability of constraint satisfaction. The probability is determined by the function ϕn(t)=21tn , and we adjust n to observe the results.
Figure 8: Comparison of generated solutions for the Reaction–Diffusion equation in terms of MMSE varying with physical time.
Figure 9: SMSE of Reaction–Diffusion solutions over physical time, with the horizontal axis representing time evolution and the vertical axis indicating the state at each time step.
Figure 10: Example solution fields of the Reaction–Diffusion equation generated using the models compared with the ground truth.
Figure 11: Comparison of generated solutions for the Navier–Stokes equation in terms of MMSE varying with physical time.
Figure 12: MMSE (the darker the better) of Navier–Stokes solutions over physical time with all 50 frames. Each frame corresponds to the system state at a given physical time.
Figure 13: SMSE (the darker the better) of Navier–Stokes solutions over physical time with all 50 frames. Each frame corresponds to the system state at a given physical time.
Figure 14: Point-wise averaged residuals (the lighter the better) of Navier–Stokes solutions over physical time with all 50 frames. Each frame corresponds to the system state at a given physical time.
Figure 15: Example solution fields of the Navier–Stokes equation generated using the models compared with the ground truth.
Problem
Metric
CCFM (ours)
PCFM
DiffusionPDE
FFM
RP
Navier–Stokes
MMSE ×10−1 ( ↓ )
0.79±(0.03)
1.67±(0.09)
1.44±(0.10)
1.56±(0.16)
1.08±(0.08)
SMSE ×10−1 ( ↓ )
0.81±(0.11)
1.53±(0.18)
9.21±(0.39)
9.57±(0.53)
0.97±(0.25)
CV (IC) ( ↓ )
0
0
0.12±(0.03)
0.13±(0.08)
0
CV (CL) ×10−15 ( ↓ )
3.9±(0.01)
3.4±(0.02)
1.2±(0.13)×1010
1.2±(0.12)×109
4.1±(0.04)
Appendix
Table 11: Results with standard deviations for solution generation on the 2D Navier–Stokes equation. A lower value indicates better performance. Bold indicates the best value in each row.
Figure 16: Generated trajectories instances for the physics-informed motion generation. In each frame, the black solid objects are generated using three constraint-handling approaches. The red circles represent the correct locations of objects under Moon gravity.