On the flow matching interpretability

Francesco Pivi, Simone Gazza, Davide Evangelista, Roberto Amadini, Maurizio Gabbrielli · DOI

Introduction

Generative models, particularly Diffusion and Flow Matching, have achieved remarkable success in creating complex data. However, these models often function as "black boxes." While the transformation from noise to data is mathematically defined, the intermediate trajectories lack clear semantic or physical meaning. This "interpretability gap" is a significant hurdle in scientific and clinical domains where understanding the generation path is as crucial as the final output. This paper proposes a framework to bridge this gap by constraining generative flows to follow physical laws, specifically using the 2D Ising model as a grounding mechanism.

Methods

The authors map the generative process to the cooling schedule of a 2D Ising model, a classic system in statistical mechanics used to study ferromagnetism. The architecture integrates three primary components to ensure thermodynamic consistency:

  1. Encoder ($\phi$): Transforms discrete Ising spin configurations into a continuous latent space.
  2. Flow Matching Network ($v_\theta$): Learns a vector field driven by temperature, guiding the system from disordered high-temperature states to ordered low-temperature states.
  3. Projector ($P_\theta$): Decodes latent vectors back into discrete spin states, utilizing a specialized Hamiltonian-based loss function ($L_{Ising}$) to enforce physical plausibility.
Architecture of the physics-constrained flow matching model.

Unlike standard models that use straight-line interpolation, this approach employs piecewise linear interpolation along a cooling schedule, treating generation as a sequence of transitions between thermal equilibrium points.

Results

The proposed model demonstrates high physical fidelity, accurately capturing the phase transitions of the Ising model. By anchoring the flow to temperature, the model's "velocity" becomes a physically meaningful thermodynamic transition.

Thermodynamic observables vs. temperature.

Key findings include:

  • Physical Fidelity: The model's outputs for energy, magnetization, and susceptibility align closely with the Onsager exact solution, even near the critical temperature ($T_c \approx 2.269$).
  • Computational Efficiency: The model significantly outperforms traditional Monte Carlo methods. For a 64x64 lattice, the generation trajectory took approximately 0.56 seconds, compared to 35 seconds for standard simulations.
  • Interpretability: The generation process is modular; users can inspect the state of the system at any specific temperature point during the "cooling" process.

Conclusion

This work successfully demonstrates that generative flows can be made interpretable by grounding them in physical processes. While currently applied to the Ising model, future research will explore scaling this framework to more complex systems like molecular dynamics and fluid flows. Additionally, the concept of "cooling" could potentially be generalized to non-physical data to provide similar semantic structure to abstract generative paths.

Summary updated

BibTeX
@misc{pivi2025flow,
  author = {Francesco Pivi and Simone Gazza and Davide Evangelista and Roberto Amadini and Maurizio Gabbrielli},
  title = {{On the flow matching interpretability}},
  year = {2025},
  eprint = {2510.21210},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.21210},
}
Figure