Weighted Conditional Flow Matching

Sergio Calvo Ordoñez, Matthieu Meunier, Alvaro Cartea, Christoph Reisinger, Yarin Gal, José Miguel Hernández-Lobato · Submission to ICLR 2026 · Rejected

TL;DR

Weighted Conditional Flow Matching (W-CFM) straightens flow trajectories and boosts generative performance without solving computationally expensive optimal transport (OT) matching problems. By simply weighting independently sampled training pairs with an entropic Gibbs kernel, W-CFM achieves the trajectory straightness and low-step inference quality of OT-CFM at the per-iteration computational cost of standard vanilla CFM.

What Problem Does This Paper Address?

Continuous Normalizing Flows (CNFs) trained via Flow Matching (FM) provide simulation-free generative modeling, but independent pairing of source and target samples (I-CFM) produces curved, tangled trajectories. These winding paths force numerical ODE solvers to use fine discretization steps (high Neural Function Evaluations, or NFEs) during inference to generate high-fidelity samples.

While minibatch Optimal Transport CFM (OT-CFM) straightens paths by matching points within each batch via discrete OT or Sinkhorn algorithms, it faces severe bottlenecks:

  1. Computational overhead: Solving discrete OT scales cubically ($\mathcal{O}(B^3)$) with batch size $B$, or quadratically ($\mathcal{O}(B^2)$) under entropic regularization.
  2. Batch representation limits: In complex, multimodal datasets, mini-batches rarely contain a balanced representation of all classes/modes, leading to poor batch-level transport plans.

The paper tackles a central question: Can we induce optimal-transport-like straight paths without explicitly solving an OT matching problem during training?

Methods

Rather than finding an optimal permutation or coupling within each mini-batch, W-CFM samples source and target pairs independently ($(X, Y) \sim \mu \otimes \nu$) and reweights the conditional flow matching regression objective:

$$\mathcal{L}_{\text{W-CFM}}(\theta; \varepsilon) = \mathbb{E}_{t, (X,Y)} \left[ w_\varepsilon(X, Y) \| v_\theta(t, X_t) - (Y - X) \|^2 \right]$$

where the weight is inspired by the Entropic Optimal Transport (EOT) Gibbs kernel: $$w_\varepsilon(x, y) = \exp\left(-\frac{c(x, y)}{\varepsilon}\right) \hat{f}_\varepsilon(x) \hat{g}_\varepsilon(y)$$

Key aspects include:

  • Importance Sampling Interpretation: Weighting the independent loss provably recovers the entropic OT plan as a prior coupling, up to potential marginal distortion ("tilting").
  • Trivial Potential Scaling ($\hat{f}_\varepsilon = \hat{g}_\varepsilon = 1$): In high dimensions, normalized data naturally concentrates on a thin spherical shell ($\approx \sqrt{d}$). The authors prove that when source distributions are isotropic and targets reside on a sphere, this naive weighting induces virtually zero target marginal tilt.
  • Monte Carlo Sinkhorn (1-step): For low-dimensional tasks where marginal tilting occurs, the authors provide a lightweight pre-computed Monte Carlo estimation for the scaling factors $\hat{f}_\varepsilon$ and $\hat{g}_\varepsilon$.
  • Heuristic Selection of $\varepsilon$: By setting $\varepsilon = \kappa \sqrt{d}$, the kernel argument remains $\mathcal{O}(1)$. The scalar $\kappa$ is chosen within seconds using a "relative variance" elbow heuristic that tests how close the marginal tilt factors are to a constant.

Datasets

The authors evaluate W-CFM across synthetic 2D setups and five natural image benchmarks:

  • 2D Synthetic Benchmarks:
  • Concentric Circular MoG $\to$ 5 Gaussians
  • 8 Gaussians $\to$ Moons dataset
  • High-Dimensional Image Benchmarks:
  • CIFAR-10 ($32\times 32$)
  • CelebA-64 ($64\times 64$)
  • ImageNet64-10 (a 10-class subset of $64\times 64$ ImageNet)
  • Food20 (a 20-class subset of Food-101)
  • Intel Image Classification ($64\times 64$)

Key Insights and Ideas

  • Batch-Free OT: In the infinite-batch limit, batch EOT-CFM converges directly to W-CFM (assuming negligible marginal tilt). W-CFM eliminates the need for large batch sizes to cover all modes simultaneously.
  • The "Curse" of Dimensionality is a Blessing: High-dimensional geometry (spherical concentration of measure) ensures that pairwise distances vary smoothly. Consequently, the naive choice $\hat{f}_\varepsilon = \hat{g}_\varepsilon = 1$ works out of the box on high-dimensional image datasets without distorting marginal densities.
  • Zero Runtime Overhead: Evaluating $\exp(-\|x - y\|/\varepsilon)$ per paired sample requires minimal compute compared to executing full linear programming or multi-iteration Sinkhorn solvers on every GPU batch.

Key Results

  • Training Speed: On 2D toy tasks, W-CFM runs at ~1.2 ms/iteration (identical to I-CFM's 1.27 ms), whereas exact minibatch OT-CFM takes 3.75 ms/iteration (over $3\times$ slower).
  • Trajectory Straightness & Sample Quality: On the circular MoG-to-5 Gaussians task, W-CFM achieves a lower 2-Wasserstein distance ($W_2^2 = 0.018$) than OT-CFM ($0.029$) while delivering comparable trajectory straightness (NPE of $0.086$ vs. $0.032$).
  • Image Generation Fidelity (FID): Using a standard Dopri5 adaptive solver, W-CFM outperforms or matches both baselines across multimodal datasets:
  • CIFAR-10: W-CFM reaches 7.33 FID (vs. 7.44 for I-CFM, 7.60 for OT-CFM).
  • ImageNet64-10: W-CFM reaches 13.56 FID (vs. 13.86 for I-CFM, 14.39 for OT-CFM).
  • Intel: W-CFM reaches 25.22 FID (vs. 27.54 for I-CFM, 25.63 for OT-CFM).
  • Fewer Integration Steps (NFEs): Under Euler discretization at 50, 100, and 120 steps, W-CFM consistently maintains lower FID values than I-CFM and OT-CFM.
  • Fidelity vs. Diversity (PRDC): Precision, Recall, Density, and Coverage evaluations confirm that weighting pairs does not cause mode dropping or sacrifice distribution diversity (e.g., ImageNet64-10 F1 score is 0.72 for W-CFM vs. 0.71 for OT-CFM).

Limitations and Future Work

  • Marginal Tilting in Low Dimensions: When the target distribution deviates significantly from spherical concentration and $\varepsilon$ is small, the naive weighting significantly distorts marginal distributions, necessitating pre-computed Monte Carlo estimates.
  • Hyperparameter Sensitivity: Performance relies on a well-chosen $\varepsilon$. Although the relative-variance proxy simplifies tuning, it still introduces an extra hyperparameter.
  • Scope of Evaluation: The study focuses on unconditional generation with standard UNet backbones and linear interpolation paths. Extending the approach to class-conditional generation, text-to-image models, and non-Euclidean cost metrics remains unexplored.

Summary updated

BibTeX
@inproceedings{ordonez2025weighted,
  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