CompFlow: Composing Velocity Fields for Multi-Condition Generation

Luca Miglior, Vincenzo Gervasi, Davide BacciuCompLearn @ ICML 2026

TL;DR

CompFlow is a training-free framework that enables complex, multi-condition image generation by simply summing conditional "velocity fields" at inference time. By proving that these velocities act as a Product-of-Experts, the authors achieve high-accuracy compositional generation (e.g., controlling five objects simultaneously) with 30x fewer computations than previous energy-based methods.

What Problem Does This Paper Address?

Modern generative models like Stable Diffusion or FLUX often struggle with "compositionality"—the ability to combine multiple independent attributes or objects into a single coherent scene. For example, asking for "a red cube on the left and a blue sphere on the right" frequently leads to attribute bleeding (a red sphere) or missing objects.

Existing solutions usually fall into two camps:

  1. Retraining: Training a new model for every possible combination of attributes, which is computationally ruinous.
  2. Energy-Based Composition: Combining "experts" at inference time using scores. While theoretically sound, these often require expensive Markov Chain Monte Carlo (MCMC) sampling, involving thousands of network evaluations and unstable hyperparameter tuning.

CompFlow addresses this by bringing compositionality to Flow Matching models, offering a deterministic, fast, and training-free way to satisfy many conditions at once.

Methods

The core of CompFlow is a mathematical bridge between Flow Matching (FM) and Product-of-Experts (PoE).

  • Velocity Residuals: In Flow Matching, the model learns a velocity field ($v_t$) that "pushes" noise toward data. The authors prove that for Gaussian probability paths, the difference between a conditional velocity and an unconditional one ($v^c_t - v^0_t$) is proportional to the gradient of the log-likelihood (the "score").
  • Additive Composition: Because scores add up naturally in a Product-of-Experts framework, CompFlow implements composition by simply summing these velocity residuals: $$v^{comp}_t = v^0_t + \sum \lambda_i (v^{c_i}_t - v^0_t)$$
  • Inference-Only: This operation happens entirely during sampling. You take a pre-trained model, query it for each condition independently at every timestep, sum the results, and step forward using a standard ODE solver. No MCMC, no rejection sampling, and no fine-tuning required.

Datasets

The authors validated CompFlow across three distinct regimes:

  1. Synthetic 2D Distributions: A toy task involving a Gaussian ring and a vertical bar to visually confirm that the method recovers the intersection of distributions.
  2. CLEVR: A standard diagnostic dataset for spatial reasoning. They trained a model on single-object scenes and used CompFlow to generate scenes with up to five objects, controlling shape, color, and position for each.
  3. T2I-CompBench: A comprehensive benchmark for open-world compositional text-to-image generation. They used the state-of-the-art FLUX.1 [dev] model as a backbone.

Key Insights and Ideas

  • The Velocity-Score Identity: The "aha!" moment is the realization that Flow Matching velocities are just affine transformations of scores for Gaussian paths. This allows FM to inherit the compositional strengths of Energy-Based Models without the sampling headaches.
  • Generalizing CFG: CompFlow can be viewed as a massive generalization of Classifier-Free Guidance (CFG). While standard CFG handles one condition, CompFlow extends this to an arbitrary number of independently weighted conditions.
  • Zero-Shot Scaling: The CLEVR results are particularly striking. The model never saw a scene with five objects during training, yet CompFlow successfully composed five "single-object experts" to create complex multi-object scenes at inference time.
  • Dynamics-Induced Blending: When conditions are compatible (e.g., "a horse" + "a sheep"), the velocity fields blend, creating a hybrid "geep." While this is a failure for counting, it’s a powerful feature for style mixing and attribute fusion.

Key Results

  • Efficiency: On CLEVR, CompFlow achieved 86.5%–99.1% per-object accuracy using only 120 forward passes (NFEs). Prior energy-based baselines required ~4,000 passes and still achieved lower accuracy.
  • Open-Domain Superiority: Using FLUX.1, CompFlow outperformed vanilla single-prompt generation on T2I-CompBench. By decomposing a complex prompt into atomic concepts (e.g., "a dog playing" + "a park"), the model satisfied more semantic constraints than when given the full prompt as a single string.
  • Linear Scaling: The computational cost scales linearly with the number of conditions ($m$), making it practical for real-time applications compared to iterative MCMC methods.

Limitations and Future Work

  • Spatial-Relational Failures: The additive nature of the velocity fields means the model doesn't inherently know that two objects should occupy different spaces. Without an explicit spatial prior or "object slots," conditions can collapse into a single "chimeric" object (e.g., a cube with sphere-like patches).
  • Gaussian Path Dependency: The current proof relies on Gaussian interpolants. Extending CompFlow to more complex paths, like Optimal Transport or non-Gaussian flows, remains an open theoretical challenge.
  • Hard Binding: The authors note that for tasks requiring strict counting or "hard" separation of instances, CompFlow might need to be paired with additional mechanisms like attention masks or spatial conditioning.

Summary updated

BibTeX
@inproceedings{miglior2026compflow,
  author = {Luca Miglior and Vincenzo Gervasi and Davide Bacciu},
  title = {{CompFlow: Composing Velocity Fields for Multi-Condition Generation}},
  booktitle = {CompLearn @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=JdQTzZewsy},
}
Figure