NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Weighted Conditional Flow Matching

Sergio Calvo-Ordoñez, Matthieu Meunier, Alvaro Cartea, Christoph Reisinger, Yarin Gal, José Miguel Hernández-Lobato · DOI

Introduction

Continuous Normalizing Flows (CNFs) have emerged as a powerful class of generative models, learning to map simple noise distributions to complex data manifolds through learned vector fields. While the introduction of Flow Matching (FM) significantly simplified the training of these models, it often results in highly curved sampling trajectories. In the context of ordinary differential equations (ODEs), curvature necessitates a high number of function evaluations (NFE) during inference to maintain accuracy, leading to slow and computationally expensive sampling.

The Challenge of Curved Trajectories

Standard Flow Matching typically employs independent coupling between noise and data samples. This "random" pairing often forces the model to learn complex, intersecting, and curved paths. To address this, Optimal Transport Conditional Flow Matching (OT-CFM) was introduced, which utilizes optimal transport couplings to induce straighter trajectories. However, OT-CFM requires solving an optimal transport problem—such as the Sinkhorn algorithm—for every minibatch during training. This approach is not only computationally demanding but also prone to bias, as the "optimal" paths within a small minibatch may not reflect the global structure of the data distribution.

Weighted Conditional Flow Matching (W-CFM)

The authors propose Weighted Conditional Flow Matching (W-CFM), a simple yet effective modification to the FM objective. Instead of solving an explicit optimization problem, W-CFM employs an importance-weighting scheme to prioritize "logical" pairs of noise and data points.

Methodology

W-CFM modifies the standard FM loss by weighting each pair $(x, y)$ in a batch using a Gibbs kernel: $$w(x, y) \propto \exp\left(-\frac{c(x, y)}{\epsilon}\right)$$ where $c(x, y)$ represents a cost function (typically the squared Euclidean distance) and $\epsilon$ is a temperature hyperparameter. By increasing the weight of pairs that are already close in the feature space, the model naturally learns to follow the most direct paths, effectively approximating the Entropic Optimal Transport (EOT) solution without the need for an iterative solver.

Visualization of learned trajectories on a Mixture of Gaussians (MoG) task.

Technical Innovations

The $\epsilon$ Heuristic

Selecting an appropriate value for the temperature parameter $\epsilon$ is critical. A value too high reverts to standard FM, while a value too low can lead to numerical instability or "marginal tilting." The authors suggest a heuristic based on the concentration of measure in high-dimensional spaces, setting $\epsilon = \kappa \sqrt{d}$, where $d$ is the dimensionality of the data.

Marginal Correction

Aggressive weighting can inadvertently distort the marginal distributions of the noise or data. To mitigate this "tilting" effect, the paper introduces a Monte Carlo-based preprocessing step. This step ensures that the weighted couplings still respect the original data distribution, preserving the fidelity of the generative process.

Key Insights and Ideas

  • Computational Efficiency: Unlike minibatch OT methods, the cost of computing weights in W-CFM is negligible and scales linearly with batch size.
  • Stability: W-CFM represents the large-batch limit of minibatch OT, providing more stable gradients and consistent trajectories across different training iterations.
  • Inference Speed: By inducing straighter paths, W-CFM allows for the use of simpler ODE solvers with fewer steps, significantly reducing the time required to generate high-quality samples.
Comparison of trajectories on a toy task. W-CFM produces paths nearly as straight as OT-CFM but without the per-batch overhead.

Experimental Evaluation

The efficacy of W-CFM was demonstrated across various synthetic and real-world datasets, including CIFAR-10, CelebA, and ImageNet.

  • Sample Quality: On CIFAR-10, W-CFM achieved a Fréchet Inception Distance (FID) of 7.33, outperforming both independent FM (7.44) and OT-CFM (7.60).
  • Scalability: On ImageNet64 (10 classes), W-CFM maintained a superior FID of 13.56 while being significantly faster to train than OT-based alternatives.
  • Robustness to NFE: W-CFM consistently outperformed standard CFM at low NFEs. For instance, with only 50 steps of Euler integration, W-CFM maintained high sample quality where other methods began to degrade.

Conclusion

Weighted Conditional Flow Matching provides a computationally efficient bridge between standard Flow Matching and Optimal Transport. By leveraging a simple Gibbs kernel weighting scheme, W-CFM induces straight sampling trajectories that enable faster inference and higher sample quality. This approach effectively democratizes the benefits of optimal transport for large-scale generative modeling, offering a robust and scalable alternative to existing methods.

Summary updated

BibTeX
@inproceedings{calvoordonez2025weighted,
  author = {Sergio Calvo-Ordoñez and Matthieu Meunier and Alvaro Cartea and Christoph Reisinger and Yarin Gal and José Miguel Hernández-Lobato},
  title = {{Weighted Conditional Flow Matching}},
  booktitle = {SPIGM @ NeurIPS},
  year = {2025},
  url = {https://openreview.net/forum?id=1pjmIchbGL},
}
Figure