Composing Flow-Matching Energies with Known Physics: Generation, OOD Detection, and Inversion on PDE Fields

2026-08-18Machine Learning

Machine Learning
AI summary

The authors explore a method to model physical systems by combining data-driven knowledge with known physical laws using energy-based models (EBMs). They present a way to get explicit energy functions at different times without complex calculations, making it easier to generate samples, detect unusual data, and solve inverse problems. Their approach improves the accuracy of sampling and out-of-distribution detection by using both learned energies and physics-based information. This work also connects their energy functions with standard methods for inference in scientific problems.

energy-based modelsprobabilistic modelingflow matchingphysical fieldsout-of-distribution detectioninverse problemsMCMC samplingPDE residualsposterior samplingscore matching
Authors
Yixuan Sun, Anirban Samaddar, Sandeep Madireddy
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.