Physics-constrained generative modeling aims to produce high-dimensional samples that are both physically consistent and distributionally accurate, a task that remains challenging due to often conflicting optimization objectives. Recent advances in flow matching and diffusion models have enabled efficient generative modeling, but integrating physical constraints often degrades generative fidelity or requires costly inference-time corrections. Our work is the first to recognize the trade-off between distributional and physical accuracy. Based on the insight of inherently conflicting objectives, we introduce Physics-Based Flow Matching (PBFM) a method that enforces physical constraints at training time using conflict-free gradient updates and unrolling to mitigate Jensen's gap. Our approach avoids manual loss balancing and enables simultaneous optimization of generative and physical objectives. As a consequence, physics constraints do not impede inference performance. We benchmark our method across three representative PDE benchmarks. PBFM achieves a Pareto-optimal trade-off, competitive inference speed, and generalizes to a wide range of physics-constrained generative tasks, providing a practical tool for scientific machine learning. Code and datasets available at https://github.com/tum-pbs/PBFM.
翻译:物理约束生成建模旨在生成既满足物理一致性又具备分布准确性的高维样本,由于优化目标常存在冲突,该任务仍具挑战性。流匹配与扩散模型的最新进展实现了高效的生成建模,但引入物理约束常会降低生成保真度或需依赖昂贵的推断时校正。本研究首次明确指出分布准确性与物理准确性之间的权衡关系。基于目标函数内在冲突的洞见,我们提出基于物理的流匹配方法,该方法在训练时通过无冲突梯度更新与展开技术来强制执行物理约束,以缓解詹森间隙。我们的方法避免了人工损失平衡,并实现了生成目标与物理目标的同步优化。因此,物理约束不会影响推断性能。我们在三个典型偏微分方程基准测试中评估了该方法。PBFM实现了帕累托最优权衡,具备有竞争力的推断速度,并能泛化至广泛的物理约束生成任务,为科学机器学习提供了实用工具。代码与数据集详见 https://github.com/tum-pbs/PBFM。