Generalized Constrained Flow Matching for Constraint-Aware Generative Modeling
Abstract
Generative models that satisfy hard constraints are essential in real-world applications, where physical laws or task requirements must be strictly enforced. Projection-based approaches guarantee feasibility but often distort the learned distribution, creating a mismatch between projected samples and the underlying data manifold. To mitigate this issue, existing methods introduce complex multi-stage procedures that apply projection to clean samples during sampling. However, these strategies typically increase complexity and suffer from error accumulation across steps. This paper addresses these challenges by proposing a novel training-free method, Chance Constrained Flow Matching (CCFM). CCFM integrates stochastic optimization into the sampling process, enabling efficient and concise enforcement of hard constraints while maintaining high sample quality. Importantly, CCFM guarantees feasibility in the same manner as conventional repeated projection and, despite operating directly on noisy intermediate samples, is theoretically equivalent to projecting onto the feasible set defined by clean samples. Numerical experiments show that CCFM achieves competitive performance in generating partial differential equation solutions.