Composing Flow-Matching Energies with Known Physics: Generation, OOD Detection, and Inversion on PDE Fields
Organizations: Mathematics and Computer Science, Argonne National Laboratory
Abstract
Probabilistic modeling of physical fields benefits from both a data-driven prior and known physical structure such as the governing equations. Energy-based models (EBMs) are a natural fit since energies compose additively, which enables augmenting physics information during inference. However, EBMs have been difficult to train and sample from due to the intractable partition function. We show in this work that flow matching models with a potential-induced velocity yield an explicit scalar energy at all transport times, whose gradient is exactly the converted learned score and which recovers the marginal negative log-density at the population optimum. The time-dependent energy functions are obtained purely from the matching regression objective on an independent linear Gaussian interpolation, without a variational form or additional MCMC steps, and the sampling retains the flow ODE. Access to the energy function from a trained model serves three roles: energy-corrected data generation, energy as a scoring function for out-of-distribution (OOD) detection, and energy compositional posterior sampling for inverse problems. In particular, we show the explicit energy permits general MCMC samplers in the predictor-corrector sampling framework, reducing PDE residual and spectral distance compared to the flow ODE baseline. Furthermore, we demonstrate utilizing the data energy and physics-based energy (e.g., PDE residuals) as complementary mechanisms to improve detection accuracy for OOD tasks. In addition, we explore the connection to MCMC-based inference for inverse problems by composing the energy with a quadratic observational likelihood that yields a posterior energy, used as an explicitly chosen family of inference-time targets.
Figures & tables
| Dataset | Sampler | NFE | Sliced- | Spectral | PDE resid | MMSE | SMSE |
|---|---|---|---|---|---|---|---|
| Poisson | ODE120 | 120 | |||||
| ODE240 | 240 | ||||||
| ODE360 | 360 | ||||||
| Standard PC | 240 | ||||||
| EnergyPC-ULA (ours) | 240 | ||||||
| EnergyPC-MALA (ours) | 360 |
| Poisson | Helmholtz | Burgers | |||||||
|---|---|---|---|---|---|---|---|---|---|
| OOD tier | |||||||||
| Gaussian noise | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| Noise ( field std) | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | |
| Noise ( field std) | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| Channel shuffle | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | – | – | – | |
| Cross-PDE | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | – | – | – |
| Dataset | Method | aRE | uRE |
|---|---|---|---|
| Poisson | DiffusionPDE | ||
| + -ULA | |||
| + -MALA | |||
| FlowDPS | |||
| + -ULA | |||
| + -MALA |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Sampler | physics | NFE | Sliced- | PDE resid |
|---|---|---|---|---|
| ODE120 † | – | 120 | 0.0532 | 13.66 |
| ODE + ULA polish | terminal | 220 | 0.0408 | 10.33 |
| ODE + MALA polish | terminal | 320 | 0.0409 | 7.17 |
| Annealed + -sched | gated | 1752 | 0.0880 | 1.15 |
| Sampler | physics | NFE | Sliced- | PDE resid |
|---|---|---|---|---|
| ODE120 † | – | 120 | 0.0521 | 3.59 |
| ODE + ULA polish | terminal | 220 | 0.0531 | 2.58 |
| ODE + MALA polish | terminal | 320 | 0.0513 | 2.54 |
| Annealed + -sched | gated | 1752 | 0.1928 | 7.73 |
Physics-Informed Generative Modeling
Physics-informed generative modeling uses physical laws and data-driven generators to create plausible samples and solve scientific inverse problems.
See all 108 papers