Improving Flow Matching by Aligning Flow Divergence
Yuhao Huang, Taos Transue, Shih-Hsin Wang, William Feldman, Hong Zhang, Bao Wang
TL;DR
This work identifies a fundamental bottleneck in flow-based generative modeling: minimizing the FM loss alone does not guarantee accurate probability-path learning due to divergence gaps between the learned and exact flows. By deriving a PDE-based error characterization for the probability paths and establishing a TV-based bound that ties this error to a divergence-gap term, the authors motivate a joint training objective called flow and divergence matching (FDM). FDM combines conditional flow matching (CFM) with a conditional divergence matching (CDM) term, including an efficient squared version, to align both the flow and its divergence without sacrificing sampling efficiency. Empirically, FDM improves density estimation, DNA sequence design, dynamical-system trajectory sampling, and video generation across multiple datasets and diffusion-path choices, demonstrating meaningful gains in likelihoods and sample quality. The approach offers a practical, scalable path to more accurate flow-based generative models with broad applicability in scientific modeling and sequential data generation.
Abstract
Conditional flow matching (CFM) stands out as an efficient, simulation-free approach for training flow-based generative models, achieving remarkable performance for data generation. However, CFM is insufficient to ensure accuracy in learning probability paths. In this paper, we introduce a new partial differential equation characterization for the error between the learned and exact probability paths, along with its solution. We show that the total variation gap between the two probability paths is bounded above by a combination of the CFM loss and an associated divergence loss. This theoretical insight leads to the design of a new objective function that simultaneously matches the flow and its divergence. Our new approach improves the performance of the flow-based generative model by a noticeable margin without sacrificing generation efficiency. We showcase the advantages of this enhanced training approach over CFM on several important benchmark tasks, including generative modeling for dynamical systems, DNA sequences, and videos. Code is available at \href{https://github.com/Utah-Math-Data-Science/Flow_Div_Matching}{Utah-Math-Data-Science}.
