Manuscript Offprint
arXiv:2610.21657Conditional Mean Flows: Few-Step Densities for Simulation-Based Inference
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Flow matching has emerged as a powerful generative family for simulation-based inference (SBI). However, sampling and density evaluation require numerical integration at inference time. This makes posterior sampling in neural posterior estimation costly. More importantly, it can make repeated likelihood evaluation prohibitively expensive and impractical for Markov chain Monte Carlo (MCMC) sampling, which may require thousands of repeated density evaluations. Here, we develop conditional mean flows for posterior and likelihood approximation, combining few-step sampling with tractable density evaluation. We show that the mean flow objective identifies conditional flow maps and that independent masking enables direct estimation of marginal likelihoods. We evaluate both posterior and likelihood estimation across several tasks and show that conditional mean flows retain the flexibility of flow-based density estimators while significantly reducing inference time. In particular, single-step conditional mean flow density evaluation yields estimation error comparable to 200-step flow matching while enabling about 200-fold faster downstream MCMC sampling.
1 INTRODUCTION
Mechanistic simulators are used to describe processes ranging from cognitive science (Ratcliff et al., 2016) to disease modeling (Ye et al., 2025). Yet, while practically important, their likelihoods are often unavailable in closed form. Simulation-based inference (SBI; Sisson et al., 2018; Cranmer et al., 2020; Deistler et al., 2025; Arruda et al., 2026) addresses this challenge by using simulated parameter-observation pairs ( , y) to infer unknown parameters, and amortized methods reuse the trained network across datasets (Bürkner et al., 2023). Two popular forms of SBI are neural posterior estimation (NPE) and neural likelihood estimation (NLE). NPE learns a posterior model which can sample from the approximate posterior directly. NLE, instead, learns a likelihood model which requires Markov chain Monte Carlo (MCMC) to sample from the posterior. NPE amortizes over datasets but is usually tied to the prior and data format used in training, whereas NLE needs MCMC for every dataset, but allows the prior to be changed after training and composes exchangeable likelihoods across any number of i.i.d. observations (Cranmer et al., 2020).
Many SBI methods demand neural estimators that are both flexible and inexpensive to evaluate. In NLE, MCMC requires thousands of likelihood evaluations per posterior, making each evaluation a practical bottleneck. Further, hierarchical approaches (Arruda et al., 2024) or self-consistency objectives that improve NPE (Schmitt et al., 2024a; Mishra et al., 2026) and enable model comparison (Kucharský and Bürkner, 2026) rely on density evaluation during training or inference.
So far, normalizing flows have been a standard choice in these applications because they evaluate densities in a single pass (Papamakarios et al., 2021; Dinh et al., 2017; Durkan et al., 2019). However, their transformations must remain invertible with tractable Jacobians, which restricts how inductive biases can be built into the architecture (Chen et al., 2025). Autoregressive flows based on causal transformers (e.g., TARFlow and STARFlow) relax this restriction (Zhai et al., 2025; Gu et al., 2025), but impose a fixed variable ordering and require sequential inversion for sampling. Moreover, tractable joint densities do not generally imply tractable marginals, which are required with missing observations (Yalavarthi et al., 2024).
Flow matching and diffusion models instead learn a velocity or score field with an unconstrained neural network (Lipman et al., 2023; Liu et al., 2022; Wildberger et al., 2023; Sharrock et al., 2024; Arruda et al., 2026), and diffusion transformers can flexibly represent arbitrary conditionals and marginals (Gloeckler et al.,
2024). Yet, their densities require solving an ordinary differential equation (ODE), which can take hundreds of network evaluations and makes repeated likelihood calls during training or within MCMC costly. Few-step generative models reduce the sampling cost, but consistency models, for instance, provide no tractable density (Song et al., 2023; Schmitt et al., 2024b). Thus, current SBI approaches either restrict the network architecture or make every density evaluation expensive.
To overcome this limitation, we present conditional mean flows for SBI, which learn the average velocity between two times, so that one network evaluation defines a finite-time map based on mean flows (Geng et al., 2025, 2026). We first evaluate direct posterior sampling and density estimation, then focus on learned likelihoods for compositional inference, missing observations, and gradient-based and delayed acceptance MCMC. Concretely, we develop and showcase
-
a conditional mean flow formulation for posterior and likelihood approximation, with exact stepwise Jacobian determinants, and a proof that the mean flow objective suffices to identify conditional flow maps (Section 3.1, Proposition 1);
-
marginal density estimation for missing targets with a masked transformer backbone, and a proof that the masked objective targets the correct marginal likelihood (Section 3.3, Proposition 2);
-
and a benchmark against normalizing flows and regular flow matching on four tasks covering both NLE and NPE, including a single-trial likelihood comparison in which one mean flow step matches the error of 200-step flow matching with two orders of magnitude faster sampling (Section 4);
Flow matching and diffusion-based inference. Flow matching learns a velocity field that transports a Gaussian distribution to the target along a prescribed interpolation (Lipman et al., 2023; Liu et al., 2022). It has been applied to both NPE and NLE, alongside score-based generative models (for a review, see Arruda et al., 2026). Sampling requires ODE integration, and density evaluation additionally integrates the velocity divergence through the continuous change-of-variables formula (Chen et al., 2018), so repeated integration can dominate the cost of NLE.
Few-step generative models. Consistency models learn transitions from intermediate noisy states toward data, enabling generation in one or a few steps (Song et al., 2023). They also support fast posterior sampling in SBI (Schmitt et al., 2024b; Arruda et al., 2026), although the standard formulation does not provide a tractable posterior density. Flow maps learn finite-time ODE transitions between arbitrary time pairs, and mean flows parameterize these maps through average velocities and can be trained without distillation (Geng et al., 2025, 2026). Rehman et al. (2026) combined mean flows with a cycle loss that encourages invertibility to obtain few-step densities for Boltzmann generators.
MCMC with learned and multi-fidelity likelihoods. The no-U-turn sampler (NUTS; Hoffman and Gelman, 2014; Betancourt, 2017) uses density and gradient evaluations to construct proposals, and probabilistic programming frameworks allow learned likelihoods to enter these calculations as model components (Carpenter et al., 2017). Delayed acceptance MCMC uses a cheap approximation to screen proposals while leaving the fine target invariant (Christen and Fox, 2005). Moreover, its multilevel variant organizes several approximations (Lykkegaard et al., 2023), and related approaches in SBI use simulators at different resolutions (Prescott and Baker, 2021; Tatsuoka et al., 2026).
3 METHOD
A note on notation. We write for the density target and for the conditioning variables. In posterior estimation, the network learns with parameters as the target and data as the condition. In likelihood estimation, it learns with and . The same formulation applies to either direction by choosing the target and condition

Figure 1: Learned two-moons posteriors as samplers and as densities. Top row: 5,000 draws per method for the canonical observation ; bottom row: the learned log-density on a grid with the exact 95% highest-density region dashed. (A) A normalizing flow; (B) a consistency model with steps, which has no tractable density; (C) a mean flow with . (D) The same mean flow with 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.
accordingly.
3.1 Flow-Based Density Evaluation
Flow matching vs. normalizing flows. We consider flows that transport the target distribution to a spherical Gaussian base distribution. Time runs from data to noise: is the clean target and is pure noise, along the flow matching interpolation with . Flow matching for SBI learns the marginal velocity by regressing the conditional velocity . For sampling, it draws the initial condition and then integrates from to (Wildberger et al., 2023). The density follows from the continuous change of variables,
which can be integrated with any ODE solver (Arruda et al., 2026). Normalizing flows instead learn an invertible map from the target to the base distribution and evaluate
in a single pass (Papamakarios et al., 2021). To keep the determinant tractable, is composed of invertible layers with triangular Jacobians (Dinh et al., 2017; Durkan et al., 2019), which avoids the integral in (1) but restricts the neural network architecture (Figure 1). Average velocity and the flow map. Extending Geng et al. (2025) to conditional models, we train a network to predict the average velocity
the mean of the instantaneous field along the ODE trajectory started at conditioned on . Since is constant along the trajectory, the conditional velocity defines one ODE per condition. One network evaluation then applies the finite-time flow map
with the boundary case corresponding to the instantaneous velocity .
Training with a self-consistent tangent and a cycle loss. Differentiating along the trajectory gives the MeanFlow identity (Geng et al., 2025),
where is the total derivative along at fixed . Following Geng et al. (2026), we use the right-hand side as a prediction of the instantaneous velocity,
where denotes the stop-gradient and the total derivative is computed by one Jacobian-vector product with tangent . Since the marginal velocity v is unknown, the tangent is predicted by an auxiliary velocity head, which shares all but the last two layers with . With , both outputs regress onto the conditional velocity,
with the adaptive weight of Geng et al. (2025) and the dimension of (all hyperparameters are defined in Appendix C). The expectation is taken over simulations , noise , and independent times drawn from a power-law distribution. Hence, times are sampled more often closer to the target, similar to Wildberger et al. (2023). For some of the pairs we set , where and (7) reduces to flow matching. Besides stabilizing training, the velocity head allows us to use the trained mean flow as a flow matching model. To encourage invertibility of the flow map, we add the cycle loss of Rehman et al. (2026), which penalizes the discrepancy between a state and its image after mapping and back,
and minimize with the cycle weight . We further replace some in (8) by the condition of another simulation, to encourage to be invertible for every condition and to make the map robust to any MCMC proposal.
Exact densities from composed steps. We fix a schedule and let be the step maps toward noise. With and , the change-of-variables expression is
(9)
where each Jacobian can be computed via autodiff. If the composed map is a diffeomorphism of , the chain rule gives , so (9) is the pullback of the base density through . We place the nodes by an EDM schedule (Karras et al., 2022), with , which concentrates the steps near the data for and has been shown to outperform other schedules for few-step density evaluation (Rehman et al., 2026).
Conditioning. Although the mean flow only receives x as an additional input and regresses the same target as an unconditional model, we show that it learns the correct conditional flow map. Similar to conditional diffusion models (Vincent, 2011; Batzolis et al., 2021; Arruda et al., 2026), the condition only restricts which targets contribute to the regression.
Proposition 1 (Conditional mean flows). Under the assumptions of Appendix A.1, every population minimizer of the unweighted loss satisfies for -almost every , where is the average velocity (3) of . Hence, (9) equals for every schedule.
The proof is given in Appendix A.1.
3.2 Sampling and Posterior Inference
For sampling, we draw and apply the flow map backward along the same schedule, for , so that steps yield a sample . In the posterior direction, these are parameter draws conditional on the observed data; in the likelihood direction, they are observation draws conditional on the parameters. These samples follow the density in (9) only if the backward maps invert the forward maps , which the cycle loss encourages.
In the likelihood direction, the joint log-posterior of i.i.d. observations is proportional to , which is differentiable in for any fixed with nonsingular step Jacobians. We expose it to PyMC as a distribution (Salvatier et al., 2016) and sample with nutpie's NUTS on the JAX backend (Seyboldt et al., 2026).
Additionally, we can construct a two-level sampler as a trained mean flow provides a coarse likelihood with few steps and a fine likelihood by integrating its velocity head with an accurate ODE solver (1). This defines a coarse and a fine posterior,
(10)
which we combine in two-level delayed acceptance MCMC (Christen and Fox, 2005; Lykkegaard et al., 2023). From the current state , a subchain of J random-walk Metropolis steps targeting yields a proposal , which is accepted with probability
Since the subchain is reversible with respect to , this correction makes the invariant distribution (Lykkegaard et al., 2023), while the fine likelihood is evaluated only once per subchain instead of at every proposal.
3.3 Masked Transformers for Marginal Densities
Inspired by the Simformer (Gloeckler et al., 2024), we use masked attention to learn marginal densities for subsets of the target coordinates. Our transformer tokenizes each coordinate of and and receives through adaptive layer normalization (Peebles and Xie, 2023). The mask excludes omitted target tokens, so outputs depend on only through ; the mean-flow and cycle losses are restricted to .
Proposition 2 (Marginalization by masking). Under the assumptions of Appendix A.2, every population minimizer of the unweighted masked loss satisfies for every training mask and -almost every , where is the average velocity of . Hence, (9) in dimensions equals for every schedule.
The proof is given in Appendix A.2. Choosing gives marginal posterior densities ; choosing gives marginal likelihoods . We evaluate the latter for missing observations in Section 4.3.
4 EXPERIMENTS
We evaluate direct posterior approximation on two moons and likelihood approximation on the three further benchmarks, where the learned densities enter MCMC. The benchmarks show the following:
• Two moons: few steps give accurate samples, so sampling has only a minor speed-accuracy trade-off, and densities improve with more steps (Section 4.1).
• Cognitive model: exchangeable likelihoods yield precision comparable to 200-step flow matching with about faster MCMC (Section 4.2).
• Epidemic renewal: a masked transformer marginalizes missing observations and is more accurate than a normalizing flow (Section 4.3).
• g-and-k: at a shared budget, more draws beat more steps, and delayed acceptance MCMC is as accurate as NUTS without gradients (Section 4.4).
We compare samples with exact references using the classifier two-sample test (C2ST; Lopez-Paz and Oquab, 2017), and densities through the Hellinger distance (Appendix B). Reference-free evaluations use normalized root mean squared error (NRMSE), effective sample size (ESS) and predictive checks, and the calibration for every trained estimator is assessed using tests of accuracy with random points (TARP; Lemos et al., 2023) prior to any other evaluation (Table S1). Tasks, architectures and generative models are described in Appendix B to E.
4.1 Few Steps Suffice for High Posterior Sample and Density Quality
Setup and baseline. The two moons task has a two-dimensional parameter and observation, a bimodal crescent posterior, and an exact likelihood and posterior sampler (Greenberg et al., 2019; Lueckmann et al., 2021). All methods learn the posterior direction and are sampled directly with 5,000 draws per dataset, which we score against 32,000 exact reference draws. We compare a conditional mean flow at step counts with three baselines: a conditional normalizing flow, a conditional consistency model as the established few-step method (Song et al., 2023; Schmitt et al., 2024b), and a separately trained conditional flow matching model integrated with S Euler steps or an adaptive Tsit5 solver (Tsitouras, 2011). We integrate the velocity head of the mean flow with the same Euler or adaptive scheme, which repurposes the mean flow as a flow matching model. For both the consistency model and the mean flow, we tuned the sampling schedule for each step count on held-out observations, which are disjoint from the evaluation datasets.
Sample quality. The conditional mean flow reaches a similar C2ST at every step count (Figure 1 and Figure S1A), so a single step suffices for sampling and already outperforms the normalizing flow (0.523 against 0.543). In contrast, the consistency model needs at least 4 steps to approach this accuracy, and both flow matching variants need at least 32 Euler steps. The adaptive solver further improves the accuracy, but requires more than 300 solver steps. Hence, the mean flow with S=1 draws 5,000 samples about 23 times faster than flow matching with 32 Euler steps and 140 times faster than with the adaptive solver (Figure S2). It is also about 6 times faster than the normalizing flow and only reaches its sampling time at S=8.
Since the velocity head of the mean flow and the separately trained model perform similarly under both solvers, mean flow training does not seem to degrade the learned velocity field. The consistency model is also sensitive to its discretization exponent, whose candidates span a C2ST from 0.54 to 0.98 at S=4, whereas the EDM schedule of the mean flow changes the C2ST by at most 0.015 (Table S3).
Density quality. In contrast to sampling, we find that additional mean flow steps improve the density, and the Hellinger distance to the exact posterior de-

Flow matching, Euler
Composed trials N
Figure 2: Composing one learned trial likelihood over N trials of a cognitive model. (A) NRMSE of the composed posterior to the generating parameter. (B) Worst posterior predictive discrepancy across choice proportion, conditional response-time quantiles and timeout rate. (C) Posterior contraction relative to the prior. Lines show the mean over 10 independent datasets, bands the sample standard deviation.
creases with S (Figure S1B and Table S4). With S=1, the mean flow places mass between the two modes (Figure 1C), but it still outperforms the normalizing flow. Euler integration of either velocity field remains less accurate than the mean flow with up to 32 steps. The adaptive solver is most accurate, with the velocity head of the mean flow ahead of the separately trained flow matching model.
Moreover, the mean flow density is close to normalized, whereas the Euler densities overshoot unit mass by many orders of magnitude at S=1 and remain far from normalized at S=32 (Table S4). We attribute this to the Euler scheme approximating both the trajectory and the divergence integral in (1), whereas the mean flow computes the exact Jacobian determinant of each step. The normalizing flow is exactly normalized, but its density shows fold artifacts and places mass outside the prior support (Figure 1A). Flow matching models with adaptive solvers provide the most accurate densities, but more than 300 steps per evaluation make them too expensive for repeated density evaluation.
4.2 Single-Step Likelihoods Yield Error Comparable to 200-Step Flow Matching
Setup and baseline. The cognitive model describes two-alternative decisions as a Wiener first-passage process with drift , boundary separation and non-decision time (Ratcliff et al., 2016), and is a standard benchmark for learned single-trial likelihoods (Fengler et al., 2021). We train one conditional mean flow on the signed response time , with choice and response time , and compose the learned trial likelihood into joint posteriors over trials, which we sample with NUTS. Since a response cannot be faster than , we truncate the prior of at the fastest observed response time of each run. We compare mean flow step counts with a flow matching model integrated with 200 Euler steps.
Results. With S=1, the NRMSE and posterior contraction of the mean flow are comparable to the flow matching baseline at every N (Figure 2, Table S5 and Figure S3), while sampling is 182 to 216× faster (Figure S2D). Additional steps increase the cost and the number of convergence failures without clearly reducing the parameter error (Figure S4). From all MCMC runs, 8.5% failed to converge, and all failed runs used (Table S5). We attribute this to the fact that the mean flow is trained for few-step sampling and evaluation only, and hence the intermediate maps might be poorly trained and additional steps, unlike in the discretization of an ODE, need not reduce the approximation error.
However, for every method the coverage of the 95% central interval decreases and the worst posterior predictive discrepancy increases with N (Figure 2B). Composing many approximate likelihoods accumulates their errors while the posterior contracts, which makes even the 200-step baseline overconfident. With S=1, the additional discretization error further lowers the coverage at N=256, whereas with S=2 coverage and predictive discrepancy are comparable to the baseline.
4.3 Masked Transformer Backbone Reduces Error under Missing Observations
Setup and baseline. Since conditional mean flows do not constrain the network architecture, we can tailor the backbone to observations with missing entries. We consider a stochastic renewal process, a standard forward model for estimating time-varying reproduction numbers (Fraser, 2007; Cori et al., 2013; Gostic et al., 2020), in which the incidence is driven by a generation-interval force (Appendix E.3 and Figure S5). The parameter is the 128-dimensional coefficient vector with , where is the Cholesky factor of a

Figure 3: Posterior predictive simulations of the renewal model on one dataset. Observations 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 bands against the observed data (black). The gray strip is the seeded window, and the striped columns mark the missing time points.
Table 1: Likelihoods with missing observations. Mean (sample standard deviation) over 10 datasets. is simulated with the learned likelihood.
| Mean flow | Normalizing flow | |
|---|---|---|
| NRMSE | 0.187 (0.008) | 0.199 (0.009) |
| RMSE | 0.055 (0.007) | 0.159 (0.036) |
| RMSE | 0.060 (0.013) | 0.125 (0.031) |
| ESS | 4,234 (247) | 2,700 (629) |
| Leapfrog steps | 121 (4) | 480 (57) |
| Wall time (s) | 36,146 (6,157) | 1,624 (285) |
squared-exponential kernel (Rasmussen and Williams, 2005), such that the prior is . We withhold of the observed steps completely at random and redraw this pattern for each dataset. Under this mechanism, inference only requires the marginal likelihood of the observed entries (Little and Rubin, 2019). We parameterize the mean flow with a masked transformer trained with missing coordinates and a causal mask over time. In contrast, the normalizing flow has a fixed input width, so we train and evaluate it with a value of in the missing entries (Figure S5C). Both models are trained on a low budget of 8,192 simulations, and the mean flow is evaluated with .
Posterior accuracy and sampling cost. Both methods converge on every dataset without divergent transitions. The conditional mean flow with the masked transformer has a lower NRMSE to the generating coefficients than the normalizing flow, its posterior draws reproduce the observed more closely under the learned likelihood and the simulator (Table 1), and its ESS per network evaluation is six times higher. However, each evaluation of the transformer is computationally more costly, such that the normalizing flow finishes sampling sooner, despite requiring more leapfrog steps inside NUTS.
Posterior predictive. Simulations from the learned likelihoods at posterior draws reveal the problem of sentinel values (Figure 3). The predictive bands of the mean flow contract around the observed data at every observed time point. In contrast, the normalizing flow frequently generates the sentinel value also at observed time points, which is reflected in a higher predictive RMSE (Table 1).
In summary, the flexible architecture of mean flows allows a masked transformer to marginalize missing observations. This yields a lower posterior error than a normalizing flow with sentinel values, but at a higher cost per density evaluation.
4.4 More Posterior Draws Are Better Than More Flow Steps
Setup and baseline. The g-and-k distribution is a standard benchmark with an intractable likelihood, defined through its quantile function (Rayner and MacGillivray, 2002; Drovandi and Pettitt, 2011). We use a bivariate version with a Gaussian copula and parameters , and datasets of observations (Appendix E.2). The conditional mean flow learns the likelihood of a single observation, and we sample the posterior with NUTS. To assess whether a computational budget should be spent on more mean flow steps or on more posterior draws, we fix the product of requested draws per chain and network evaluations per density (Appendix D). Under this budget, we compare mean flow step counts with a normalizing flow. In addition, we evaluate delayed acceptance MCMC, which screens proposals with the mean flow at steps and accepts them against a 100-step Tsit5 evaluation of the velocity head of the same network (Section 3.2 and Appendix D). A separately trained flow matching model integrated with 200 Euler steps serves as a baseline outside the budget, with 28 times

Mean flow
Two-level DA (fine: mean flow as FM, S = 100)
Normalizing flow
Flow matching, Euler S = 200, off budget
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.
more network evaluations.
Steps against draws. All mean flow settings converge on every dataset and reach a similar accuracy, with the lowest mean C2ST at S=4, although these differences are smaller than the spread across datasets (Figure 4A, Table S6). Fewer steps permit longer chains, and the minimum bulk ESS per network evaluation drops by an order of magnitude from S=1 to S=8 (Figure 4B–C). Hence, beyond S=4, a more accurate likelihood does not compensate for fewer posterior draws, and in practice, we recommend S=2 for this benchmark. Under the same budget, the normalizing flow has a higher C2ST than every mean flow setting and requires more than four times the wall time of the mean flow (S=2; Figure S2B). Regular flow matching also has a higher C2ST despite requiring more evaluations, and the same mean flow is about faster.
Delayed acceptance MCMC. Screening proposals with a coarse mean flow and accepting them against the fine evaluation of the same network gives an accuracy comparable to NUTS (Table S6). With the coarse acceptance rate adapted to 0.3, the fine level accepts 80 to 85% of the evaluated proposals, rising with . Delayed acceptance MCMC is about 26–37 times faster than the flow matching baseline, but slower than NUTS with the mean flow likelihoods and yields a lower ESS.
In summary, a few mean flow steps with more posterior draws give a lower posterior error than both the normalizing flow and the flow matching baseline, at lower wall time. Delayed acceptance MCMC with the same network gives comparable accuracy without gradients.
5 DISCUSSION
Neural density estimators for SBI have so far traded flexibility for fast density evaluation. Conditional mean flows relax this trade-off by allowing the step count to be chosen after training. In low-dimensional benchmarks, one or two steps matched the accuracy of flow matching while reducing MCMC time by up to two orders of magnitude. Few steps also yielded accurate posterior samples, and under a fixed MCMC budget, more draws were more valuable than more steps.
Limitations. The main limitation is the cost of density evaluation in high dimensions. Each step requires its full Jacobian and a log-determinant, whose cost grows cubically with the dimension, and differentiating the log-determinant for NUTS involves second-order derivatives. Together with the higher cost of each transformer evaluation, this made MCMC in the renewal application slower than with the normalizing flow despite using fewer network evaluations. In addition, the cycle loss encourages but does not guarantee invertibility, so the learned densities may not exactly be normalized. Finally, the coverage of every method, including flow matching with 200 steps, decreased at large trial counts, consistent with error accumulation.
Outlook. Beyond MCMC, fast mean flow densities can support self-consistency objectives (Schmitt et al., 2024a) and, together with prior and likelihood evaluations, evidence estimation (Kucharský et al., 2026). Since these methods also rely on repeated density evaluation, our work could make flexible flow-based estimators practical in any SBI setting that requires densities.
References
T. Akiba, S. Sano, T. Yanase, T. Ohta, and M. Koyama. Optuna: A next-generation hyperparameter optimization framework. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD '19, pages 2623–2631, New York, NY, USA, 7 2019. Association for Computing Machinery. doi: 10.1145/3292500.3330701.
J. Arruda, Y. Schälte, C. Peiter, O. Teplytska, U. Jaehde, and J. Hasenauer. An amortized approach to non-linear mixed-effects modeling based on neural posterior estimation. In R. Salakhutdinov, Z. Kolter, K. Heller, A. Weller, N. Oliver, J. Scarlett, and F. Berkenkamp, editors, Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 1865–1901. PMLR, 7 2024. URL https://proceedings.mlr.press/v235/arruda24a.html.
J. Arruda, N. Bracher, U. Köthe, J. Hasenauer, and S. T. Radev. Diffusion models in simulation-based inference: A tutorial review. Transactions on Machine Learning Research, 2026. URL https://openreview.net/forum?id=86Q261z005.
G. Batzolis, J. Stanczuk, C.-B. Schönlieb, and C. Etmann. Conditional image generation with score-based diffusion models. arXiv preprint arXiv:2111.13606, 2021. doi:10.48550/arxiv.2111.13606.
M. Betancourt. A Conceptual Introduction to Hamiltonian Monte Carlo. arXiv preprint arXiv:1701.02434, 2017. doi:10.48550/arxiv.1701.02434.
J. Boelts, J.-M. Lueckmann, R. Gao, and J. H. Macke. Flexible and efficient simulation-based inference for models of decision-making. Elife, 11:e77220, 2022. doi: 10.7554/elife.77220.
J. Bradbury, R. Frostig, P. Hawkins, M. J. Johnson, Y. Katariya, C. Leary, D. Maclaurin, G. Necula, A. Paszke, J. VanderPlas, S. Wanderman-Milne, and Q. Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/jax-ml/jax.
P.-C. Bürkner, M. Scholz, and S. T. Radev. Some models are useful, but how do we know which ones? towards a unified Bayesian model taxonomy. Statistics Surveys, 17:216–310, 2023. doi:10.1214/23-ss145.
B. Carpenter, A. Gelman, M. D. Hoffman, D. Lee, B. Goodrich, M. Betancourt, M. Brubaker, J. Guo, P. Li, and A. Riddell. Stan: A probabilistic programming language. Journal of statistical
software, 76(1):1–32, 2017. doi:10.18637/jss.v076.i01.
R. T. Q. Chen, Y. Rubanova, J. Bettencourt, and D. Duvenaud. Neural ordinary differential equations. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS'18, pages 6572–6583, Red Hook, NY, USA, 2018. Curran Associates Inc. URL https://dl.acm.org/doi/10.5555/3327757.3327764.
T. Chen, V. Bansal, and J. G. Scott. Conditional diffusions for amortized neural posterior estimation. In Y. Li, S. Mandt, S. Agrawal, and E. Khan, editors, Proceedings of The 28th International Conference on Artificial Intelligence and Statistics, volume 258 of Proceedings of Machine Learning Research, pages 2377–2385. PMLR, 2025. URL https://proceedings.mlr.press/v258/chen25d.html.
F. Chollet et al. Keras. https://keras.io, 2015.
J. A. Christen and C. Fox. Markov chain Monte Carlo using an approximation. Journal of Computational and Graphical Statistics, 14(4):795–810, 2005. doi:10.1198/106186005x76983.
A. Cori, N. M. Ferguson, C. Fraser, and S. Cauchemez. A new framework and software to estimate time-varying reproduction numbers during epidemics. American journal of epidemiology, 178(9):1505–1512, 2013. doi: 10.1093/aje/kwt133.
K. Cranmer, J. Brehmer, and G. Louppe. The frontier of simulation-based inference. Proceedings of the National Academy of Sciences, 117(48):30055–30062, 5 2020. doi: 10.1073/pnas.1912789117.
M. Deistler, J. Boelts, P. Steinbach, G. Moss, T. Moreau, M. Gloeckler, P. L. C. Rodrigues, J. Linhart, J. K. Lappalainen, B. K. Miller, P. J. Gonçalves, J.-M. Lueckmann, C. Schröder, and J. H. Macke. Simulation-Based Inference: A Practical Guide. arXiv preprint arXiv:2508.12939, 2025. doi:10.48550/arxiv.2508.12939.
L. Dinh, J. Sohl-Dickstein, and S. Bengio. Density estimation using real NVP. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=HkpbnH9lx.
C. C. Drovandi and A. N. Pettitt. Likelihood-free Bayesian estimation of multivariate quantile distributions. Computational Statistics & Data Analysis, 55(9):2541–2556, 2011. doi:10.1016/j.csda.2011.03.019.
C. Durkan, A. Bekasov, I. Murray, and G. Papamakarios. Neural spline flows. In Proceedings of the 33rd International Conference on Neural Information Processing Systems. Curran
Associates Inc., 2019. URL https://proceedings.neurips.cc/paper_files/paper/2019/file/7ac71d433f282034e088473244df8c02-Paper.pdf.
A. Fengler, L. N. Govindarajan, T. Chen, and M. J. Frank. Likelihood approximation networks (lans) for fast inference of simulation models in cognitive neuroscience. eLife, 10:e65074, 2021. doi: 10.7554/elife.65074.
C. Fraser. Estimating individual and household reproduction numbers in an emerging epidemic. PLoS one, 2(8):e758, 2007. doi: 10.1371/journal.pone.0000758.
Z. Geng, M. Deng, X. Bai, Z. Kolter, and K. He. Mean flows for one-step generative modeling. In Advances in Neural Information Processing Systems 38, pages 84032–84054, 2025. doi: 10.52202/085713-2534.
Z. Geng, Y. Lu, Z. Wu, E. Shechtman, J. Z. Kolter, and K. He. Improved mean flows: On the challenges of fastforward generative models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 30467–30476, 6 2026. URL https://openaccess.thecvf.com/content/CVPR2026/html/Geng_Improved_Mean_Flow_S_On_the_Challenges_of_Fastforward_Generative_Models_CVPR_2026_paper.html.
M. Gloeckler, M. Deistler, C. Weilbach, F. Wood, and J. H. Macke. All-in-one simulation-based inference. In Proceedings of the 41st International Conference on Machine Learning, ICML'24, pages 15735–15766. JMLR.org, 2024. URL https://dl.acm.org/doi/10.5555/3692070.3692700.
K. M. Gostic, L. McGough, E. B. Baskerville, S. Abbott, K. Joshi, C. Tedijanto, R. Kahn, R. Niehus, J. A. Hay, P. M. De Salazar, et al. Practical considerations for measuring the effective reproductive number, . PLoS computational biology, 16(12):e1008409, 2020. doi: 10.1371/journal.pcbi.1008409.
D. Greenberg, M. Nonnenmacher, and J. Macke. Automatic posterior transformation for likelihood-free inference. In International conference on machine learning, pages 2404–2414. PMLR, 2019. URL https://proceedings.mlr.press/v97/gree nberg19a.html.
J. Gu, T. Chen, D. Berthelot, H. Zheng, Y. Wang, R. ZHANG, L. Dinh, M. Á. Bautista, J. M. Susskind, and S. Zhai. STARFlow: Scaling latent normalizing flows for high-resolution image synthesis. In The Thirty-ninth Annual Conference on Neural Information Processing Systems, pages 134122–134158, 2025. doi: 10.52202/085713-4036.
M. D. Hoffman and A. Gelman. The No-U-turn sampler: Adaptively setting path lengths in
Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15(1):1593–1623, 2014. doi:10.5555/2627435.2638586.
T. Karras, M. Aittala, S. Laine, and T. Aila. Elucidating the design space of diffusion-based generative models. In Proceedings of the 36th International Conference on Neural Information Processing Systems, NIPS '22, Red Hook, NY, USA, 2022. Curran Associates Inc. doi: 10.52202/068431-1926.
Š. Kucharský and P.-C. Bürkner. Amortized Bayesian mixture models. Statistics and Computing, 36(4), 62026. doi: 10.1007/s11222-026-10911-y.
Š. Kucharský, A. Mishra, D. Habermann, S. T. Radev, and P.-C. Bürkner. Improving the accuracy of amortized model comparison with self-consistency. arXiv preprint arXiv:2508.20614, 2026. doi: 10.48550/arxiv.2508.20614.
L. Kühmichel, J. M. Huang, V. Pratz, J. Arruda, H. Olschläger, D. Habermann, S. Kucharsky, L. Elsemüller, A. Mishra, N. Bracher, et al. BayesFlow 2.0: Multi-backend amortized Bayesian inference in python. arXiv preprint arXiv:2602.07098, 3 2026. doi: 10.48550/arxiv.2602.07098.
P. Lemos, A. Coogan, Y. Hezaveh, and L. Perreault-Levasseur. Sampling-based accuracy testing of posterior estimators for general inference. In A. Krause, E. Brunskill, K. Cho, B. Engelhardt, S. Sabato, and J. Scarlett, editors, Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 19256–19273. PMLR, 7 2023. URL https://proceedings.mlr.press/v202/lemos23a.html.
Y. Lipman, R. T. Q. Chen, H. Ben-Hamu, M. Nickel, and M. Le. Flow matching for generative modeling. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=PqvMRDCJT9t.
R. J. Little and D. B. Rubin. Statistical analysis with missing data. Wiley Series in Probability and Statistics. John Wiley & Sons, 2019. doi: 10.1002/9781119482260.
X. Liu, C. Gong, and Q. Liu. Flow straight and fast: Learning to generate and transfer data with rectified flow. In The Eleventh International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=XVjTT1nw5z.
D. Lopez-Paz and M. Oquab. Revisiting classifier two-sample tests. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=SJkXfE5xx.
C. Lu and Y. Song. Simplifying, stabilizing and scaling continuous-time consistency models. In The Thirteenth International Conference on Learning Representations, 2025. URL https://openreview.net/forum?id=LyJi5ugyJx.
J.-M. Lueckmann, J. Boelts, D. Greenberg, P. Goncalves, and J. Macke. Benchmarking simulation-based inference. In International conference on artificial intelligence and statistics, pages 343–351. PMLR, 2021. URL http://proceedings.mlr.press/v130/lueckmann21a.html.
M. B. Lykkegaard, T. J. Dodwell, C. Fox, G. Mingas, and R. Scheichl. Multilevel delayed acceptance MCMC. SIAM/ASA Journal on Uncertainty Quantification, 11(1):1–30, 2023. doi:10.1137/22m1476770.
O. A. Martin, O. Abril-Pla, J. Deklerk, S. D. Axen, C. Carroll, A. Hartikainen, and A. Vehtari. ArviZ: a modular and flexible library for exploratory analysis of Bayesian models. Journal of Open Source Software, 11(119):9889, 2026. doi:10.21105/joss.09889.
A. Mishra, D. Habermann, M. Schmitt, S. Radev, and P.-C. Bürkner. Robust amortized Bayesian inference with self-consistency losses on unlabeled data. In C. Vondrick, B. Hariharan, C. Raffel, L. Pinto, D. Yang, and A. Faust, editors, International Conference on Learning Representations, volume 2026, pages 9374–9405, 2026. URL https://proceedings.iclr.cc/paper_files/paper/2026/hash/0fd3d8093b3ba73d19b393a1326fdba7-Abstract-Conference.html.
G. Papamakarios, E. Nalisnick, D. J. Rezende, S. Mohamed, and B. Lakshminarayanan. Normalizing flows for probabilistic modeling and inference. Journal of Machine Learning Research, 22(57):1–64, 2021. URL http://jmlr.org/papers/v22/19-1028.html.
W. Peebles and S. Xie. Scalable diffusion models with transformers. In 2023 IEEE/CVF International Conference on Computer Vision (ICCV), pages 4172–4182, 2023. URL https://doi.org/10.1109/ICCV51070.2023.00387.
E. Perez, F. Strub, H. De Vries, V. Dumoulin, and A. Courville. FiLM: Visual reasoning with a general conditioning layer. In Proceedings of the AAAI conference on artificial intelligence, volume 32, 4 2018. doi: 10.1609/aaai.v32i1.11671.
T. P. Prescott and R. E. Baker. Multifidelity approximate Bayesian computation with sequential Monte Carlo parameter sampling. SIAM/ASA Journal on Uncertainty Quantification, 9(2): 788–817, 1 2021. doi: 10.1137/20m1316160.
S. T. Radev, M. Schmitt, L. Schumacher, L. Elsemüller, V. Pratz, Y. Schälte, U. Köthe, and P.-C. Bürkner. BayesFlow: Amortized Bayesian workflows with neural networks. Journal of Open Source Software, 8(89):5702, 2023. doi:10.21105/joss.05702.
C. E. Rasmussen and C. K. I. Williams. Gaussian Processes for Machine Learning. The MIT Press, 112005. doi: 10.7551/mitpress/3206.001.0001.
R. Ratcliff, P. L. Smith, S. D. Brown, and G. McKoon. Diffusion decision model: Current issues and history. Trends in cognitive sciences, 20(4):260–281, 2016. doi: 10.1016/j.tics.2016.01.007.
G. D. Rayner and H. L. MacGillivray. Numerical maximum likelihood estimation for the g-and-k and generalized g-and-h distributions. Statistics and computing, 12(1):57–75, 2002. doi:10.1023/a:1013120305780.
D. Rehman, T. Akhound-Sadegh, A. Gazizov, Y. Bengio, and A. Tong. FALCON: Few-step accurate likelihoods for continuous flows. In C. Vondrick, B. Hariharan, C. Raffel, L. Pinto, D. Yang, and A. Faust, editors, International Conference on Learning Representations, volume 2026, pages 70449–70473, 2026. URL https://proceedings.iclr.cc/paper_files/paper/2026/file/72bcad2c3fe7625fc233fabe84a6d7ef-Paper-Conference.pdf.
J. Salvatier, T. V. Wiecki, and C. Fonnesbeck. Probabilistic programming in Python using PyMC3. PeerJ Computer Science, 2016:e55, 2016. doi:10.7717/peerj-cs.55.
M. Schmitt, D. R. Ivanova, D. Habermann, U. Koethe, P.-C. Bürkner, and S. T. Radev. Leveraging self-consistency for data-efficient amortized Bayesian inference. In R. Salakhutdinov, Z. Kolter, K. Heller, A. Weller, N. Oliver, J. Scarlett, and F. Berkenkamp, editors, Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 43723–43741. PMLR, 7 2024a. URL https://proceedings.mlr.press/v235/schmitt24a.html.
M. Schmitt, V. Pratz, U. Köthe, P.-C. Bürkner, and S. T. Radev. Consistency models for scalable and fast simulation-based inference. In Proceedings of the 38th International Conference on Neural Information Processing Systems, NIPS '24, pages 126908–126945, Red Hook, NY, USA, 2024b. Curran Associates Inc. doi: 10.52202/079017-4030.
A. Seyboldt, E. L. Carlson, and B. Carpenter. Preconditioning Hamiltonian Monte Carlo by minimizing Fisher divergence. arXiv preprint arXiv:2603.18845, 2026. doi:10.48550/arxiv.2603.18845.
L. Sharrock, J. Simons, S. Liu, and M. Beaumont. Sequential neural score estimation: likelihood-free inference with conditional score based diffusion models. In Proceedings of the 41st International Conference on Machine Learning, ICML'24, pages 44565–44602. JMLR.org, 2024. URL https://dl.acm.org/doi/10.5555/3692070.3693884.
S. A. Sisson, Y. Fan, and M. Beaumont. Handbook of approximate Bayesian computation. Chapman and Hall/CRC, 2018. doi: 10.1201/9781315117195.
Y. Song, P. Dhariwal, M. Chen, and I. Sutskever. Consistency models. In Proceedings of the 40th International Conference on Machine Learning, ICML'23, pages 32211–32252. JMLR.org, 2023. URL https://dl.acm.org/doi/10.5555/3618408.3619743.
C. Tatsuoka, M. Yang, D. Xiu, and G. Zhang. Bifidelity parameter estimation using conditional diffusion models. SIAM/ASA Journal on Uncertainty Quantification, 14(3):743–778, 7 2026. doi: 10.1137/25m1734567.
C. Tsitouras. Runge-kutta pairs of order 5(4) satisfying only the first column simplifying assumption. Computers & mathematics with applications, 62(2):770–775, 2011. doi:10.1016/j.camwa.2011.06.002.
A. Vehtari, A. Gelman, D. Simpson, B. Carpenter, and P.-C. Bürkner. Rank-normalization, folding, and localization: An improved for assessing convergence of MCMC (with discussion). Bayesian analysis, 16(2):667–718, 2021. doi:10.1214/20-ba1221.
P. Vincent. A connection between score matching and denoising autoencoders. Neural computation, 23(7):1661–1674, 2011. doi: 10.1162/neco_a_00142.
Z. Wang, J. Hasenauer, and Y. Schälte. Missing data in amortized simulation-based neural posterior estimation. PLoS Computational Biology, 20(6): e1012184, 2024. doi: 10.1371/journal.pcbi.1012184.
J. Wildberger, M. Dax, S. Buchholz, S. R. Green, J. H. Macke, and B. Schölkopf. Flow matching for scalable simulation-based inference. In Proceedings of the 37th International Conference on Neural Information Processing Systems, NIPS '23, pages 16837–16864, Red Hook, NY, USA, 2023. Curran Associates Inc. doi: 10.52202/075280-0737.
V. K. Yalavarthi, R. Scholz, C. Kloetergens, K. Madhusudhanan, S. Born, and L. Schmidt-Thieme. Marginalization consistent probabilistic forecasting of irregular time series via
mixture of separable flows. arXiv preprint arXiv:2406.07246, 2024. doi:10.48550/arxiv.2406.07246.
Y. Ye, A. Pandey, C. Bawden, D. M. Sumsuzzman, R. Rajput, A. Shoukat, B. H. Singer, S. M. Moghadas, and A. P. Galvani. Integrating artificial intelligence with mechanistic epidemiological modeling: a scoping review of opportunities and challenges. Nature Communications, 16(1):581, 2025. doi: 10.1038/s41467-024-55461-x.
S. Zhai, R. Zhang, P. Nakkiran, D. Berthelot, J. Gu, H. Zheng, T. Chen, M. Á. Bautista, N. Jaitly, and J. M. Susskind. Normalizing flows are capable generative models. In Forty-second International Conference on Machine Learning, 2025. URL https://openreview.net/forum?id=2uheUFcFsM.
A PROOFS
A.1 Conditional Mean Flows
Conditioning reduces the main population objective to an unconditional mean flow objective for each conditional target, as in conditional diffusion and flow matching (Vincent, 2011; Batzolis et al., 2021; Arruda et al., 2026). We write for the ODE flow of and for its average velocity, defined by , with diagonal value .
Assumptions.
(A1) Noise. is independent of , and .
(A2) Time pairs. is independent of , and its distribution has an absolutely continuous component whose density is strictly positive on .
(A3) Regularity. For -almost every , the conditional target has a density, and is continuously differentiable in state and time and globally Lipschitz in the state, uniformly over .
(A4) Realizability. The admissible pairs are jointly measurable in , continuously differentiable in state and time, and have finite population loss, and they contain the exact pair simultaneously for all conditions.
(A3) gives a global continuously differentiable flow through both endpoints. For targets with compact support or discontinuous densities, such as the uniform priors in two moons, is in general not Lipschitz near . For such targets, the argument below applies on for every and, for schedules starting at , yields the density of the slightly smoothed target , which converges to the target as . In practice, we do not truncate the schedule and keep , since is almost surely never sampled, and the network's value at is the continuous extension of the fitted values at small .
Proposition 1 (Conditional mean flows). Assume , and let be unweighted . Then every population minimizer satisfies, for -almost every ,
Consequently, for every schedule , the composed map equals , a diffeomorphism that transports to , and (9) equals .
Proof of Proposition 1. Let and . By (A1) and (A2), , and (A1) ensures that all terms are finite. Both predictions in the main loss are functions of these inputs, so the conditional-expectation decomposition gives
By (A4) and the MeanFlow identity, the exact pair makes the last two terms zero. Every minimizer therefore satisfies almost everywhere under the training distribution. For almost every condition, the Gaussian interpolation has full support at interior times. Together with the time-pair density and continuity, this extends the equalities to all states and times.
Fix such a condition and a trajectory . Since , the total derivative in is taken along this trajectory, and for fixed ,
Since , we obtain and hence , with the diagonal identity following by continuity. Since , the flow of transports to under (A3) (Lipman et al., 2023; Liu et al., 2022). Flow composition gives for every schedule, and change of variables gives (9).
The exact flow map satisfies for every condition, including swapped ones, so the exact pair also attains the minimum . Hence, adding does not change the set of population minimizers. For , the weight depends on the regression target through the residual, and the decomposition above no longer applies. The adaptive weight thus acts as a robust loss that down-weights large residuals (Geng et al., 2025), and in general changes the learned velocity, but empirically seems to stabilize training (see Table S2).
A.2 Marginalization by Masking
We show that the masked objective of Section 3.3 targets the marginal distribution of the retained target coordinates. For a set , we write for the retained coordinates of , and and for the outputs of the network on .
Proposition 2 (Marginalization by masking). Let the mask be nonempty with law , independent of , let the network outputs on depend on the target only through , and let the unweighted loss be restricted to the coordinates in . Assume for each marginal target with , and simultaneously for all such masks. Then every population minimizer satisfies, for every with and -almost every , and , where is the average velocity of
Consequently, (9), with the base density and Jacobians evaluated in dimensions, equals for every schedule.
Proof of Proposition 2. For a fixed mask, independence leaves the simulation law unchanged, and the coordinate-wise interpolation is
The masked main loss is therefore a positively weighted sum of the conditional mean flow objectives for the marginal targets. By the simultaneous realizability in (A4), the exact pairs attain every summand's lower bound, so every minimizer attains each one. Proposition 1 applied to gives the result.
Additional attention restrictions are covered only when they preserve the ability to represent and its average velocity. The independence of the synthetic training mask holds by construction and does not impose a missingness mechanism on the observed data. The marginal density uses only the observed coordinates. For , the residual and hence depend only on the retained coordinates, so the reduction to the marginal targets still holds, but each summand then has the weighted minimizer discussed in Appendix A.1.
B EVALUATION METRICS
All experiments use 10 independent datasets, and we report the mean and standard deviation of the following metrics over datasets.
Classifier two-sample test (C2ST). The C2ST compares two distributions through a classification task (Lopez-Paz and Oquab, 2017). If the approximate and the reference posterior coincide, no classifier can tell their draws apart better than chance, whereas any difference between them can be exploited by a sufficiently flexible classifier. Hence, the held-out accuracy of a trained classifier measures how distinguishable the two distributions are: indicates indistinguishable and perfectly separable draws. We label approximate draws with 1 and reference draws with 0, subsample both sets without replacement to the same size, which is fixed within each experiment across all methods and step counts, standardize the pooled draws, and train a classifier with the binary cross-entropy. The classifier is an MLP with two residual hidden layers of width for D-dimensional draws, Mish activations, dropout of 0.1 and a sigmoid output unit. We train it with AdamW (learning rate with linear warmup and cosine decay, weight decay , gradient clipping at norm 1.5) and batch size 128 for at most 100 epochs, with early stopping (patience 5) on 20% of the training data. The accuracy of the classifier on held-out draws is averaged over 5-fold cross-validation.
Grid density metrics. On two moons, we evaluate the exact posterior and each learned density on a midpoint grid over the prior support with cell area . We report the total mass of the learned density and compare the shapes of both densities after normalizing them to cell probabilities and on the grid,
The Hellinger distance remains finite when the learned density vanishes where the exact posterior has mass, whereas the Kullback-Leibler (KL) divergence becomes infinite.
Normalized RMSE and coverage. For posterior draws , and the generating parameter of dimension , we compute
where is the prior range of parameter . Coverage is the fraction of parameters whose generating value lies within the central 95% credible interval.
Posterior contraction. We define posterior contraction as the relative reduction in variance from prior to posterior,
which measures how much the data reduce the prior uncertainty, but not whether the posterior is correct.
TARP. TARP estimates the expected coverage of credible regions around random reference points (Lemos et al., 2023) directly from the trained estimator, without MCMC or reference posteriors. We report the area between the TARP curve and the diagonal (ATC; 0 is calibrated) and the -value of the Kolmogorov-Smirnov test, using 2,000 validation pairs split into 10 folds of 200 pairs with 200 draws each (Table S1). On two moons, TARP assesses the learned posterior; for the other experiments, it assesses whether the learned likelihood generates calibrated data.
Table S1: TARP calibration of every trained estimator. Area between the TARP curve and the diagonal (ATC; 0 is calibrated, positive is overdispersed), mean (standard deviation) over 10 folds of 200 prior-predictive validation pairs (2,000 in total) with 200 draws each. Two moons calibrates the posterior; g-and-k, the renewal model and the DDM calibrate the likelihood. marks methods whose Kolmogorov-Smirnov -value is below 0.01; the ATC closest to zero per experiment is in bold.
| Experiment | Method | ATC |
|---|---|---|
| Two moons | Normalizing flow | |
| Mean flow, | ||
| Consistency model, | ||
| Mean flow (v-head), Euler | ||
| Flow matching, Euler | ||
| Mean flow (v-head) / flow matching, adaptive | ||
| g-and-k | Mean flow, | |
| Normalizing flow | ||
| Flow matching, Euler | ||
| Renewal | Mean flow, masked transformer | |
| Normalizing flow, sentinel | ||
| DDM | Mean flow, | |
| Flow matching, Euler |
Posterior predictive checks. For the DDM, we simulate a replicate dataset for each of 200 posterior draws and compare the observed choice proportion, the conditional response-time quantiles (10, 30, 50, 70 and 90%) and the timeout rate T with their replicate distribution. For each summary, we compute the discrepancy and the predictive p-value , and report the largest across summaries.
Convergence diagnostics. We compute split- and bulk ESS following Vehtari et al. (2021). A run passes our convergence criteria if , the minimum bulk ESS is at least 100 and at least 500 draws are kept. Reported means and standard deviations include runs that fail these criteria.
C ARCHITECTURES, TRAINING AND HYPERPARAMETER SEARCH
All networks and diagnostics are implemented in BayesFlow 2.0.14 (Radev et al., 2023; Kühmichel et al., 2026), where we added the conditional mean flow as an additional inference network.
Architectures
• Mean flow: An MLP with 5 hidden layers of width 256. The condition x is embedded by a linear layer and concatenated with the target z at the input, and, together with a Fourier embedding with scale 0.3 of the time pair , it modulates every residual block (Perez et al., 2018). The auxiliary velocity head shares all but the last 2 layers.
• Masked transformer: A transformer (Peebles and Xie, 2023) with 5 blocks of width 128 and four attention heads. It tokenizes each observation and parameter and receives the time pair through adaptive layer normalization. During training, each observation of each simulation is dropped independently with probability 0.3, redrawn for every batch. Dropped tokens are excluded from attention and loss. A causal mask additionally restricts each observation token to parameter and observation tokens up to its own time step. The velocity head branches from the last 2 blocks and uses the same masks. Each observation and parameter token receives a learned embedding of its coordinate index, which for observations is the time step, and a Fourier embedding is used only for the time pair.
• Consistency model: A continuous-time consistency model (Lu and Song, 2025) with an MLP of 6 hidden layers of width 256.
• Flow matching: An MLP with the same depth and width as the mean flow, without the velocity head.
• Normalizing flow: A spline coupling flow (Durkan et al., 2019) with 5 coupling layers, each with 2 hidden layers of width 256, and with 2 coupling layers, each with 2 hidden layers of width 128, for the renewal application.
Training. We trained all networks offline on standardized parameters and observations with a batch size of 256, using AdamW with weight decay , gradient clipping at norm 1.5, and a learning rate warmed up linearly over the first 5% of steps from to and then decayed to zero with a cosine schedule. We used 50,176 simulations for two moons and the DDM, 100,000 for g-and-k, and 8,192 for the renewal model to compare architectures under limited data, with 1,024 further simulations for validation. The conditional mean flow, the consistency model, and the flow matching model were trained for 1,000 epochs, and the normalizing flow for 200 epochs with early stopping (patience 10).
Hyperparameter search. We selected the training hyperparameters of the conditional mean flow with a search in Optuna (Akiba et al., 2019) on two benchmarks: two moons and a three-dimensional variant of the Gaussian linear task with uniform prior. Table S2 lists the search space and the selected values, which all experiments use. The training times are and with , and for 0 unshared layers the velocity head reads the velocity from the boundary case . Each trial trained one network per benchmark for 250 epochs of 100 freshly simulated batches of size 256 and evaluated it with steps on 256 held-out datasets with 500 posterior draws each. The score of a benchmark was the sum of an accuracy term, the calibration error, and the grid Hellinger distance to the exact posterior. The accuracy term is on two moons.
and the NRMSE on the Gaussian task, and the calibration error is the median absolute difference between the nominal and empirical coverage of central credible intervals at 20 levels. The C2ST was averaged over 15 and the Hellinger distance over 3 of the held-out datasets. The search minimized the sum of both benchmark scores with the multivariate tree-structured Parzen estimator of Optuna (Akiba et al., 2019) on 200 trials.
Table S2: Hyperparameters of the conditional mean flow. Search space of the Optuna search and the selected configuration used in all experiments.
| Hyperparameter | Search space | Selected |
|---|---|---|
| Cycle weight (log) | ||
| Probability of replacing the condition in | ||
| Fraction of time pairs with | ||
| Exponent of the adaptive weight | ||
| Offset of the adaptive weight (log) | ||
| Scale of the Fourier time embedding (log) | ||
| Exponent of the training times | ||
| Final layers not shared by the velocity head | ||
| Adaptive weight on the velocity head | no |
Sampling schedule. For two moons, we tuned the sampling schedule of the consistency model and the mean flow separately for each step count, using the C2ST on 2,000 draws for 3 held-out observations. For the consistency model, we selected the discretization exponent from . For the mean flow, we optimized the EDM schedule with 7 Optuna trials over and (log-uniform), the same number of candidates as for the consistency model. Table S3 lists the selected schedules. For , the schedule is fixed. For all other experiments, we set and .
Table S3: Sampling schedules selected on two moons. Discretization exponent of the consistency model and EDM schedule of the conditional mean flow for each step count , tuned on held-out observations; at , the schedule has no free parameter. To show how much the selection matters, we report the tuning C2ST (3 held-out observations, 2,000 draws each) of the selected and of the worst of the 7 candidates.
| Consistency model | ||||||
| C2ST, selected | ||||||
| C2ST, worst | ||||||
| Mean flow | ||||||
| C2ST, selected | ||||||
| C2ST, worst |
Code. The code and the configurations of all experiments are available under the MIT license at https://anonymous4open.science/r/MeanFlow-AISTAST. The code is written in Python 3.14, and all networks are Keras 3.15.1 models (Chollet et al., 2015) on the JAX 0.11.1 backend (Bradbury et al., 2018), both under the Apache 2.0 license. Besides BayesFlow (MIT), we build on PyMC 5.28.5 (Apache 2.0) (Salvatier et al., 2016) and nutpie 0.16.11 (MIT) (Seyboldt et al., 2026) for MCMC, ArviZ 0.23.4 (Apache 2.0) (Martin et al., 2026) for the convergence diagnostics, and Optuna 4.9.0 (MIT) (Akiba et al., 2019) for the hyperparameter searches.
Compute environment. We ran all analyses on a computing cluster using eight CPU cores and one NVIDIA A100 GPU with 40 GB of VRAM. The computing cluster uses an AMD EPYC 7F72 CPU with a core clock speed of up to 3.2 GHz and 50 GB of RAM.
D MCMC SAMPLERS
NUTS. We sample with the NUTS implementation of nutpie (Seyboldt et al., 2026) through PyMC (Salvatier et al., 2016) on the JAX backend (Bradbury et al., 2018), with 4 chains, a diagonal mass matrix, a maximum tree depth of 10 and the default target acceptance rate of nutpie. We use the default of 400 warmup iterations, except for g-and-k, where the warmup is 25% of the requested draws of each method.
Budget on g-and-k. A method whose density costs K network evaluations requests 8,000/K draws per chain, so that the product of requested draws and network evaluations per density is constant across methods. The normalizing flow counts as K=1. For delayed acceptance MCMC, the requested iterations are 96,000/(JS_c + 100) per chain, which accounts for the J=5 coarse evaluations and one fine evaluation per iteration. The budget is set on the requested draws and ignores the number of leapfrog steps per draw, which differs between methods, so the realized number of network evaluations varies. We count one network evaluation per forward pass of the network for one pair (z, x): a normalizing flow costs one evaluation per density, a mean flow with S steps costs S, a velocity field integrated with S Euler steps costs S, and a fixed-step Tsit5 integration costs 7 per step. Jacobians, divergences and gradients are obtained by automatic differentiation on top of these passes and are not counted; their cost is reflected in the wall times.
Delayed acceptance MCMC. We implement two-level delayed acceptance MCMC (Christen and Fox, 2005) with the subchains of Lykkegaard et al. (2023). For any coarse posterior , its invariant distribution is the fine posterior (Section 3.2). Both levels use the same trained network: the coarse level evaluates the mean flow with steps, and the fine level integrates its velocity head with 100 Tsit5 steps of fixed size and the exact divergence in (1). Each iteration runs a subchain of random-walk Metropolis steps on , following Lykkegaard et al. (2023), and proposes its end point to the fine level with the acceptance probability (11). The random walk draws Gaussian increments with a step size per parameter, initialized at 10% of the prior width, and a global scale. A proposal outside the prior's support is rejected without evaluating the network. If the subchain does not move, the proposal equals the current state and is accepted without evaluating the fine likelihood. Adaptation takes 25% of the requested iterations and is discarded. During adaptation, a Robbins-Monro update steers the global scale towards a coarse acceptance rate of 0.3, and in its second half, the step sizes are updated to the marginal standard deviations of the states visited in that half, after which the proposal is fixed. We run 4 chains started from prior draws.
E PER-EXPERIMENT DETAILS
E.1 Two Moons
The prior is , and the forward model is
whose fold makes the posterior invariant under , which gives two crescent-shaped modes (Greenberg et al., 2019). Since the density is available in closed form and the forward model can be inverted, we draw 32,000 exact i.i.d. reference samples per observation. The first dataset uses the canonical observation , and the other nine use prior predictive draws.
E.2 g-and-k
The g-and-k distribution is defined by its quantile function in normal-score space (Rayner and MacGillivray, 2002),
and has no closed-form density. Since is strictly increasing for , we invert it by bisection, which gives the exact log-density by the change of variables. We couple two coordinates with a Gaussian copula of correlation in normal-score space, such that both marginals are g-and-k distributed. The priors are , and , and each dataset consists of observations simulated from a parameter drawn from the prior. We obtain 32,000 reference draws per dataset from an adaptive random-walk Metropolis ensemble on the exact log-posterior, started around the generating parameter with a jitter of 2% of the prior width (8 chains, 5,000 adaptation iterations, 40,000 draws thinned by 10, and ).
E.3 Epidemic Renewal
On a grid of steps, of which the first are seeded at incidence and not observed, the renewal model is, for ,
with , , and the Gamma density with mean 5.0 and standard deviation 2.5 (Fraser, 2007; Cori et al., 2013). This is the renewal equation of Cori et al. (2013) with a discretized generation interval truncated at 15 steps. The observation is , so . The parameter is the whitened coefficient vector with , where is a squared-exponential kernel with lengthscale 2.5, marginal standard deviation 0.4 and a ridge (Rasmussen and Williams, 2005). Hence, the prior is exactly . Since is lower triangular, enters only for , and since the recursion runs forward in time, does not depend on for . The causal attention mask of the masked transformer (Appendix C) encodes exactly this structure. Observations are standardized separately at each time step.
We withhold each of the observed steps independently with probability 0.3 and draw a new pattern for every dataset. Since this mechanism is independent of the process and the parameters, the data are missing completely at random, and the posterior only requires the marginal likelihood of the observed entries (Little and Rubin, 2019). The masked transformer trains on complete simulations with masks drawn independently per simulation and observation at the same rate and thereby learns this marginal for every pattern. The normalizing flow instead models vectors with the sentinel in the missing entries according to Wang et al. (2024).
E.4 Cognitive Model
A trial is a Wiener process with drift that starts at (with fixed relative starting point ) and terminates at the first hit of 0 or . The response time adds a non-decision time , and trials time out after 10 s. The priors are , and , and we simulate with Euler-Maruyama at . The network observes the signed response time , with for the upper boundary, which is bijective with the pair of response time and choice. Since the non-decision time cannot exceed the fastest observed response time, we sample it below this bound, which tightens as trials are added. Within each dataset, trial counts are nested, and every setting keeps NUTS draws after the default warmup. For the first trial count , the chains start at the center of the prior support with the default jitter of PyMC. The chains for the next trial count start at the posterior median of the preceding trial count, clipped to the current support of , with independent jitter per chain.
F ADDITIONAL FIGURES AND TABLES
Table S4: Density metrics on two moons. Total mass, KL divergence and Hellinger distance of each learned posterior density against the exact one, on a grid over the prior; mean (standard deviation) over 10 independent datasets. The best value per column is in bold, for the mass the one closest to 1.
| Method | Steps | Mass | KL | Hellinger |
|---|---|---|---|---|
| Normalizing flow | 0.977 (0.055) | 0.446 (0.073) | 0.383 (0.023) | |
| Mean flow | 1.066 (0.017) | 0.347 (0.137) | 0.322 (0.052) | |
| Mean flow | 1.045 (0.030) | 0.179 (0.077) | 0.230 (0.042) | |
| Mean flow | 1.085 (0.093) | 0.165 (0.053) | 0.219 (0.050) | |
| Mean flow | 1.003 (0.025) | 0.160 (0.052) | 0.169 (0.027) | |
| Mean flow (v-head) | Euler, | () | 73.2 (19.0) | 1.000 (0.000) |
| Mean flow (v-head) | Euler, | 57.3 (45.5) | 4.10 (1.20) | 0.902 (0.076) |
| Mean flow (v-head) | Euler, | 1.783 (0.077) | 0.385 (0.033) | 0.363 (0.020) |
| Mean flow (v-head) | adaptive, | 0.993 (0.016) | 0.031 (0.013) | 0.087 (0.017) |
| Flow matching | Euler, | () | 37.8 (9.5) | 1.000 (0.001) |
| Flow matching | Euler, | 1.825 (0.073) | 0.271 (0.021) | 0.304 (0.017) |
| Flow matching | adaptive, | 0.991 (0.023) | 0.048 (0.019) | 0.117 (0.016) |

Figure S1: Sample and density quality against step count on two moons. (A) C2ST against the reference posterior over mean flow steps (0.5 indicates indistinguishable samples). (B) Hellinger distance of the learned density from the exact posterior on a grid. Lines show the mean over 10 independent datasets, bands the standard deviation.
Table S5: Composing the DDM trial likelihood, per method and trial count. NRMSE to the generating parameter, coverage of the central interval, minimum bulk ESS, divergent transitions, and worst predictive discrepancy; mean (standard deviation) over 10 independent datasets.
| Method | NRMSE | Cov. 95% | Min ESS | Div. | ||
|---|---|---|---|---|---|---|
| Mean flow | 4 | 0.268 (0.079) | 0.90 (0.16) | 1,396 (312) | 1.0 (1.9) | 0.73 (0.14) |
| Mean flow | 16 | 0.161 (0.033) | 0.90 (0.16) | 1,174 (378) | 6.6 (11.5) | 0.90 (0.30) |
| Mean flow | 64 | 0.102 (0.028) | 0.90 (0.16) | 1,205 (186) | 2.4 (4.0) | 1.13 (0.47) |
| Mean flow | 256 | 0.070 (0.019) | 0.60 (0.31) | 1,146 (335) | 7.8 (21.7) | 2.15 (1.03) |
| Mean flow | 256 | 0.061 (0.016) | 0.73 (0.21) | 1,094 (335) | 0.6 (1.6) | 1.93 (0.77) |
| Mean flow | 256 | 0.066 (0.018) | 0.77 (0.27) | 503 (620) | 50.7 (50.1) | 2.02 (0.77) |
| Mean flow | 256 | 0.064 (0.023) | 0.70 (0.29) | 513 (504) | 31.8 (29.0) | 1.99 (0.83) |
| Flow matching, Euler | 4 | 0.267 (0.081) | 0.90 (0.16) | 1,279 (228) | 0.3 (0.7) | 0.72 (0.13) |
| Flow matching, Euler | 16 | 0.151 (0.032) | 0.90 (0.16) | 1,285 (270) | 0.1 (0.3) | 0.88 (0.22) |
| Flow matching, Euler | 64 | 0.099 (0.031) | 0.87 (0.23) | 1,127 (228) | 0.0 (0.0) | 1.03 (0.57) |
| Flow matching, Euler | 256 | 0.067 (0.033) | 0.70 (0.33) | 1,275 (329) | 0.1 (0.3) | 1.79 (0.57) |
Table S6: Budget-matched MCMC on -and-. Every method except the flow matching baseline shares the same budget of requested draws times network evaluations per density. The realized totals in forward passes are 0.9 to for the NUTS arms and 1.0 to for delayed acceptance MCMC. Mean (standard deviation) over 10 independent datasets; the best minimum ESS and C2ST are in bold.
| Method | Steps | Samples | Min ESS | C2ST |
|---|---|---|---|---|
| Mean flow | 1 | 32,000 | 10,498 (1,552) | 0.604 (0.049) |
| Mean flow | 2 | 16,000 | 4,856 (939) | 0.587 (0.046) |
| Mean flow | 4 | 8,000 | 2,436 (708) | 0.577 (0.039) |
| Mean flow | 8 | 4,000 | 1,143 (476) | 0.599 (0.030) |
| Normalizing flow | 1 | 32,000 | 8,023 (3,169) | 0.679 (0.078) |
| Flow matching, Euler | 200 | 4,000 | 1,270 (331) | 0.614 (0.048) |
| Delayed acceptance MCMC, | 100 | 3,656 | 642 (246) | 0.592 (0.031) |
| Delayed acceptance MCMC, | 100 | 3,492 | 649 (200) | 0.594 (0.030) |
| Delayed acceptance MCMC, | 100 | 3,200 | 581 (133) | 0.595 (0.033) |
| Delayed acceptance MCMC, | 100 | 2,744 | 544 (157) | 0.599 (0.033) |

C Renewal
D DDM
Figure S2: Wall time of every method across experiments. Warm wall times by method (log scale), mean over 10 datasets, for (A) two-moons sampling (5,000 draws), (B) g-and-k MCMC under the shared budget, with the flow matching baseline outside it, (C) renewal MCMC at equal draws and (D) DDM MCMC per trial count.
A

B
C
D
Signed response time y (s)
Flow matching, Euler Sampled bound
--- True parameter
--- Observed trials
Figure S3: Composed DDM posteriors on one dataset, over the trial count. Rows are ; columns are the marginals of (A) the drift , (B) the boundary separation and (C) the non-decision time for , and the 200-step baseline, with the generating parameter dashed and the sampled bound dotted. (D) Posterior predictive CDF of the signed response time (bands: mean one standard deviation over 200 replicates) against the observed trials. Shown for one of 10 datasets.

---- Flow matching, Euler
Figure S4: Effect of step count on DDM inference. A NRMSE over mean flow steps S, one line per trial count N, with the flow matching baseline with 200 Euler steps dashed. B Step count selected within each dataset by NRMSE among converged settings, over the trial count N. C Minimum bulk ESS over S, with the baseline dash-dotted. Lines show the mean over 10 independent datasets, bands the standard deviation.
A

B
C
Figure S5: Renewal-model observations and what each method is shown of them. (A) The observation: four log-incidence curves at one parameter, with the latent of the first behind them and the seeded steps shaded, giving 123 observed values on a 128-step grid. (B) The reproduction number that generated them, against the line and the prior's 90% interval, for comparison with the generating trajectory. (C) The same curve under one 30% missingness pattern, as each method receives it: the observed coordinates alone for the masked transformer, against the vector with sentinel values for the normalizing flow.