Authors: Christian A. Naesseth, Max Welling, Jan-Willem van de Meent UvA-Bosch Delta Lab, University of Amsterdam
Abstract
We present a formulation of flow matching as variational inference, which we refer to as variational flow matching (VFM). Based on this formulation we develop CatFlow, a flow matching method for categorical data. CatFlow is easy to implement, computationally efficient, and achieves strong results on graph generation tasks. In VFM, the objective is to approximate the posterior probability path, which is a distribution over possible end points of a trajectory. We show that VFM admits both the CatFlow objective and the original flow matching objective as special cases. We also relate VFM to score-based models, in which the dynamics are stochastic rather than deterministic, and derive a bound on the model likelihood based on a reweighted VFM objective. We evaluate CatFlow on one abstract graph generation task and two molecular generation tasks. In all cases, CatFlow exceeds or matches performance of the current state-of-the-art models.
Introduction
Generative modeling has recently been dominated by two heavyweights: Diffusion Models and Continuous Normalizing Flows (CNFs). While Diffusion Models offer robust stochastic paths, CNFs provide flexibility but are traditionally expensive to train because they require solving an Ordinary Differential Equation (ODE) at every step.
Flow Matching (FM) emerged as a "simulation-free" way to train CNFs, making them much faster. However, FM was primarily designed for continuous data. When applied to categorical data—like the discrete nodes and edges in a graph—standard FM often struggles. It tries to regress toward an "average" trajectory that might not actually point toward a valid point on the probability simplex. This leads to "misaligned" paths during training and slower convergence. This paper introduces Variational Flow Matching (VFM), a framework that reformulates flow matching as a variational inference problem to bring efficiency to the discrete world of graphs and molecules without losing theoretical rigor.
Variational Flow Matching (VFM)
The core innovation of VFM is treating the learned vector field as an expectation over a variational distribution of endpoints. Instead of training a neural network to predict a vector field directly, VFM trains the network to predict a variational distribution ($q$) over the possible endpoints ($x_1$) of a trajectory.
This turns flow matching into a classification-like task. The authors derive a loss function based on the Kullback-Leibler (KL) divergence between the true posterior probability path and their variational approximation. VFM serves as a "master" framework: using a Gaussian distribution recovers standard Flow Matching, while categorical distributions enable the development of CatFlow. Furthermore, the VFM formulation allows for the derivation of a variational bound on the model's log-likelihood, providing a stronger probabilistic foundation than standard regression-based FM.
CatFlow for Categorical Data
CatFlow is the specific application of VFM to categorical data. In CatFlow, the model predicts a categorical distribution over the corners of a probability simplex. The vector field is then derived from the "mean" of this distribution.
By predicting points in the probability simplex and deriving velocities from them, CatFlow introduces a powerful inductive bias. It ensures that generative paths always point toward "realistic" trajectories (the corners of the simplex), preventing the model from wasting capacity on irrelevant regions of the search space. Additionally, for categorical data, using a cross-entropy loss (via VFM) provides much better gradient behavior than the Mean Squared Error (MSE) typically used in standard Flow Matching.
Experimental Evaluation
The authors evaluated CatFlow on several standard benchmarks, including abstract graphs (Ego-small, Community-small, Enzymes, Grid) and molecular graphs (QM9, ZINC250k).
On the Community-small task, CatFlow achieved a Degree MMD (Maximum Mean Discrepancy) of 0.018, significantly better than GDSS (0.045). In molecular generation, CatFlow set new high bars for performance:
- QM9: Reached 99.81% validity and a Fréchet ChemNet Distance (FCD) of 0.441, outperforming Dirichlet FM.
- ZINC250k: Achieved 99.21% validity and 100% uniqueness.
Ablation studies demonstrated that CatFlow is more robust when training with limited data; in tests with only 5% of the training data, CatFlow maintained high performance while standard Flow Matching's performance collapsed.
Conclusion and Future Work
CatFlow represents a significant step forward in discrete generative modeling, offering state-of-the-art accuracy with superior training efficiency. While the model currently faces scalability challenges—specifically the $O(N^2)$ cost relative to the number of nodes—the VFM framework is general. Future work could explore using VFM for "mixed" data types, such as molecules where both discrete atom types and continuous 3D coordinates must be generated simultaneously, or applying the framework to other discrete domains like text generation.
Summary updated