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。