Title: Physics-Constrained Flow Matching: Sampling Generative Models with Hard Constraints
Venue: NeurIPS 2025
Accepted: yes
Keywords: generative models

flow matching

scientific machine learning

hard constraints

conservation laws
Abstract: Deep generative models have recently been applied to physical systems governed by partial differential equations (PDEs), offering scalable simulation and uncertainty-aware inference. However, enforcing physical constraints, such as conservation laws (linear and nonlinear) and physical consistencies, remains challenging. Existing methods often rely on soft penalties or architectural biases that fail to guarantee hard constraints. In this work, we propose Physics-Constrained Flow Matching (PCFM), a zero-shot inference framework that enforces arbitrary nonlinear constraints in pretrained flow-based generative models. PCFM continuously guides the sampling process through physics-based corrections applied to intermediate solution states, while remaining aligned with the learned flow and satisfying physical constraints. Empirically, PCFM outperforms both unconstrained and constrained baselines on a range of PDEs, including those with shocks, discontinuities, and sharp features, while ensuring exact constraint satisfaction at the final solution. Our method provides a flexible framework for enforcing hard constraints in both scientific and general-purpose generative models, especially in applications where constraint satisfaction is essential.


Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper proposes a method to guide the inference-time generation process of a flow-based vector field model $v_\\theta$, which has been trained to simulate the behavior of physical systems governed by partial differential equations (PDEs), so that the outputs satisfy physical constraints such as initial/boundary conditions and conservation laws (both linear and nonlinear), without requiring retraining of $v_\\theta$.\nTo generate the state $u_\\tau$ for $\\tau \\in [0,1]$, the method first solves an ODE based on $v_\\theta$ forward from $u_\\tau$ to estimate $u_1$. The estimated $u_1$ is then projected onto the manifold defined by the given constraints using a Gauss–Newton projection. An ODE is then solved backward from the projected $u_1$ to determine a correction target for $u_\\tau$. Finally, a penalized correction (Eq. (6)) based on this target is applied to obtain the final corrected $u_\\tau$.\n\nThe proposed method is applied to functional flow models (FFMs) trained to simulate physical systems such as the Navier–Stokes and Burgers’ equations. The results show that the method produces outputs that numerically satisfy the imposed constraints with high accuracy. In contrast to existing approaches, which often struggle to strictly enforce nonlinear constraints, the proposed method successfully generates solutions that comply with them. Furthermore, enforcing these constraints improves performance on evaluation metrics such as mean squared error (MSE) and FPD.\n\nSTRENGTHS AND WEAKNESSES:\n### Strengths\n* The proposed method successfully imposes both linear and nonlinear physical constraints on flow-based generative models of physical systems in a zero-shot manner.  \n* The experiments demonstrate that the proposed method can generate solutions that satisfy the constraints, and that enforcing such constraints also improves the accuracy of the generated results.\n\n### Weaknesses\n* The proposed method shares a broadly similar procedure with the existing ECI framework, which limits its technical novelty. As far as I understand, the primary distinction lies in the correction step introduced in Eq. (6).\n* The experiments are limited to relatively small-scale settings with only two degrees of freedom.\n\nQUESTIONS:\n### Comments and Typos\nIt seems that an additional operation such as $u \\leftarrow u_{\\tau'}$ may be required after line 8 in Algorithm 1.\n\nAlgorithm 1 should be explicitly referenced and discussed in the main text.\n\nLine 127: constrained -> Constrained?\n\nLine 136: $\\mathcal{F}(u; \\phi)$ -> $\\mathcal{F}_{\\phi}(u)$?\n\nLIMITATIONS:\nSee weaknesses above.", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 2, "CLARITY": 3, "IMPACT": 4, "ORIGINALITY": 2, "DATE": "2025-06-26"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper presents Physics-Constrained Flow Matching, a method that enables arbitrary constraint enforcement on generative flow matching outputs through inference time constraint imposition. PCFM applies constraints by projecting the estimated final state $u_1$ (which is computed using a forward ODE solver) and then reversing the ODE to compute the next state $u_{\\tau'}$. As evaluated on a series of experiments evaluating performance on challenging PDE dynamics, PCFM outperforms baselines in qualitative metrics while ensuring perfect constraint adherence.\n\nSTRENGTHS AND WEAKNESSES:\nStrengths:\n1. **General Applicability (Significance):** The method provides several important selling points: *(1) Arbitrary Constraint Enforcement:* PCFM can handle arbitrarily complex constraint sets, a property which is demonstrated on complex PDE constraint enforcement, *(2) Inference-Time Method:* PCFM does not require retraining, so can be easily adopted by existing pretrained models.\n2. **Strong Empirical Performance (Significance):** PCFM reports strong results on the settings explored. The experimental settings are interesting, including varying degrees of constraint complexity on several different settings.\n3. **Writing and Presentation (Clarity):** The paper is well written and easy to follow. The method is presented clearly and well described.\n\nWeaknesses:\n1. **Inadequate Comparison to Similar Work (Originality, Quality):** The use of intermediate projections for continuous-time generative models is not a foreign concept in constrained generation literature [1-2]. For example, [2] applies projections to intermediate states in the diffusion reverse process, providing many of the same benefits that PCFM boasts (e.g., arbitrary constraint satisfaction, zero-shot constraint imposition). Furthermore, as a projection operator has already been designed for the PCFM's inference, it would be simple to add [2] as a baseline in the experiments. Due to the overlap between the methodology in these papers, a comparison would help clarify the novelty and performance claims.\n2. **Runtime Analysis (Significance):** PCFM relies on additional flow matching steps to balance constraint correction and sample quality. This (along with the complexity of computing the projection operator) likely contribute to much higher runtimes. Additional analysis should be included comparing the runtime of PCFM to the baselines. While the analysis in Appendix L.2 is interesting, it could be further expanded to include these computational overhead benchmarks as well.\n3. **Generality of PCFM (Significance):** The experimental analysis focuses on synthetic data for PDE governed dynamics. While synthetic data is generally sufficient for papers focusing on PDEs [3-4], PCFM is presented as a general method (e.g. lines 14-16, lines 67-71) for constraint satisfaction in other settings as well. These claims would be better supported by including \"real-world\" experiments to supplement the synthetic settings examined.\n\n\n---\n\n[1] Cheng, Chaoran, et al. \"Gradient-free generation for hard-constrained systems.\" (2025).\n\n[2] Christopher, Jacob K., Stephen Baek, and Nando Fioretto. \"Constrained synthesis with projected diffusion models.\" Advances in Neural Information Processing Systems 37 (2024): 89307-89333.\n\n[3] Huang, Jiahe, et al. \"DiffusionPDE: Generative PDE-solving under partial observation.\" arXiv preprint arXiv:2406.17763 (2024).\n\n[4] Ben-Hamu, Heli, et al. \"D-flow: Differentiating through flows for controlled generation.\" arXiv preprint arXiv:2402.14017 (2024).\n\nQUESTIONS:\nQuestions:\n1. Has any analysis been taken for out-of-distribution constraints (e.g., constraints that aren't necessarily satisfied by the training data)?\n2. Can the authors elaborate further on the SMSE performs worse as the number of flow matching steps increases? It seems intuitive that the MMSE decreases as the number of steps increases, but I'm having trouble reasoning as to its impact on SMSE.\n\nLIMITATIONS:\nThe primary limitation that seems to be missing is an explanation of the impact of PCFM on runtime. It would be helpful if the authors could comment on this point.", "TITLE": "Official Review", "RECOMMENDATION": 4, "REVIEWER_CONFIDENCE": 4, "CLARITY": 3, "IMPACT": 2, "ORIGINALITY": 2, "DATE": "2025-07-01"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper proposes Physics-Constrained Flow Matching (PCFM), a zero-shot inference framework to enforce physical constraints  in flow-based generative models. PCFM corrects intermediate and final samples by projecting onto the constraint manifold, without requiring retraining or access to constraint gradients during training.\n\nSTRENGTHS AND WEAKNESSES:\nStrengths:\n\n- The shock fronts phenomenon when solving the Burgers's equation in Fig.1 are quite impressive.\n- The paper identifies a core challenge in generative surrogate modeling for physics\n- The writing is clear and easy to follow.\n\nWeaknesses:\n\n- I believe the term *hard constraint* may be an overstatement. In my view, a constraint can only be classified as *hard* if it is mathematically satisfied exactly (i.e., equals zero). Since your method merely reduces the violation to a small value rather than eliminating it entirely, it might be more appropriate to refer to it as a *soft constraint* or an *approximate hard constraint*.\n- I am curious about the necessity of projecting the guess from intermediate flow states onto the constraint manifold. Given that physical constraints are typically imposed only on the final state, it is unclear what benefits such intermediate projections provide. Moreover, unless the constraint function h is affine, your projection step does not generally yield an exact solution on the target physics manifold. A more detailed justification would be helpful.\n- In line 54, you mention that some methods require backpropagation through expensive PDE operators. However, your projection step also appears to be computationally intensive. It would be beneficial to include a comparison of computational time and memory consumption between your method and those baselines, to better contextualize the trade-offs involved.\n- Could you provide additional qualitative comparisons between your method and all baseline models on the Navier-Stokes dataset? The other datasets used in your paper are relatively simple, which may limit the generalizability of your conclusions. Furthermore, experiments on higher-resolution or more complex datasets are highly recommended to more robustly demonstrate the effectiveness of your approach.\n\nQUESTIONS:\nSee Weaknesses\n\nLIMITATIONS:\nSee Weaknesses", "TITLE": "Official Review", "RECOMMENDATION": 4, "REVIEWER_CONFIDENCE": 4, "CLARITY": 3, "IMPACT": 2, "ORIGINALITY": 3, "DATE": "2025-07-02"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis work proposes Physics-Constrained Flow Matching (PCFM), a zero-shot inference framework for enforcing arbitrary nonlinear equality constraints in pretrained flow-based generative models. PCFM combines flow-based integration, tangent-space projection, and relaxed penalty corrections to strictly enforce constraints while staying consistent with the learned generative trajectory. This approach supports both local and global constraints, including conservation laws and consistency constraints, without requiring retraining or architectural changes. Empirically, PCFM outperforms state-of-the-art baselines across diverse PDEs, including systems with shocks and nonlinear dynamics, achieving lower error and exact constraint satisfaction.\n\nSTRENGTHS AND WEAKNESSES:\nI do not have enough background to review the paper. Here are a few comments:\n\n**Strengths**\n\n1. The \"shoot-project-reverse\" cycle designed in this work looks novel. This work presents an effective solution for satisfying the strict physical laws required when applying generative models to physical systems. It enforces complex, nonlinear equality constraints as hard requirements in a general way during the inference stage alone, without requiring to retrain the model or modify its architecture to introduce biases.\n\n2. Empirical results in Table 3 looks promising. The proposed method seems much better than the existing counterparts. \n\n**Weaknesses**\n\n1.  In the step of forward shooting and projection, the cost depends on forming the constraint Jacobian, $J = \\nabla h(u_1)$. For high-dimensional, complex, and non-local physical constraints, does constructing the Jacobian $J$ lead to a computational explosion?\n\nQUESTIONS:\n1.  A practical comparison of wall-clock inference times against the baselines would provide a more concrete sense of the computational efficiency of PCFM.\n\nLIMITATIONS:\nN/A", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 1, "CLARITY": 3, "IMPACT": 3, "ORIGINALITY": 3, "DATE": "2025-07-17"}