Deep generative models such as flow matching and diffusion models have shown great potential in learning complex distributions and dynamical systems, but often act as black-boxes, neglecting underlying physics. In contrast, physics-based simulation models described by ODEs/PDEs remain interpretable, but may have missing or unknown terms, unable to fully describe real-world observations. We bridge this gap with a novel grey-box method that integrates incomplete physics models directly into generative models. Our approach learns dynamics from observational trajectories alone, without ground-truth physics parameters, in a simulation-free manner that avoids scalability and stability issues of Neural ODEs. The core of our method lies in modelling a structured variational distribution within the flow matching framework, by using two latent encodings: one to model the missing stochasticity and multi-modal velocity, and a second to encode physics parameters as a latent variable with a physics-informed prior. Furthermore, we present an adaptation of the framework to handle second-order dynamics. Our experiments on representative ODE/PDE problems and real-world weather forecasting demonstrate that our method performs on par with or superior to fully data-driven approaches and previous grey-box baselines, while preserving the interpretability of the physics model. Our code is available at https://github.com/DMML-Geneva/VGB-DM.
Figures & tables
Figure 1: Probabilistic graphical model of variational grey-box models. Shaded circles are observed variables, empty dashed circles are latent variables, and dashed arrows indicate learned inference dependencies.
Figure 2: Overview of the Variational Grey-Box Dynamics Matching (VGB-DM) framework.
Model
Pendulum ( ×10−2 )
RLC ( ×10−1 )
Reaction Diffusion ( ×10−3 )
Lorenz ( ×10−1 )
PhysVAE [ 12 ]
0.417±0.001
0.29±0.01
7.4±1.3
13.12±1.27
VBB-DM [ 3 ]
1.058±0.004
0.38±0.03
8.0±1.1
9.91±1.22
BB-NODE [ 2 ]
0.452±0.001
0.39±0.04
7.5±0.5
22.15±7.84
TFM [ 17 ]
0.348±0.001
0.26±0.01
8.5±2.8
9.85±1.32
Ours
0.283±0.001
0.23±0.01
7.1±0.9
4.68±0.16
Table 1: Forecasting performance comparison (MSE). Results on four dynamical systems benchmarks. Our method achieves the lowest error across all tasks.
Figure 3: Optimization convergence analysis. Forecast log MSE vs. training time (minutes) for the Pendulum (left), RLC (center), and Reaction-Diffusion (right) tasks using the largest training dataset size. Our method demonstrates significantly faster convergence and achieves lower final error compared to simulation-based methods (PhysVAE, BB-NODE), while also exhibiting better stability than the black-box dynamics matching baseline (VBB-DM). This highlights the benefit of avoiding backpropagation through the ODE solver.
Figure 4: Sample efficiency analysis. Forecast MSE across varying training sample sizes for Pendulum, RLC, and Reaction-Diffusion tasks. Grey-box methods (Ours and PhysVAE) consistently outperform their black-box counterparts (VBB-DM and BB-NODE) across all regimes, with our method achieving the lowest error and variance, particularly under limited data.
Figure 5: Residual maps for weather forecasting Visualization of absolute error maps between ground truth and predicted fields for five meteorological variables (Ours vs ClimODE)
Figure 6: Forecasting performance over 42 hours. Latitude-weighted RMSE (top, lower is better) and ACC (bottom, higher is better) for ERA5 dataset. Our method performs better or on par than ClimODE.
Figure 7: Long-term forecasting performance over 5 months. Latitude-weighted RMSE for ERA5 dataset over an extended period. Our method outperforms ClimODE by mitigating compounding errors over long horizons, with the performance gap widening as the forecast horizon extends.
Figure 8: Overview of the Variational Grey-Box Dynamics Matching (VGB-DM) framework.
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 9: Parameter identification (inference) vs. forecasting performance across the three dynamical systems (lower RMSE is better).
Experiment
FM
Ph-KL
Z-KL
Pendulum
3.9×10−5±1.8×10−5
8.8×10−4±1.1×10−4
2.5±0.22
RLC
0.52±0.03
3.4±1.4
0.70±0.001
RD
3×10−3±1×10−3
2.7±1.1
2×10−3±2×10−4
Lorenz
3.8±1.5
2.3±0.8
0.003±0.001
Appendix
Table 2: Evaluation of the N-ELBO terms
Exp
Phys. Params. CV
RLC
0.0461, 0.0391
Pendulum
0.0496
Reaction–Diffusion
0.0072, 0.0031
Lorenz
0.0012, 0.0026
Appendix
Table 3: Median consistency of physics parameters across trajectory segments (test set).
Type
Variable name
Abbrev.
ECMWF ID
Levels
Static
Land-sea mask
lsm
172
Single
2 metre temperature
t2m
167
Single
10 metre U wind component
u10
165
Single
10 metre V wind component
v10
166
Atmospheric
Geopotential
z
129
500
Atmospheric
Temperature
t
130
850
Appendix
Table 4: ECMWF data variables from ERA5 used in our dataset. Static variables are time-independent, Single represents surface-level variables, and Atmospheric represents time-varying atmospheric properties at chosen altitudes.
Figure 10: Diagram of the Velocity model architecture (left) and its lightweight attentions mechanism (right)
Figure 11: Example of Climate forecasting using VGB-DM over 42 hours.
Deep generative models such as flow matching and diffusion models have shown potential for learning complex dynamical systems, but typically act as black boxes that neglect underlying physical structure, while physics-based models governed by partial differential equations are often incomplete due to missing source terms, or uncertain parametrisations. We present Climate Physics Dynamic Matching (ClimPhyDM), a variational simulation-free dynamics informed framework for weather forecasting that combines an advection-type physics prior with data-driven components in a variational framework. % to capture the stochasticity and multi-modality of unresolved atmospheric dynamics. On the ERA5 benchmark at hourly (42-hour) and monthly (5-month) resolutions, ClimPhyDM outperforms ClimODE, and GB-DM, keeping the lower error at extended horizon, indicating improved temporal stability and resistance to error accumulation, while its simulation-free paradigm also enables training on a single modest 12 GB consumer GPU.
Sampling from Flow Matching generative models requires solving an ordinary differential equation (ODE) whose computational cost is dominated by neural network forward passes. We derive four classical ODE solvers -- Euler, Explicit Midpoint, Classical Runge-Kutta (RK4), and Dormand-Prince 5(4) -- from first principles via Taylor expansion, implement them from scratch in PyTorch, and systematically benchmark their efficiency on Conditional Flow Matching tasks ranging from 2D toy distributions to MNIST digits. On the quantitative side, we use sliced Wasserstein distance to construct NFE-quality Pareto frontiers,finding that RK4 at 80 function evaluations achieves sample quality comparable to Euler at 200. Beyond reproducing known convergence rates, we report two empirical observations: (1) the Jacobian eigenvalue spectrum of the learned velocity field stiffens sharply near t=1, explaining why the adaptive Dormand-Prince solver automatically concentrates its step budget at the end of the trajectory; (2) the quality gap between low-order and high-order solvers widens for undertrained and smaller models, indicating that solver choice matters most when the model is imperfect. Code and all experiment scripts are publicly available.
Generative models have emerged as a powerful paradigm for solving physics systems and modeling complex spatiotemporal dynamics. However, achieving high physical accuracy without incurring high computational cost remains a fundamental challenge, as existing approaches face a critical speed-fidelity trade-off. In this work, we introduce Recursive Flow Matching (RecFM), a generative framework for forecasting complex spatiotemporal dynamics. RecFM enforces self-consistency to align trajectories across discretization scales, reducing discretization errors and improving performance across metrics for physics-based tasks. To our knowledge, this is the first method to achieve high-fidelity one- and few-step (2-4 step) dynamic generation for scientific systems with performance comparable to state-of-the-art multi-step solvers. Across challenging scientific benchmarks, RecFM achieves up to a 20× speedup over leading diffusion-based emulators while improving predictive accuracy. Furthermore, RecFM reduces mean squared error by over 15% compared to vanilla flow matching, offering a scalable and efficient solution for real-time scientific emulation.
Jiahe Huang, Sihan Xu, Sharvaree Vadgama +1
University of California, San Diego · University of Michigan