Conditional Mean Flows: Few-Step Densities for Simulation-Based Inference

Jonas Arruda, Jan Hasenauer, Stefan T. RadevarXiv 2026

TL;DR

Conditional Mean Flows (CMF) provide a "best of both worlds" solution for simulation-based inference, combining the architectural flexibility of flow matching with the speed of normalizing flows. By learning average velocities instead of instantaneous ones, CMFs enable high-quality posterior sampling and tractable density evaluation in just a few steps—achieving up to a 200-fold speedup in MCMC applications compared to standard flow matching.

What Problem Does This Paper Address?

In many scientific fields, we have complex simulators (mechanistic models) but no explicit "likelihood" function to tell us how well a model fits the data. Simulation-Based Inference (SBI) solves this by using simulated data to train neural networks that can estimate posteriors or likelihoods.

Currently, researchers face a trade-off:

  1. Normalizing Flows (NFs): Fast to evaluate but require restrictive architectures (like triangular Jacobians) to keep density calculations tractable.
  2. Flow Matching (FM) and Diffusion: Highly flexible and accurate but slow. They require solving an Ordinary Differential Equation (ODE) with hundreds of steps to evaluate a single density or draw a sample.
  3. Consistency Models: Very fast for sampling but don't provide a tractable density, making them useless for tasks like Markov chain Monte Carlo (MCMC) where we need to evaluate the likelihood.

This paper introduces Conditional Mean Flows, which allow for flexible architectures while enabling accurate density evaluation and sampling in just 1 to 32 steps.

Methods

The core innovation is shifting from learning instantaneous velocity (as in standard flow matching) to learning the average velocity between two time points.

  • Mean Flow Objective: The network is trained to predict the average velocity along an ODE trajectory. This means a single network evaluation can represent a finite-time "jump" (a flow map) rather than an infinitesimal step.
  • Tractable Densities: Because each jump is a discrete map, the authors can compute the exact Jacobian determinant for each step. Composing a few of these steps gives a valid, tractable density evaluation.
  • Cycle Loss: To ensure the learned maps are invertible (a requirement for accurate densities), they use a "cycle loss" that penalizes the difference between a point and its round-trip mapping (forward to noise, then back).
  • Masked Transformers: For high-dimensional data with missing values, they use a transformer backbone with masked attention. This allows the model to naturally marginalize over missing observations—a significant advantage over standard flows.

Datasets

The authors evaluate CMF on four distinct benchmarks:

  1. Two Moons: A classic 2D bimodal distribution used to visualize sampling and density quality.
  2. Cognitive Model (Wiener Diffusion): A standard benchmark in psychology for single-trial likelihood estimation.
  3. Epidemic Renewal Model: A 128-dimensional time-series task involving estimating reproduction numbers ($R_t$) with missing data.
  4. g-and-k Distribution: A flexible univariate distribution with an intractable likelihood, used to test MCMC performance.

Key Insights and Ideas

  • The "Aha" Moment: You don't need to solve a full ODE to get a tractable density. By learning the average velocity, you can treat the generative process as a sequence of a few discrete, invertible steps.
  • Architecture Matters: Because CMFs don't require the architectural constraints of Normalizing Flows, they can use Transformers. This is a game-changer for handling structured data like time series or data with missing entries.
  • Marginalization via Masking: The paper proves (Proposition 2) that simply masking tokens in a transformer allows the model to learn marginal likelihoods directly. This avoids the "sentinel value" hacks (like filling missing data with -1) that often confuse standard neural networks.
Figure 1: Learned two-moons posteriors as samplers and as densities. Top row: 5,000 draws per method for the canonical observation y = (0, 0); bottom row: the learned log-density on a 512×512 grid with the exact 95% highest-density region dashed. (A) A normalizing flow; (B) a consistency model with S=32 steps, which has no tractable density; (C) a mean flow with S=1. (D) The same mean flow with S=32 and (E) a separately trained flow matching model integrated with 32 Euler steps. (F) The velocity head of the mean flow and (G) the flow matching model, both integrated with the adaptive Tsit5 ODE solver.

Key Results

  • Massive Speedups: In the cognitive model task, a single-step CMF matched the accuracy of a 200-step flow matching baseline while being ~200 times faster for downstream MCMC sampling.
  • Better Density Quality: On the Two Moons task, CMF densities were significantly more accurate than Normalizing Flows and more stable than Euler-integrated flow matching.
  • Handling Missing Data: In the epidemic renewal model, the masked transformer CMF significantly outperformed Normalizing Flows that used "sentinel" values to represent missing data.
Figure 3: Posterior predictive simulations of the renewal model on one dataset. Observations ˜y simulated from the learned likelihood at posterior draws of (A) our conditional mean flow with the masked transformer and (B) the normalizing flow with sentinel values; median with 50 and 90% bands against the observed data (black). The gray strip is the seeded window, and the striped columns mark the missing time points.
  • MCMC Efficiency: For the g-and-k benchmark, the authors showed that under a fixed computational budget, it is better to use a very fast, few-step CMF likelihood to get more MCMC samples than to use a slow, "perfect" likelihood with fewer samples.
Figure 4: Budget-matched posterior accuracy on g-and-k. (A) C2ST against the exact posterior over mean flow steps S, at the shared budget of Appendix D. (B) Minimum bulk ESS per 1,000 network evaluations. (C) Draws kept per chain under the shared budget. Lines show the mean over 10 independent datasets, bands the standard deviation; the delayed acceptance MCMC line is indexed by its coarse step count, and horizontal lines mark the normalizing flow and the flow matching model with 200 Euler steps outside the budget.

Limitations and Future Work

  • Dimensionality Bottleneck: While CMF is faster than FM, calculating the Jacobian log-determinant still scales cubically ($O(d^3)$) with the dimension of the target variable. This makes it expensive for very high-dimensional targets (e.g., images).
  • Invertibility: The cycle loss encourages invertibility but doesn't strictly guarantee it. Consequently, the learned densities might not be perfectly normalized.
  • Error Accumulation: Like all approximate likelihood methods, errors can accumulate when composing many trials into a joint posterior.
  • Future Directions: The authors suggest integrating CMF with self-consistency objectives to further improve accuracy without needing more simulations.

Summary updated

BibTeX
@misc{arruda2026conditional,
  author = {Jonas Arruda and Jan Hasenauer and Stefan T. Radev},
  title = {{Conditional Mean Flows: Few-Step Densities for Simulation-Based Inference}},
  year = {2026},
  eprint = {2610.21657},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.21657},
}
Figure