WorksMathematics
Flow Matching for Fast Posterior Sampling in Bayesian Inverse Problems
Abstract
Sampling from the posterior is the central task of computational Bayesian inverse problems. The standard workhorse in Bayesian inference—Markov chain Monte Carlo (MCMC)—is sequential, yields correlated samples, and must be rerun for each new observation. Conditional flow matching offers an amortized alternative: a transport map, trained once on joint samples of parameter and data, that yields independent approximate posterior samples for any observation at negligible online cost, without new likelihood evaluations. We give a careful, MCMC-literate assessment of flow matching for PDE-based inverse problems with function-valued parameters. Exploiting the flow's tractable density, we derive computable accuracy estimates for the learned posterior in total variation distance and Kullback–Leibler divergence and, moreover, propose a hybrid sampler that is made asymptotically exact by Metropolization. We validate the accuracy estimates and demonstrate amortization in several numerical examples, including electrical impedance tomography and a likelihood-free Lotka–Volterra model. Flow matching reproduces posterior means and credible bands closely at a fraction of the forward solves required by MCMC, but its accuracy degrades for concentrated posteriors and for observations that are atypical under the prior.
Introduction
For the past three decades, Markov chain Monte Carlo (MCMC) has been the workhorse for sampling from posterior distributions in Bayesian inference and Bayesian inverse problems. Modern variants — dimension-robust proposals such as preconditioned Crank–Nicolson [16, 32], likelihood-informed [15 RS18] and adaptive [27, 31] schemes — are well understood theoretically and remarkably reliable in practice. Their cost profile, however, is fixed by design: the Markov chain is sequential, its samples are correlated, every step requires at least one evaluation of the forward model, and the entire computation must be redone from scratch for each new observation. In applications where the same inverse problem is solved repeatedly for a stream of measurements — electrical impedance tomography (EIT) being a prototypical example — this per-observation cost is the dominant obstacle to online or real-time uncertainty quantification.
A different paradigm, going back to El Moselhy and Marzouk [20] and systematically developed in [Par15; Mar+17], is to construct a transport map pushing a simple reference distribution forward to the posterior: once the map is available, we can generate, in parallel, arbitrarily many independent samples from (an approximation to) the posterior. If the transport map is of block-triangular structure and trained to generate the joint distribution of unknown parameters and observable data, then a standard disintegration argument in [37 Sec. 7] shows that this transport map reproduces the posterior for (almost) all possible observations. In this sense, transport-based sampling for Bayesian inverse problems is amortized: after an offline training phase, approximate posterior samples for any new observation are available at negligible online cost, namely one evaluation of the transport map per sample, and no further likelihood evaluations are needed. These are substantial promises, in particular for PDE-based Bayesian inverse problems with computationally expensive likelihoods.
Several approaches have been proposed for constructing suitable transport maps. The foundational works [20 Par15, 37] focus on monotone triangular transport maps motivated by the Knothe–Rosenblatt rearrangement. More recently, generative machine learning has supplied more flexible and scalable approaches: Baptista et al. [6] use monotone generative adversarial networks (GANs) [22], and Wang et al. [Wan+25] employ continuous-time normalizing flows in the form of neural ordinary differential equations (ODEs) [12, 23] to construct conditional optimal transport maps. Score-based diffusion models [Son+21] have been applied to Bayesian inverse problems as well, e.g., in [14, 5]. Closely related to these is the flow matching approach for learning a neural ODE-based transport map [36, 35 AV23, 1]. Its main advantage over maximum-likelihood training of continuous normalizing flows [12, 23] is that this training is replaced by a simple least-squares regression: each training step requires a single evaluation of the network instead of an ODE solve, which reduces the training cost substantially (cf. § 4.4). Bayesian flow matching, i.e., flow matching for sampling conditional distributions, has been derived and discussed in detail in [13 Hag25, WS25] but has been demonstrated primarily on low-dimensional benchmarks and imaging-type applications. Very recently, Krüger et al. [Krü+26] compare three different machine learning approaches for transport sampling of posteriors in Bayesian inverse problems — GANs, invertible neural networks, and Bayesian flow matching — and find Bayesian flow matching to be the “clear winner”. Moreover, owing to its likelihood-free training, flow matching can also be used for simulation-based inference [Wil+23; CBL20], where the likelihood is unknown or intractable, so that likelihood-based MCMC is not applicable.
Flow matching therefore appears to be among the most promising approaches for transport-based sampling of conditional distributions. What is missing so far in the literature, in our view, is a careful, MCMC-literate assessment of flow matching for PDE-based Bayesian inverse problems: one that compares it not with other transport-based approaches but with well-tuned standard MCMC algorithms, on problems of increasing difficulty. Furthermore, this paper aims to provide computable estimates of lower and upper bounds of the accuracy of the learned flow matching posteriors. These estimates rest on (Markov chain) Monte Carlo theory and on combining flow matching with the independent Metropolis–Hastings algorithm. The combination also yields a computationally efficient, asymptotically exact sampler that outperforms standard MCMC samplers on some challenging Bayesian inverse problems. In this regard, we also mention previous works on the combination of transport maps and MCMC: Parno and Marzouk [PM18] use monotone triangular transport maps to construct posterior-adapted proposals that accelerate MCMC; Gabrié, Rotskoff, and Vanden-Eijnden [25] interleave local MCMC moves with nonlocal proposals from a normalizing flow that is trained during sampling; and Grenioux et al. [24] and Brofos et al. [8] study discrete-time normalizing flows as proposals within independent Metropolis–Hastings, the latter with adaptation of the flow during sampling and an accompanying convergence analysis. In contrast, the flow matching proposal used here is trained once, without likelihood evaluations, and serves all observations. Finally, a priori error bounds for unconditional flow matching in Wasserstein distance are derived in [7]; these, however, are not computable in practice.
Our contributions are summarized as follows:
We give a self-contained account of this methodology addressed to the inverse problems and UQ communities, assembling its mathematical and computational ingredients in a unified presentation anchored in measure transport (§ 3).
Exploiting the tractable density of the flow and using classical Monte Carlo theory, we derive computable estimates of lower and upper bounds on the accuracy of the learned posterior
in total variation (TV) distance and Kullback–Leibler (KL) divergence (§ 3.4); related weight-based diagnostics for amortized posteriors are used in [17].
As a by-product, we obtain, as in [24, 8], an asymptotically exact hybrid sampler, in which the bias of flow matching samples is removed via Metropolization (§ 3.3).
We demonstrate the efficiency and accuracy of flow matching for PDE-based Bayesian inverse problems in a number of numerical experiments,2 in which we
compare the estimated accuracy bounds with reference values computed by quadrature in a simple illustrative example (§ 4.1),
conduct systematic parameter studies on the accuracy of flow matching for Bayesian inversion in the stationary diffusion equation for an increasing number of observations, a decaying noise level and an increasing number of Karhunen–Loève terms (§ 4.2), and
illustrate the benefits of flow matching-based sampling compared to MCMC as an amortized sampler in EIT (§ 4.3), where a single offline training enables real-time posterior sampling for a stream of new measurements, and for a stochastic Lotka–Volterra model, where the likelihood is intractable and classical MCMC methods, which rely on likelihood evaluations, are not applicable (§ 4.4).
Once trained, the flow matching model provides a sampler for new observations at negligible cost, in contrast to MCMC. This advantage comes with clearly identifiable limitations, which our experimental studies map out: the accuracy of flow matching approximations can degrade for strongly concentrated posteriors (e.g., due to small observational noise) and for observations unlikely under the prior, because flow matching spreads the training data according to the prior predictive distribution whereas MCMC focuses its likelihood evaluations (after burn-in) near the center of the posterior probability mass.
This paper is deliberately computational and proof-of-concept in character. A deeper mathematical analysis of Bayesian flow matching, in particular the development of remedies for the outlined shortcomings, is the subject of future work.
Problem setting and outline We consider the inverse problem of inferring an unknown parameter from a noisy observation related through the observation model
where denotes the forward operator — typically the composition of a PDE solution operator with an observation operator — and is observational noise, independent of . The parameter space is in general a function space, while throughout. The inverse problem of recovering from is typically ill-posed in the sense of Hadamard [28]. Instead of regularizing it to obtain a single estimate, e.g., variationally, we adopt the Bayesian approach [Stu10], which characterizes the uncertainty in given by a probability distribution: endowing with a prior distribution and assuming a Gaussian observational noise , the posterior distribution, i.e., the conditional distribution of given the observation , is given by Bayes’ rule as a change of measure with respect to the prior,
with the normalizing constant and .
In the following, we focus mainly on the finite-dimensional case, i.e., on a discretization of and an absolutely continuous prior with Lebesgue density also denoted by . Then, the posterior also admits a Lebesgue density given by
The computational task is then to sample from , either for a single observation or — the setting emphasized in this paper — for multiple observations under the same prior and forward model. Two features of (3) are important for the design of sampling algorithms: the normalizing constant is unavailable, so algorithms may access the posterior only through ratios of the unnormalized density; and each evaluation of requires one solve of the forward model, which dominates the computational cost in the PDE-based problems of § 4.
§ 2 recalls the Metropolis–Hastings MCMC variants used as baselines. § 3 presents conditional sampling via flow matching including the proposed sample-based diagnostics. § 4 contains the numerical study, and § 5 collects our findings, limitations, and open questions.
Posterior sampling via Markov chain Monte Carlo
The Markov chain Monte Carlo method constructs an ergodic Markov chain on , or on its discretization , with as its invariant distribution, so that the states approximately follow the posterior distribution for sufficiently large . We restrict attention to the Metropolis–Hastings (MH) class, which contains many of the most widely used sampling algorithms for Bayesian inverse problems and suffices for the comparisons in this paper; we recall the general mechanism, discuss its efficiency, and describe the variants used in this paper.
The Metropolis–Hastings algorithm
Given the current state , an MH transition consists of two steps: a candidate is drawn from a proposal density , and is accepted, i.e., , with probability
otherwise the chain remains at ; generic pseudocode is recorded as Algorithm 1 in Appendix § 7. Only ratios of the posterior density enter (4), so is never needed, but every iteration costs at least one evaluation of and hence one forward solve. Under mild positivity assumptions on [RC99], the resulting chain is ergodic and converges to the posterior in total variation from any initialization,
where denotes the law of . Note that for absolutely continuous on one has
Moreover, the average taken along the path of the Markov chain converges to the true posterior expectation, i.e., for every that is integrable with respect to , we have, under mild assumptions [RC99], almost surely
What distinguishes good from poor MH samplers, i.e., a good from a poor choice of proposal , is not these asymptotic guarantees but rather the rate of convergence in (5) and the asymptotic variance of the path average estimator .
A common measure for the efficiency of a Markov chain Monte Carlo algorithm is therefore its effective sample size (ESS). For a stationary chain, i.e., , it is given by
and corresponds, for large , to the number of independent samples from whose empirical average of has the same variance as the path average . It satisfies whenever the autocorrelations sum to a nonnegative value, as is typically the case for the samplers considered here.
Computational aspects MH algorithms share a common cost structure that frames the comparison in this paper. The Markov chain is inherently sequential in that each state depends on its predecessor, so sampling typically parallelizes only across independent chains or across proposal generation. Its output is correlated, so the effective sample size falls short of the chain length, often by orders of magnitude in the case of poor mixing. Every iteration requires at least one forward solve, the dominant cost in PDE-based Bayesian inverse problems. Moreover, the entire computation is tied to a single observation : a new measurement requires running a new Markov chain. The flow matching methodology assessed in the next section targets precisely these computational bottlenecks — independent samples, generated in parallel, at negligible per-sample cost, amortized over all observations — while giving up the asymptotic exactness that the Metropolis–Hastings correction provides. In § 3.3 and § 3.4 we show how the two approaches can be combined to recover it.
Common MH algorithms
In this paper three MH variants — RWMH, pCN and DRAM — serve as baselines against which flow matching is compared, while a fourth, IMH, forms the basis of the hybrid sampler of § 3.3; we recall them in the briefest terms and refer to the cited literature for details.
Independent Metropolis–Hastings (IMH) uses a proposal which does not depend on the current state, i.e., , i.e., with drawn independently of . The performance of IMH depends crucially on the overlap between proposal and posterior: if is a good proxy for , the chain behaves nearly like direct sampling, whereas a poor proxy produces long runs of rejections and highly correlated output. In § 3.3 we use the flow matching approximation as the proposal within IMH, which yields asymptotically exact samples as well as an empirical estimate of the accuracy of the flow matching proxy in TV distance.
Random walk Metropolis (RWMH) [38, 30] proposes a Gaussian perturbation of the current state, with ; the symmetric proposal density cancels in (4). This MH variant is simple and robust but requires careful tuning of and mixes increasingly slowly as the dimension grows.
Preconditioned Crank–Nicolson (pCN) [16, 32] proposes, for a centered Gaussian prior ,
The proposal is reversible with respect to the prior, so the acceptance probability reduces to the likelihood ratio . Crucially, pCN is well defined on the function space itself, i.e., before any discretization, and its convergence behavior is robust under mesh refinement [16, 32], which makes it a natural reference for the function-space examples of § 4.
Delayed rejection adaptive Metropolis (DRAM) [27] combines adaptive Metropolis [31], which periodically updates the proposal covariance from the chain history, with delayed rejection [39], which upon rejection retries with a rescaled, typically narrower, proposal before the current state is retained. DRAM often attains lower autocorrelation than RWMH on correlated posteriors, at the price of per-iteration overhead and of diminishing-adaptation conditions required for ergodicity.
Posterior sampling via flow matching
This section describes the transport-based sampler assessed in this paper. We first recall the structural result reducing posterior sampling to a measure transport problem on the product of parameter and observation space (§ 3.1). We then introduce the representation of the transport map as the flow of a neural ODE and explain why its classical, likelihood-based training is computationally prohibitive in the inverse problems context before presenting flow matching, the regression-based training that makes the approach practical (§ 3.2). Finally, we discuss how flow matching combined with MCMC can yield asymptotically exact simulations of the posterior (§ 3.3) and how classical Monte Carlo theory yields computable estimates of lower and upper bounds on the accuracy of the flow matching approximation (§ 3.4).
Posterior sampling as a transport problem
The measure transport approach to computational Bayesian inference [20, 37] seeks a map pushing forward a tractable reference distribution on the parameter space —in the finite-dimensional setting below, a standard Gaussian—to the posterior, , so that posterior sampling reduces to evaluating at reference samples. For a fixed observation such a map can be constructed variationally from the unnormalized posterior density, e.g. within a class of monotone triangular functions [37]. The approach pursued here differs in two respects. First, the map is constructed from samples of the joint distribution of parameter and observation induced by the prior and the observation model (1), rather than from evaluations of the unnormalized posterior density. Second, it is conditional: the observation enters as a parameter, . The theoretical basis is the following disintegration result; it underlies the conditional sampling technique via triangular transports in [37 Sec. 7, Lem. 1], where it is stated in finite dimensions; we state it in the Banach space formulation of Baptista et al. [6].
Let be separable Banach spaces, let carry their product Borel -algebra, and denote by the corresponding sets of Borel probability measures, with denoting the marginals of . By disintegration we can rewrite every as
where the (regular version of the) conditional distribution is uniquely determined -almost everywhere.
Theorem 3.1. Let be a product reference measure and a target measure. Let be a measurable block-triangular map of the form
If , then and
Proof. Since leaves the second component unchanged, implies that the -marginals coincide, hence . For and , define the slice . The triangular structure of gives , and hence, by , the product structure of , and Fubini’s theorem,
On the other hand, the disintegration of with respect to its -marginal yields
and the uniqueness of the disintegration implies for -a.e. .
Theorem 3.1 converts the approximation of the posterior for all possible observations into a single transport problem on , subject to the constraint that the observation component be carried along unchanged.
For the construction of the transport map , we focus again on the finite-dimensional case and seek in a parametrized family , of mappings (e.g., neural networks where consists of the weights and biases), and fix the reference measure as
with denoting the identity matrix. Note that this already builds in the marginal matching from the start. In the following let us denote the Lebesgue densities of and again by and , respectively, so that is the standard Gaussian density and the posterior density. Moreover, we introduce as the approximation of resulting from the transport map . It remains to determine . A common approach in the machine learning literature is the minimization of the joint KL divergence between and , which is equivalent to maximum likelihood estimation, as we explain below. Due to the product structure of (7) and the triangular structure of the pushforward density under the triangular map factorizes as , which in turn yields
i.e., minimizing the joint divergence is equivalent to minimizing the expected negative log-likelihood
over the joint samples. In practice, this loss is estimated empirically by Monte Carlo sampling, requiring only the ability to draw samples from . Moreover, the well-known ‘chain rule’ for the KL divergence yields
Thus, minimizing the joint divergence also controls the expected posterior error over observations from the prior predictive distribution.
Three features of this approach are central to the remainder of the paper. First, the joint distribution — unlike any individual posterior — is easy to sample: drawing from the prior and simulating through the observation model (1) produces joint samples at the cost of one forward solve each, without a single likelihood or posterior density evaluation. The training data for the learned transport are therefore cheap and, notably, available even when the likelihood is intractable. Second, maximum-likelihood estimation, i.e., minimization of the KL divergence, requires the computation of the pushforward density and of its gradients with respect to . The feasibility and computational efficiency of this may depend on the architecture of . Third, the training objective (8) yields only -almost everywhere guarantees for the approximation of by . Pointwise guarantees are available under additional assumptions [3]. In practice, however, training in expectation with respect to means that for observations in the tail of the prior predictive distribution , the approximation can be very poor, since with high probability no training data reach such regions.
In the following, we present a convenient approach for transport maps with computable push-forward density and explain how they can be trained efficiently via the flow matching objective instead of the maximum-likelihood objective (8).
Neural transport maps and their training via Bayesian flow matching
Generative machine learning provides several flexible function classes for constructing a block-triangular map with . Here, we represent the transport map as the solution operator, or flow map, of an ODE
whose right-hand side is a neural network with weights and biases denoted by taking as inputs time, state, and the observation. Equation (9) is also known as a *neural ODE [12]. If is continuous and, in the state , continuously differentiable and globally Lipschitz continuous, the Picard–Lindelöf theorem guarantees the existence of a unique solution
of (9) and that the solution map
is a -diffeomorphism of for every fixed . Setting yields exactly the block-triangular structure (6). Moreover, due to the ODE representation of the transport map, the density of the pushforward is straightforward to compute. To this end, let denote the Lebesgue density of the pushforward measure where . Then, by the instantaneous change-of-variables formula [12], we have
so that integrating (9) backward from a point and accumulating the divergence along the trajectory yields
The divergence is computed by automatic differentiation at the cost of matrix-vector products with the (exact) Jacobian per evaluation. This tractable density distinguishes deterministic flows from stochastic samplers such as diffusion models simulated by their reverse-time stochastic differential equation. It enables Metropolization as well as quantitative diagnostics (§ 3.3 and § 3.4). Moreover, it allows one to determine the parameters of the velocity field by maximum likelihood, i.e., by minimizing the loss (8) with respect to , which is equivalent to minimizing the KL divergence as shown in § 3.1. In fact, this is the approach for training in the conditional continuous normalizing flows (CCNF) literature [Wan+25]. The computational difficulty here, however, is that every evaluation of (8) and of its gradient, as needed at every step of stochastic gradient descent, requires solving the ODE (9) backward via (11) for every sample in the current batch. The gradient must then be obtained by differentiating through the unrolled numerical solver or by the adjoint method [12], which has stability issues of its own. In addition, the divergence must be evaluated along each trajectory; in high dimensions it is approximated by stochastic trace estimators [23], and its gradient with respect to involves mixed second derivatives of the network. For inverse problems, where is discretized into a finely resolved space with large , these nested ODE solves and second-order terms dominate the cost and render maximum-likelihood training prohibitively expensive.
Bayesian flow matching Flow matching [36, 35 AV23, 1] retains the neural ODE representation (9) but replaces the maximum-likelihood objective (8) by a least-squares regression that requires no ODEs to be solved and no traces to be evaluated during training. Its conditional extension [13 Hag+25, WS25] is referred to as guided or Bayesian flow matching. To derive the flow matching objective, let and be independent3 and connect the endpoints by linear interpolation in the parameter component,
while the observation component is held fixed at . For each fixed observation , (12) defines a stochastic process on the parameter space [1 WS25] whose time marginals connect the reference to the posterior: since is independent of , and since, given , the terminal point is distributed according to the posterior . The stochastic process itself, however, is not causal — following a trajectory requires knowing its endpoint in advance. The idea of flow matching is to replace it by a neural flow, resulting from a neural ODE (9) with initial state and the same time marginals as the original process. Since the sample paths of (12) are affine in , the pathwise derivative exists trivially but again depends on the terminal state . To obtain a causal process with the same time marginals, one conditions on the current state , which yields the velocity field
It can be shown under mild regularity assumptions, see [35 Theorem 3.3] or [WS25, Theorem 6.3], that this velocity field plugged into (9) yields the same time marginals , since it satisfies the corresponding continuity equation
which is the Eulerian form of (10). By the defining property of conditional expectation as the best approximation in the sense, the velocity field (13) is the unique minimizer, over all measurable vector fields , of . The flow matching objective is therefore not an ad hoc regression but exactly this best approximation problem, restricted to the parametric class : Bayesian flow matching trains the network by
where the expectation is taken over , , and . In practice, the expectation in (15) is estimated by plain Monte Carlo: sampling and is trivial, and each sample requires one forward solve of . The resulting objective is minimized by stochastic gradient descent; in contrast to (8), its gradients require only standard backpropagation through the network, with no ODE solves and no divergence evaluations. If the trained velocity field coincides with the ideal field , then, since reproduces the time marginals and , the flow map pushes forward to for -a.e. . Consequently, the block-triangular map pushes forward to (cf. the proof of Theorem 3.1). Flow matching thus trades the expensive objective (8) for a cheap regression whose minimizer provably provides the desired transport. However, this argument does not control the error incurred by finite network capacity, finite training data, inexact optimization, and ODE discretization at sampling time. A priori error bounds are available for the unconditional case, see, e.g., [7], while the conditional setting is the subject of ongoing analysis. Moreover, such bounds are stated in terms of the distance between the learned and the ideal velocity field, which cannot be evaluated for a trained network since is unknown. A posteriori diagnostics such as those of § 3.4 are therefore highly relevant in applications.
Computational aspects Applying flow matching for posterior sampling consists of two phases. In the offline phase (training), one generates joint samples by prior sampling and forward simulation, and minimizes (15) by stochastic gradient descent over minibatches of . In the online phase (sampling), given an observation , one draws samples and integrates (9) with the trained field using a standard ODE solver. The resulting points are independent draws from the approximation of ; they can be generated in parallel, each at the cost of one ODE solve, i.e., tens to hundreds of network evaluations. Neither forward solves nor likelihood evaluations are required. When necessary, the density of the approximation is available through (11) at the cost of a further ODE solve with Jacobian-vector products per step, which dominates the cost of Metropolization (cf. § 4.2.1). Pseudocode for data generation, training and sampling is given in Algorithms 2 to 4 in Appendix § 9.
Remark 3.1 (Likelihood-free inference). Both training and sampling require only draws from the joint distribution , i.e., prior samples pushed through the observation model (1); the likelihood is never evaluated. Bayesian flow matching therefore applies verbatim to simulation-based (likelihood-free) inverse problems in which is intractable but forward simulation is feasible [10 Wil+23, 6], such as the stochastic Lotka–Volterra model of § 4.4. In contrast, the Metropolization of § 3.3 and the diagnostics of § 3.4 require the unnormalized posterior density and are hence available only for tractable likelihoods.
Flow-based independent Metropolis–Hastings
Bayesian flow matching provides an approximation to the posterior , which is easy to sample. However, the samples generated by flow matching are biased whenever differs from the ideal field or the ODE (9) is solved inexactly, which is typically the case in practice. Often it is hard to judge a priori how close the flow matching approximation is to the true posterior for given data . A combination of flow matching and Metropolization can remove this bias and provide asymptotically exact samples from the posterior . To this end, we use the flow matching approximation as the proposal distribution within IMH, i.e., is the pushforward of the standard Gaussian . The resulting Markov chain proceeds as follows: given the current state , it proposes with a fresh draw , and accepts with log acceptance probability
where we set . Thus, we need to compute the log flow matching density via numerical integration of the corresponding ODE (11), see above. This approach combines the generative capability of normalizing flows, which yields a flexible, high-dimensional proposal that closely approximates the posterior geometry, with the asymptotic exactness of MCMC methods. The proposal is generated independently of the current state , allowing for parallel sampling of candidates prior to the acceptance step. Normalizing flows have been used to enhance MCMC before, e.g., in [24, 25, 8].
Diagnostic metrics
We now provide two sampling-based diagnostics for the accuracy of the flow matching approximation to . Both diagnostics exploit that the density is computationally tractable.
The first diagnostic is based on the flow-based IMH mentioned above. In fact, the mean acceptance rate of the (stationary) Markov chain generated by IMH is closely related to the TV distance between proposal and target distribution .
Proposition 3.2 ([Egé+26]). Let the target and the proposal have Lebesgue densities, again denoted by and , respectively, and let
denote the mean acceptance rate of the stationary IMH chain. Then
These bounds are based on [40 Theorem 1] and formally shown in [Egé+26] with applications in multimodal sampling; for completeness, a short proof is given in Appendix § 8. For our purposes the decisive observation is the reverse reading of (16): running an IMH chain with proposal for iterations, resulting in a path based on the proposals , we can estimate empirically by
and obtain a computable two-sided bound
Note that this also yields a lower bound on the KL divergence between and by means of the well-known Pinsker inequality:
A computable upper bound on the above KL divergence can be derived via the divergence and its relation to importance sampling. It is well known [26] that
where the divergence is defined by
if the Radon–Nikodym derivative exists, and otherwise. Note that the divergence may be infinite even if the Radon–Nikodym derivative exists. Now, considering the normalized importance weights
for i.i.d. flow matching samples , it is also well known from importance sampling theory [2 Section 2.3] that by means of the law of large numbers we have almost surely
given that . Thus, indicates that , implying the flow matching approximation is highly accurate. Conversely, indicates a significant mismatch.
In practice, given a batch of flow matching samples with associated importance weights we can estimate
for sufficiently large.
We stress that (17) and (19) are Monte Carlo estimates of bounds, not guaranteed bounds. The estimator of refers to the stationary chain, but it is consistent by the ergodic theorem for any initial state; in our experiments we start the IMH chain from a flow matching sample and use the entire chain, since the influence of the initial state on the average vanishes like whenever the chain mixes well. More importantly, the self-normalized estimator of is consistent but tends to underestimate for finite , since is dominated by rare samples with large weights, which a finite sample is likely to miss, particularly in higher dimensions, where the weights are heavy-tailed. Indeed, , so the estimated upper bound in (19) never exceeds . When the flow matching approximation is poor, the empirical upper bound may therefore fall below the true Kullback–Leibler divergence. It is reliable when the weights are well behaved, as in the example of § 4.1, where it encloses the values obtained by quadrature (Figure 4).

Figure 4. Left: prior predictive density at the 20 observations and acceptance rate of FM-IMH with 500 000 proposals. Middle and right: KL divergence and TV distance between posterior and flow matching approximation, computed by quadrature, with the estimated bounds (19) and (17).
In summary, we derived computable estimates of lower and upper bounds on both the TV distance and the KL divergence between the true posterior and its flow matching approximation.
Remark 3.2. The term is related to the so-called effective sample size of importance sampling. The latter is defined by and quantifies the number of independent samples from which yield the same statistical efficiency for Monte Carlo as the importance-weighted samples drawn from the proposal distribution. Its ratio to , the reciprocal of , is the sample efficiency used by Dax et al. [17] as a diagnostic for amortized neural posterior estimates in gravitational-wave inference, where low efficiency was found to flag, among other things, out-of-distribution data.
Numerical experiments
This section applies the conditional flow model presented in § 3, trained using Bayesian flow matching (FM), to four example problems. The first example is a two-point boundary value problem with two unknown scalar parameters for which the posterior, and hence the TV distance and KL divergence of its flow matching approximation, can be computed by quadrature. The second example is a stationary diffusion problem in one space dimension where the goal is to reconstruct a distributed diffusion coefficient. The third example is the Bayesian formulation of electrical impedance tomography (EIT) [18], a well-known challenging problem in the inverse problems community. Finally, we consider a stochastic Lotka–Volterra problem which poses the challenge that no tractable likelihood is available and which was previously considered in [Wan+25], following the setup in [Wil12].
For all four problems, we compare the learned posterior qualitatively and quantitatively against MCMC references where applicable. Furthermore, we study how the accuracy of the learned posterior depends on factors such as the concentration of the true posterior and how typical the observation is under the prior predictive distribution .
Example with a two-dimensional parameter
We consider a very simple Bayesian inverse problem which allows us to illustrate many of the key concepts introduced in the previous sections. It concerns the identification of two unknown parameters in a two-point boundary value problem for a stationary diffusion equation. The first parameter determines the spatially constant log-conductivity, while the second parameter determines the Dirichlet data at the right-hand boundary. With denoting the spatial coordinate, the differential equation is given by
where denotes the solution, which is easily verified to be . The observational data is given by noisy evaluations of the solution at two locations, i.e.,
We place independent priors and on the unknown parameters. Then, for 20 observations, equally spaced on the line segment between and in data space, we compute the posterior for each. Samples from the prior predictive distribution together with the values of the prior predictive density (evidence) at these 20 observations are shown in Figure 1. The corresponding evidence values are seen to vary over several orders of magnitude.

Figure 1. The blue markers show 5000 samples from the prior predictive distribution of the observations (21) of the solution of (20). The color intensity of the red markers at to indicates the value of the prior predictive density at these locations.
As a reference, we run RWMH with proposal covariance for each observation, for steps after a burn-in of steps; since the problem is only two-dimensional, we also compute the posterior by numerical quadrature (see below). The flow matching velocity field is a multilayer perceptron (MLP) with six hidden layers of width and swish activations [RZL17]. It is trained on samples from the joint distribution , which together require fewer forward solves than a single one of the 20 RWMH runs, for 4000 epochs with batch size 10 000 and a cosine learning-rate schedule decaying from to .
Figure 2 shows samples generated by RWMH as well as samples generated by the flow matching procedure for the observations , and . Visually, for observations that are likely under the prior, such as , both RWMH and FM generate samples that closely follow the true posterior. Observations that are less likely () and highly unlikely () under the prior show minor deviations between the FM samples and the true posterior. As is shown in Figure 3, using a flow matching posterior as the proposal within IMH can eliminate this small deviation completely. The same holds true for all other observations , with IMH acceptance rate of at least 84%, as is shown in Figure 4. Furthermore, this figure shows TV distances and Kullback–Leibler divergences for the observations together with their respective bounds derived in (17) and (19). The values for the true TV distances and KL divergences were approximated by numerical integration of

Figure 2. Samples from RWMH and flow matching with their marginal distributions. Shown are the observations , and .

Figure 3. Samples from RWMH and IMH with flow matching proposal with their marginal distributions. Shown are the observations , and . The corresponding acceptance rates are , and .
with the midpoint rule on a grid over . Both densities are normalized on the grid.
Diffusion equation with distributed parameter
As a second example, we consider a diffusion equation in one dimension with an unknown distributed diffusion coefficient . The difference from § 4.1 is that the diffusion parameter is no longer assumed to be constant but a function, and that both Dirichlet boundary values are assumed to be known. Thus, for the spatial variable we consider the boundary value problem
where denotes the solution. The prior distribution for the log-coefficient is modeled as a Gaussian random field of Whittle–Matérn type with smoothness , i.e. with
covariance operator
where is the Laplacian on with homogeneous Dirichlet boundary conditions. Away from the boundary its covariance is close to the exponential kernel , i.e. marginal variance 0.2 and correlation length 0.2. We represent by its Karhunen–Loève expansion truncated after terms
where and are the dominant eigenpairs of , so that the unknown is effectively parametrized by the coefficient vector endowed with a standard Gaussian prior. Both and are thus random fields depending on and ; we write and and leave the dependence on implicit. For fixed the flux is constant, so the solution is again available in closed form as
and is evaluated numerically by a cumulative Simpson rule on a uniform grid of 512 points. As observations we consider point evaluations of the solution
where with .
In the following, we compare FM against the MCMC algorithms pCN and DRAM. For pCN, we tune the parameter to obtain an acceptance rate close to the conventional target 23.4% [RR01]. For DRAM, the proposal covariance is updated every 1000 iterations, and the second-stage proposal is scaled by a factor of 0.2. After a burn-in of steps, each pCN and DRAM chain runs for steps and is thinned by a factor of 500, which leaves 40 000 samples. We use this setup in all studies to keep them comparable. Problem-specific tuning could improve the performance of both samplers, but would not remove the difficulties with concentrated posteriors.
Unless stated otherwise, the FM velocity field is an MLP with three hidden layers of neurons each and swish activations, which takes as input and returns the velocity directly; two modifications of this construction are introduced in § 4.2.1. It is trained on samples from the joint distribution , with a further samples for validation, for 500 epochs with batch size 5000 and a cosine learning-rate schedule decaying from to . Samples are generated by integrating the learned field with a fourth-order Runge–Kutta scheme and 25 steps on the mesh , , graded toward , for the reason given in § 4.2.1; this applies to all results in this section.
Comparison of FM and MCMC
Figure 5 and Figure 6 display the posterior distributions obtained with flow matching and DRAM. The four panels correspond to different ground truths , , i.e., log-coefficient functions which are used to generate the data: a sine function, which is highly unlikely under the given prior; a piecewise constant function; and two realizations of the prior truncated at 100 and 50 modes, respectively. Two observation settings are used for each of the four: , (Figure 5) and , (Figure 6), both with . In both figures the FM posterior mean and its 95% credible band are visually indistinguishable from those obtained with DRAM, indicating that FM produces an accurate approximation of the true posterior in terms of mean and uncertainty around the mean.

Figure 5. Posterior distributions for problem (21) obtained by DRAM (blue) and FM (red) for four different ground truth coefficients (black solid lines). The remaining solid lines indicate the posterior means and the shaded areas the pointwise 95% credible bands. The solution is observed at the 32 locations indicated by the vertical gray lines with an observation noise variance of .

Figure 6. Same as Figure 5 except that the number of observations is increased to 256 and the observation noise variance reduced to , resulting in a more concentrated posterior distribution.
A different picture emerges when the FM posterior is used as the proposal of an independent Metropolis–Hastings sampler (FM-IMH, § 3.3). For the MLP with neurons per layer, the acceptance rates in Table 1 drop sharply from the setting of Figure 5 to that of Figure 6. Hence, as the posterior concentrates, the FM posterior deviates from the true posterior much more than the two figures suggest.
| Fig. 5: , | ||||
| MLP, | 51.16 | 76.03 | 70.13 | 69.97 |
| MLP + weights, | 57.01 | 79.37 | 74.69 | 74.80 |
| gauss, | 31.97 | 64.02 | 51.18 | 51.50 |
| gauss + weights, | 43.20 | 81.81 | 71.40 | 71.48 |
| gauss + weights, | 23.18 | 65.55 | 55.44 | 55.59 |
| Fig. 6: , | ||||
| MLP, | 0.66 | 11.21 | 5.97 | 5.47 |
| MLP + weights, | 1.55 | 36.20 | 25.47 | 27.17 |
| gauss, | 1.07 | 22.97 | 14.67 | 14.93 |
| gauss + weights, | 3.70 | 47.49 | 33.02 | 36.49 |
| gauss + weights, | 4.65 | 51.63 | 39.85 | 39.89 |
Table 1. Acceptance rate (%) of the FM-IMH sampler for the four ground truths at the two configurations shown in Figure 5 and Figure 6; the best rate for each ground truth is set in bold.
The discrepancy becomes visible in the latent coefficients rather than in the field; Figure 12 in Appendix § 10 shows the marginals of in the setting of Figure 6. Three findings guide the modifications below. First, the data constrain the coefficients very unequally: for the posterior standard deviation of is about , i.e., roughly 180 times smaller than its prior standard deviation, whereas, e.g., and retain posterior standard deviations between 0.93 and 1. Second, the MLP misrepresents precisely the most strongly constrained coefficients: its marginal of is about twice as wide as that of DRAM, and for and its mean of is off by 0.7 to 0.8 posterior standard deviations. Measured on the scale of the prior, these errors are of order or smaller, which is why they cannot be seen in Figure 6. Third, the FM loss sums the squared velocity errors over all coordinates with equal weight, so that an error which is small on the scale of the prior but large relative to the posterior width is hardly penalized during training.

Figure 12. Marginal posterior densities of the Karhunen–Loève coefficients (columns) for the four ground truths (rows) in the setting of Figure 6 (, , ): DRAM (blue), FM with gauss and weights (red) and the MLP (orange, dashed), both with . Histograms of 40 000 samples each; the row labels give the FM-IMH acceptance rates of the two flows from Table 1.
We therefore consider two modifications of the MLP, which can be applied separately or together. With weights, the per-coordinate terms of the FM loss are weighted by , where is the approximated posterior variance of resulting from linearizing the parameter-to-observation map at the prior mean — i.e., the approximation to the posterior covariance matrix is then with denoting the Jacobian of the parameter-to-observation map at . The weights thus require a single Jacobian, but neither a reference chain nor a trained model. With gauss, the -th component of the velocity field takes the form
where the first term is the exact velocity field of a Gaussian posterior with mean , linear in , and per-coordinate variances . The parameters , and are trained together with the MLP, starting from , so that the MLP (of the default architecture) only has to learn the deviation from a diagonal Gaussian posterior, and narrow marginals no longer have to be generated by the MLP alone. For small , becomes large shortly before , and equally spaced steps would leave the stability region of the Runge–Kutta scheme there; this is the reason for the graded mesh introduced above. All other settings are those of the MLP.
Table 1 reports the acceptance rates of all four combinations with . In the concentrated setting of Figure 6, each modification raises the acceptance rate for every ground truth, the weighting more than the Gauss head, e.g., for from 5.97% to 25.47% and 14.67%, respectively, and the combination of both the most, to 33.02%. In the wider setting of Figure 5, the weighted MLP performs best for three of the four ground truths, whereas the Gauss head without weights lowers the acceptance rate. The combination of both modifications was additionally trained with , which further raises the acceptance rate on the concentrated posterior but lowers it on the wider one. In the marginals of Figure 12, the combination with matches the widths of DRAM for and to within 3% for . The plotted posterior, on the other hand, does not reveal the improvement: in the setting of Figure 6, the MLP and the combination of both modifications with and all reproduce the posterior mean and the bounds of the 95% band of DRAM to between 0.8% and 1.8% in relative , the MLP in fact slightly more closely than the other two. Across all models, the acceptance rate is lowest for ; we return to this in § 4.2.2.
In Table 2, we report the ESS of 1 000 000 consecutive samples of the chains generated by pCN, DRAM and FM-IMH. For FM-IMH the proposals are independent, so its ESS measures only the correlation introduced by rejections, whereas for pCN and DRAM it reflects how quickly the chain explores the posterior. For the purpose of comparison, the ESS of pCN and DRAM is computed on the last 1 000 000 steps of the chains without thinning. For FM-IMH we draw proposals, generated as for Table 1, and run IMH on them. The ESS is estimated for each latent coefficient [21], and we report the minimum over all coefficients. DRAM yields a noticeably larger ESS than pCN in both observation settings; moreover, the ESS of pCN drops sharply for the more concentrated posterior, while that of DRAM barely changes. This is expected: DRAM adapts its proposal covariance to the empirical covariance of the chain, whereas the pCN proposal is fixed to a multiple of the prior covariance scaled to achieve a prescribed acceptance rate. As a consequence, pCN takes steps which are shorter than necessary in directions not informed by the data, thus exploring the posterior less effectively than DRAM. FM-IMH attains a larger ESS than DRAM for every model and ground truth except with the MLP on the concentrated posterior, by a factor between about 1.3 and more than 300.
| Fig. 5: , | ||||
| pCN | 104 | 76 | 83 | 75 |
| DRAM | 1483 | 1471 | 1589 | 1078 |
| FM-IMH | ||||
| MLP, | 138289 | 470585 | 419401 | 416965 |
| gauss + weights, | 26612 | 585327 | 403723 | 418203 |
| gauss + weights, | 18243 | 351710 | 257563 | 258677 |
| Fig. 6: , | ||||
| pCN | 3.31 | 3.07 | 3.68 | 3.16 |
| DRAM | 1367 | 1445 | 1412 | 1442 |
| FM-IMH | ||||
| MLP, | 97 | 24846 | 8995 | 4281 |
| gauss + weights, | 1749 | 155014 | 87703 | 91129 |
| gauss + weights, | 1894 | 178779 | 136480 | 121768 |
Table 2. Effective sample size of 1 000 000 consecutive samples for the four ground truths at the two configurations shown in Figure 5 and Figure 6, minimum over the 128 latent coefficients.
Measured per forward solve, FM-IMH is more efficient than pCN and DRAM: including the forward solves of its training data, it used solves in total, against for each DRAM chain. Wall-clock times confirm this. For the setting of Figure 6 and , a DRAM chain of states takes about 42 minutes on a CPU (AMD Ryzen 7 9700X), and its last states attain an ESS of 1412, i.e., about 85 seconds per 1000 effective samples. For FM with gauss and weights, generating the training data takes about 2 minutes and training about 14 minutes on a GPU (NVIDIA GeForce RTX 4070 Ti SUPER). FM-IMH with proposals then takes 22 minutes, almost entirely spent on evaluating the proposal densities (11), and attains an ESS of 87 703, i.e., about 15 seconds per 1000 effective samples, or 26 seconds including data generation and training. Even for this single observation, FM-IMH thus takes 38 minutes in total, less than one DRAM chain, and delivers about three times as many effective samples as the post-burn-in states of that chain, assuming that their ESS grows linearly with the chain length. Without the Metropolis–Hastings correction, no densities are needed, and FM samples are drawn in 15 seconds. Since the two methods run on different hardware, these timings indicate orders of magnitude rather than a precise comparison.
Observations outside the training support
Across all models in Table 1, the acceptance rate is lowest for , on the concentrated posterior by an order of magnitude, although its posterior is the least concentrated of the four: the posterior standard deviation of is for against to for the other three ground truths. Concentration therefore does not explain this ordering, and a second, independent mechanism is present.
An amortized model is trained on pairs drawn from the joint distribution, so its accuracy at a given depends on how much training data lay near that . The relevant statistic is the position of in the distribution of observations seen during training, which we measure by the normalized radius
with the componentwise mean and standard deviation of the training observations, compared against the distribution of over the training set itself. In the setting of Figure 6, the observations of have radii and , against a median training radius of . The radius orders the four ground truths essentially as the acceptance rate does, e.g., 4.65%, 51.63%, 39.85% and 39.89% for the combination of gauss and weights with in Table 1. The sine observation lies at 2.96 times the median training radius, with only 0.12% of the training observations beyond it: the extreme tail of the prior predictive distribution, where the model has almost no training data. Note that the criterion is a property of the observation and not of the ground-truth field. The piecewise constant truth is no more a draw of the Matérn prior than the sine is, yet its observation is the most central of the four and it yields the highest acceptance rate; conversely the sine, which is a single Karhunen–Loève mode, produces the most extreme observation.
On the concentrated posterior, the modifications of Section 4.2.1 raise the acceptance rate for by at most 4 percentage points, against 9 to 40 points for the other three ground truths (Table 1). This is consistent with an absence of training support rather than of capacity, and the same phenomenon recurs for a different forward operator in Section 4.3.3. A similar loss of efficiency for out-of-distribution observations has been reported for importance sampling with amortized neural posteriors in gravitational-wave inference [17].
Parameter studies
Figure 7 varies the number of observations and the noise variance at fixed , and Figure 8 varies at fixed , in both cases for the combination of gauss and weights with from Section 4.2.1, trained separately for each setting. The solid curves show the mean over , , ; is drawn separately as a dashed curve since, for the reason given in Section 4.2.2, it lies below the range of the other three at nearly every point of both studies.

Figure 7. Influence of and the observation noise at . From left to right: acceptance rate and effective sample size of the FM-IMH sampler with the combination of gauss and weights of Section 4.2.1, ; effective sample sizes of the DRAM and pCN reference chains. Solid curves: mean over ground truths , , and three training seeds, shaded band: range across these ground truths; dashed curves: ground truth . Effective sample sizes are minima over the latent coefficients of 1 000 000 samples, on one common scale in all panels.

Figure 8. As Figure 7, but at with varying.
The acceptance rate of FM-IMH decreases as the posterior concentrates. It falls with at every noise level, most strongly for the smallest noise variance, from about 88% at to 37% at for (left panel of Figure 7). It also falls with (left panel of Figure 8).
The ESS of FM-IMH is of order to for , , throughout both studies, and above that of DRAM for all four ground truths. The ESS of DRAM hardly depends on and , whereas that of pCN drops by several orders of magnitude as the posterior concentrates, for the reason discussed in Section 4.2.1. With respect to the order is reversed: the ESS of DRAM falls with the chain dimension, while that of pCN levels off beyond , which reflects the dimension independence of pCN.
Electrical impedance tomography
To illustrate the viability of our approach on an inverse problem known to be challenging, we consider electrical impedance tomography (EIT), a severely ill-posed inverse problem in which a spatially distributed electrical conductivity is recovered from a small number of measurements at boundary electrodes. We adopt the rigorous Bayesian formulation of [18] and work with all three prior distributions studied there — log-normal, level set, and star-shaped — extending the last from a single inclusion to two. We refer to that paper for the underlying well-posedness theory and give here only the model, the priors, and the parameters needed to reproduce our experiments.
EIT is also the example where both the benefits and limitations of amortization become clear: a single conductivity image is one Bayesian inverse problem, but a clinical EIT device produces a new frame tens of times per second, and each frame is a new observation under the same prior and the same forward model. In this setting, a transport map need be trained only once, whereas a Markov chain must be restarted for each frame.
The complete electrode model
Let be a bounded domain with conductivity , and let electrodes be attached to disjoint arcs along the boundary with contact impedances . Given a current pattern with , we solve the complete electrode model (CEM) of [SCI92] for the potential in and the electrode voltages ,
which accounts for the shunting effect of the electrodes and their contact impedances and has been found to agree well with experimental EIT data [SCI92]. The solution is unique up to an additive constant, which corresponds to the choice of ground potential; following [18] we fix this by taking the representative with .
We take to be the unit disk with electrodes of contact impedance , placed equidistantly along and covering 50% of the boundary. We inject linearly independent adjacent current patterns of amplitude 0.1. We discretize (26) with continuous piecewise linear finite elements for the potential and a piecewise constant conductivity, taking on each triangle the value of at its centroid. Synthetic data are generated on a fine mesh of 75 878 triangular elements that conforms to the true inclusions, and the inversion runs on a coarser mesh of consisting of 12 144 elements; both meshes are comparable in size to those used in [18]. Solving (26) once per pattern yields a array of electrode voltages. Since our measurement setup departs from [18], we state it explicitly: each pattern is referenced to the electrode following its sink, and the two injecting electrodes together with the reference are dropped. This leaves 13 entries for each of the patterns, i.e., observations, and
with , i.e., an observation noise variance of . In the notation of (1), the unknown parameter is thus the conductivity itself. As shown in [18 Prop. 2.7], is continuous with respect to both uniform convergence and convergence in Lebesgue measure, which is what permits a rigorous Bayesian treatment directly on function space and is inherited by any prior pushed forward through a parametrization of the types to be considered below.
Throughout, denotes the latent variable carrying a standard Gaussian prior, as the Karhunen–Loève coefficients do in § 4.2, so that all three priors take the common form
with misfit . Here is short for the conductivity field ; where the spatial variable matters we write and leave the dependence on implicit. The synthetic ground truth is that of [18]: a background containing two disjoint circular inclusions of radius 0.3 at with .
Priors
All three priors of [18] are used, each written as a pushforward of the standard Gaussian latent in (28); typical draws are shown in Appendix § 11. We describe only where our choices differ from theirs.
Log-normal with a Gaussian random field with Whittle–Matérn covariance, truncated to the lowest eigenfunctions of on with homogeneous Neumann boundary conditions, i.e., normalized products of cosines , , with eigenvalues ,
with , , and as in [18], giving a marginal standard deviation of of about 0.125. Dunlop and Stuart [18] define the same prior on the square, truncate at and restrict to the disk; we truncate at , , which already captures 99.4% of the pointwise prior variance at . At our data have a mean relative error .4
Level set with as in (29), , and . Since and only its sign enters, for every . The amplitude is therefore irrelevant, and we normalize to unit marginal standard deviation. The same invariance makes the latent posterior scale-invariant.
Star-shaped, two inclusions Dunlop and Stuart [18] parametrize the boundary of a single inclusion, which cannot represent their own two-inclusion truth, and name several inclusions as future work. We use two, each with its own center (a shared center would force nested inclusions), log-size and Fourier boundary,
with , , and . Inclusions have conductivity 1 on a background of 2 and we impose a no-overlap constraint. The latent dimension is . This is the only one of the three priors whose support contains the truth.
For both two-valued priors an element changes value only when an interface crosses its centroid, so almost everywhere. Measured on the inversion mesh, a random latent perturbation of size changes no element at all, whereas under the log-normal prior it changes all of them. Gauss–Newton Hessians, Laplace approximations and likelihood-informed subspaces are therefore unavailable for these two priors.
Results
For each prior we condition the flow on , draw samples, and compare them with an MCMC reference posterior, whose step sizes were tuned on stationary states; Figure 9 shows the posterior means, and Appendix § 12 gives the full comparison including standard deviations and the samplers. The same samples serve as proposals for IMH, for which we report the acceptance rate, the number of accepted moves and the effective sample size (ESS) of the chain (Table 3). We give the ESS for two quantities along the chain: the smallest over the latent coordinates , as in § 4.2, and the mean of the conductivity over all elements. For the two-valued priors the mean and the standard deviation carry the same information, with , so we score both through the inclusion probability :

Figure 9. Posterior means of the conductivity conditioned on , one column per prior: MCMC reference (top) and flow matching with 10 000 samples (bottom), on a color scale shared within each column. Circles mark the true inclusions. Standard deviations and the sampler settings are in Appendix § 12.
| star-shaped | log-normal | level set | |
| Observation (two-inclusion truth), shown in Figure 9 | |||
| acceptance rate | 7.5% | 0.20% | 0.13% |
| accepted moves | 753 | 19 | 12 |
| ESS () | 78 | 3 | 6 |
| ESS (mean ) | 192 | 4 | 21 |
| Prior draw (highest star-shaped acceptance of the 20), shown in Figure 17 | |||
| acceptance rate | 52.8% | 38.6% | 0.09% |
| accepted moves | 5 279 | 3 857 | 8 |
| ESS () | 1 841 | 352 | 6 |
| ESS (mean ) | 2 906 | 1 029 | 9 |
| Acceptance over 20 prior draws | |||
| mean sd | 26.2 17.9% | 36.7 2.5% | 0.11 0.02% |
| median | 29.7% | 36.5% | 0.11% |
| range | 0.3–52.8% | 30.9–42.7% | 0.07–0.15% |
Table 3. IMH with flow-matching proposals (RK4, 25 steps) on , on the prior draw of Figure 17, and over 20 prior-draw observations. The ESS is given for the smallest over the latent coordinates and for the mean conductivity over all elements.
Under the star-shaped prior the flow reproduces the reference almost exactly, with a correlation of between the inclusion probabilities and an inclusion area of 0.182 for both methods against a true value of 0.178.
Under the log-normal prior the two posterior means agree to a correlation of 0.995 and the standard deviations to 0.979. Both means are far from the truth, because the prior places almost no mass near it: on the log scale, the inclusion and background values lie 2.8 marginal standard deviations below and above the prior mean, and the smooth, truncated fields of (29) cannot form sharp interfaces. This is a property of the posterior, not of either sampler. The same mismatch places out of distribution for the flow, as discussed below.
Under the level-set prior the flow locates both inclusions with but is over-dispersed: its standard deviation is 1.5 times that of the reference, and it assigns an inclusion area of 0.222 against 0.180.
On , only the star-shaped flow yields a usable IMH chain: it accepts 7.5% (753 moves, ESS 78 in and 192 in the mean conductivity), against 0.20% and 0.13% under the log-normal and the level-set prior (Table 3). Figure 9 shows that the flow reproduces the reference posterior mean under all three priors, including the two under which IMH accepts almost no steps. The low acceptance there has two causes. First, is out of distribution for both priors: its normalized radius (25) is under the log-normal and under the level-set prior, against a training median of about 0.97, and of the training observations none and 530 (0.03%), respectively, lie as far out, whereas under the star-shaped prior is typical, exceeded by 35% of the training observations. Under the level-set prior this is visible directly in the fields: a prior draw covers about half of the disk with inclusion (area fraction ), while the true inclusions cover only 0.178. The flow has therefore seen almost no data like and has to extrapolate, and neural networks are notoriously unreliable outside the range of their training data [X1–X2]: the training objective does not constrain the learned velocity field there, so its behavior is set by the architecture rather than by the data. Second, the level-set latent posterior is hard to match for any flow, even in distribution: since depends on only through the sign of , is scale-invariant, and it is thin in every latent direction, because at the interface even modes carrying a few percent of the prior variance decide the sign; small latent errors of the flow therefore change the data misfit strongly, and the likelihood of its proposals varies over many orders of magnitude. The acceptance rate certifies the flow as a sampler of the latent posterior , not of the conductivity: scored on the identifiable inclusion probability , the level-set flow agrees with the pCN reference at a correlation of 0.975.
We discuss the out-of-distribution position of separately, because it limits where amortized inference can be applied. MCMC requires only that the prior have support where the posterior concentrates; the likelihood supplies the transport. An amortized flow never sees the likelihood at training or test time — the prior is its training distribution — so it requires prior mass there. Support is therefore not enough: a prior can contain the truth exactly and still place almost no mass near it, and the flow then has to extrapolate as under the other two priors. For the star-shaped prior we therefore choose the size and center priors such that the truth is also a typical draw.
On observations drawn from the prior, which are in distribution by construction, the picture changes. Over 20 prior-draw observations, IMH accepts (mean standard deviation) under the log-normal prior and under the star-shaped prior, but only , and at most , under the level-set prior (Table 3). For the star-shaped prior we exclude draws in which an
inclusion crosses the boundary of the disk and use the first 20 remaining ones. Under the log-normal prior the low acceptance on is therefore a consequence of its out-of-distribution position and not of the flow, whereas under the level-set prior it persists for the second reason above. The wide spread under the star-shaped prior, from 0.3% to 52.8%, comes from the observations rather than from the flow: acceptance is lowest where a drawn inclusion boundary comes close to the electrodes. Figure 17 in Appendix § 13 shows the posterior means for one such observation, the second block of Table 3.

Figure 17. A prior draw as ground truth, one column per prior: truth (top), flow-matching posterior mean (middle) and reference posterior mean (bottom), with IMH as the reference for the star-shaped and log-normal priors and pCN for the level-set prior. Color scales are shared within each column.
Low ESS values should be read as a warning rather than as a measurement: where a chain makes only a few dozen moves, the ESS estimate itself is unreliable. Such values arise from a drawback of IMH: once the chain reaches a state with a large importance weight , i.e., where the posterior density is large relative to the flow density, it rejects almost every subsequent proposal until one of comparable weight arrives, and remains stuck at that state in the meantime. Unlike a local sampler such as pCN, it cannot move away through small steps, since its proposals are drawn independently of the current state. Interleaving IMH steps with local moves, as in [25], would mitigate this.
Implementation details The architectures were obtained by a small and non-exhaustive hyperparameter search. All three flows are MLPs with the Gauss head (24), trained on pairs, validated on a further , and integrated with RK4 in 25 steps. For the star-shaped prior the MLP has 5 hidden layers of width 800 with swish activations and is trained for 300 epochs; for the log-normal prior it has 4 hidden layers of width 800 with GELU activations and is trained for 120 epochs. For the level-set prior we set and in (24), so that the linear part is the exact velocity between two standard Gaussians, and the MLP has 3 hidden layers of width 800 with swish activations and is trained for 120 epochs.
Dynamic Bayesian flow matching
The static comparison assesses whether the flow is accurate; a clinical EIT device also requires sampling fast enough to image moving structures, and here the amortized model has a clear advantage over MCMC. The star-shaped flow of § 4.3.2 is trained only once and then conditioned in turn on the 195 measurements of each frame of a time-varying phantom; nothing is refitted between frames. The data are generated on the fine mesh with the measurement protocol and noise level of , and every frame is an ordinary observation under the star-shaped prior. Two inclusions at () breathe between radii 0.20 and 0.35, one cosine cycle per breath, over 720 frames: two breaths with both inclusions, then four in which only the right one breathes while the left stays at its exhaled radius. With 1 000 samples per frame (RK4, 10 steps) the flow follows both phases (Figure 10): after the second breath the reconstructed left inclusion stays at its exhaled size while the right one keeps breathing. The posterior standard deviation appears to capture where the reconstruction is uncertain: it is concentrated in a band along each inclusion boundary, the only place the two-valued field can vary, and this band is wider on the side facing the center of the disk, far from the electrodes, where EIT resolves the boundary least well. The posterior median deviates from the truth by an RMSE of 0.122 on average, ranging from 0.056 to 0.205 over the frames. Its inclusion area , with the posterior median, differs from the exact area by 0.002 on average and by at most 0.043 in any frame, with a correlation of 0.997 over the frames. A frame takes 21.7 ms on a single consumer GPU (NVIDIA GeForce RTX 4070 Ti SUPER), i.e., 46 frames per second. Appendix § 14 shows a second sequence, in which two inclusions orbit the center and then merge.

Figure 10. Star-shaped flow on the breathing sequence at three of its 720 frames: both inclusions inhaled (frame 60), both exhaled (frame 120), and the right one inhaled after the left has stopped breathing (frame 300). Columns: truth, posterior median, posterior mean and posterior standard deviation; 1 000 samples per frame, RK4 with 10 steps, 21.7 ms per frame on one RTX 4070 Ti SUPER. White circles mark the true inclusions.
MCMC needs millions of sequential forward solves for every single observation. All EIT flows, in contrast, are trained only once on samples, with a further for validation; the forward solves required to generate these samples are independent and can be run in parallel. Every subsequent frame is then processed by ODE integration alone, without any forward solve.
Stochastic Lotka–Volterra
We consider the stochastic Lotka–Volterra model introduced in [Wil12], which [Wan+25] use as one of their computational benchmarks; we follow their setup. The model consists of a continuous-time Markov jump process tracking interacting predator () and prey () populations. The state vector , starting from a fixed initial condition , evolves through four discrete transition events defined by the jump vectors , , , and . The rates of these transitions are governed by the propensity vector , parametrized by :
Under stochastic mass-action kinetics, each propensity component is the product of a stochastic rate constant and a combinatorial function counting the distinct possible reactant interactions (e.g., for binary predation, or for unary events). The state trajectory is not governed by a deterministic differential equation but is described exactly by the random time-change (Kurtz) representation
where are independent unit-rate Poisson processes. Exact state trajectories generated by this system are simulated using Gillespie’s algorithm, from which an observation vector , , is constructed using time-series summary statistics (means, log-variances, and temporal auto/cross-correlations). In a Bayesian context, the exact likelihood is analytically intractable because evaluating it requires marginalizing over the high-dimensional, combinatorial latent space of all possible random jump sequences and event times that could produce . The likelihood is therefore unavailable in closed form, which calls for likelihood-free methods such as approximate Bayesian computation (ABC). Flow matching is applicable without modification, since its training requires only samples , which the simulator provides. For we use the same prior as [Wan+25], where further details on the setup can be found.
Wang et al. [Wan+25] compare a CCNF, trained by minimizing the expected negative log-likelihood (NLL) (8), i.e., the KL divergence (see § 3.2), against an ABC method. According to the authors, their CCNF model performs comparably to the asymptotically exact Sequential Monte Carlo ABC (SMC-ABC) algorithm, while achieving a speedup factor of 30.
As discussed in § 3.2, and motivated in [36, 35] for the unconditional case, flow matching speeds up the training of continuous normalizing flows significantly, as it is simulation-free and requires no ODE solves during training. In our experiments, this decreases the training time from 25.5 minutes, using the exact setup5 of [Wan+25], to approximately 90 seconds, using Bayesian flow matching (§ 3.2) and our own architecture for the velocity field. Both training times are measured on our own hardware, an NVIDIA GeForce RTX 4070 Ti SUPER, and the former is in line with the training time reported in [Wan+25]. Both training sets are generated with the data generation script of [Wan+25], the larger one by increasing the number of samples to 500 000. For the velocity field we employ an MLP with six hidden layers, swish activation and a hidden dimension of .
As the stochastic Lotka–Volterra problem does not have a tractable likelihood, we cannot compare against likelihood-based MCMC methods, and in particular cannot compute the error measures derived in § 3.4. Our focus is a qualitative comparison against the results provided by [Wan+25] with the same amount of training data, i.e., 50 000 and 500 000 samples, respectively. Our results are shown in Figure 11.

Figure 11. Flow matching posterior for two different observations, following the setup in [Wan+25]. The model is trained using flow matching and a training set of size 50 000 (top) and 500 000 (bottom). The red point/bars represent the true parameter (left) and (right), the black crosses/bars denote the mode of the learned density , as in [Wan+25].
In particular, when comparing our model trained on the large training set, displayed in Figure 11, against the SMC-ABC result from [Wan+25], Figures 2 and 3, the agreement is good. Comparing against COT-Flow, which is the CCNF trained with the NLL/KL-divergence objective in [Wan+25], our model matches the asymptotically exact SMC-ABC more closely.
Using the smaller training set, the model does not learn the posterior distribution sufficiently well, as can be seen, e.g., by comparing the -marginal for the second set of observations. This, however, can also be observed in [Wan+25, Figure 3] and is due to the low number of training samples.
Discussion
In this paper we have discussed and evaluated Bayesian flow matching for approximate sampling from posteriors occurring in PDE-based Bayesian inverse problems. We have derived computable estimates of lower and upper bounds on the TV distance and KL divergence between true posterior and flow matching approximation which are based mainly on the acceptance rate of a hybrid sampler — an IMH using the flow matching approximation as proposal. The validity and accuracy of these bounds have been verified for the example of § 4.1, where reference values can be computed by quadrature.
Moreover, we have compared flow matching against well-established MCMC methods in various settings in § 4.2 and § 4.3. Across these examples, whenever the true observations were covered by the spread of observations within the training data, flow matching agreed closely with MCMC-generated samples in terms of posterior means, standard deviations and quantiles, at a fraction of the forward solves required by MCMC. However, the fit in TV distance can sometimes be disappointing: for instance, in the setting of Figure 6, flow matching reproduces the posterior mean and the 95% band of DRAM samples to about 1% in relative -norm, yet FM-IMH accepts only 5% to 11% of its proposals (Table 1). The explanation for these seemingly contradictory findings is that flow matching can fit the marginals of the highly informed parameter directions rather poorly, which, due to their comparatively small posterior variance, do not significantly contribute to posterior mean and spread, but differences in the marginals are strongly penalized in TV distance. In general, we noticed in our experiments that flow matching may suffer from many or highly accurate observations.
We have proposed two remedies that account for the very different posterior spread across coordinates: weighting the loss by the inverse of the linearized posterior standard deviation, and adding to the velocity field an affine term that reproduces a Gaussian approximation of the posterior.
Another limitation of flow matching found in our studies is the loss of accuracy when the observation lies in the tail of the prior predictive distribution, a phenomenon known in machine learning as out-of-distribution error. In these cases MCMC is to be preferred. We note that, in principle, it can be checked whether the observations at hand are sufficiently covered by the prior predictive distribution by comparing the normalized radius of Eq. (25) with that of the training observations.
However, our experiments also confirmed two important advantages of Bayesian flow matching over MCMC: amortization, demonstrated for EIT in § 4.3, and likelihood-free inference, demonstrated for a stochastic Lotka–Volterra model in § 4.4. In both problems MCMC would have been either infeasible (§ 4.4) or too slow for a stream of observations (§ 4.3). Moreover, our hybrid method — IMH with flow matching proposal — is another promising method combining, in a way, the best of both worlds: due to Metropolization, asymptotic exactness is restored, and since the forward solves for the proposals are independent and can be carried out in parallel, it can still be significantly faster than a single run of a classical MCMC method. In our experiments the IMH chain mixed well whenever the observation was typical under the prior (Table 2 and Table 3), but poorly for observations in the tails of the prior predictive distribution.
A theoretical foundation for flow matching-based posterior approximation in inverse problems is still largely missing. The distances used here to judge a learned posterior, the total variation distance bounded by the acceptance rate and the Kullback–Leibler divergence, are common choices in finite dimensions but ill-suited to high- and infinite-dimensional settings: two measures on a function space are easily mutually singular, which makes both distances degenerate even when the measures are close in every observable sense. Further directions therefore include an error analysis of flow matching in function space based on the Wasserstein distance, which does not have this defect; a systematic comparison of the total cost of both approaches at matched computational budgets, including the forward solves for the training data and the training of the network, which we have not attempted since its outcome depends strongly on the available hardware; and, on the practical side, addressing missing training support by combining the flow with adaptive error models [34, 9, 11]: just as these replace error statistics computed over the prior by statistics updated where the posterior concentrates, the flow could be refined iteratively with training samples drawn near the observations actually encountered, trading part of the amortization for accuracy.
Data availability
The code and data that support the findings will be made publicly available as part of this study upon acceptance of the manuscript.
The Metropolis–Hastings algorithm
Algorithm 1 states the generic Metropolis–Hastings iteration of § 2.1. The samplers used in this paper differ only in the proposal density : random walk Metropolis, pCN and DRAM propose locally around the current state (§ 2.2), whereas IMH draws its proposals independently of it, here from the flow (§ 3.3).
Proof of Proposition 3.2
Write and for the two densities. By (4) with , we have . Using together with
Algorithm 1 Generic Metropolis–Hastings MCMC
Require: unnormalized target density $\pi^y$, proposal density $q(\cdot\mid\cdot)$, initial state $x^{(0)}$, chain length $N$
1: for $k=1,\ldots,N$ do
2: sample candidate $\tilde{x}\sim q(\cdot\mid x^{(k-1)})$
3: compute the acceptance probability $\alpha=\min\left\{1,\frac{\pi^y(\tilde{x})}{\pi^y(x^{(k-1)})}\frac{q(x^{(k-1)}\mid\tilde{x})}{q(\tilde{x}\mid x^{(k-1)})}\right\}$
4: sample $u\sim\mathcal{U}[0,1]$
5: if $u\le\alpha$ then
6: $x^{(k)}\leftarrow\tilde{x}$ ▷ accept
7: else
8: $x^{(k)}\leftarrow x^{(k-1)}$ ▷ reject
9: end if
10: end for
Ensure: states $x^{(1)},\ldots,x^{(N)}$
gives
For the lower bound in (16), insert and apply the triangle inequality,
and integrate, using , to obtain . For the upper bound, set and . A direct computation gives
since for this choice of . As , the left-hand side is bounded in modulus by , so , which completes the proof. □
Flow matching in practice
Algorithms 2 to 4 state the three stages used throughout § 4: generating the training set from the prior and the forward map, fitting the velocity field, and drawing samples.
Algorithm 2 Training-set generation
Require: prior $\pi_X$, forward map $F$, noise covariance $\Gamma$, size $N$
1: for $j=1,\ldots,N$ do
2: $x^j\sim\pi_X$
3: $\varepsilon^j\sim\mathcal{N}(0,\Gamma)$
4: $y^j\leftarrow F(x^j)+\varepsilon^j$
5: end for
Ensure: pairs $\{(x^j,y^j)\}_{j=1}^N$ from the joint distribution
Algorithm 3 Flow matching training
Require: pairs from Algorithm 2, initial parameters of the velocity field , batch size
while not converged do
draw a minibatch of pairs, for
, ,
end while
Ensure: approximately minimizing (15), i.e.,
Algorithm 4 Approximate posterior sampling
Require: trained , observation , number of samples
for do ▷ independent; done in one batch in practice
end for
Ensure: approximate posterior samples
Marginals of the leading Karhunen–Loève coefficients
Figure 12 complements Figure 6 by showing the posterior in the latent coefficients instead of the field, for the MLP and for the combination of gauss and weights of § 4.2.1, both with . The widely spread marginals of and are reproduced by both flows, whereas for the strongly constrained coefficients and the MLP is too wide or shifted. Apart from , the combination of both modifications matches DRAM in all four coefficients.
Draws from the EIT priors
Figure 13 shows four draws from each of the three priors of § 4.3.2, one row per prior; each column uses the same latent seed for all three. The log-normal draws are smooth, low-contrast fluctuations around without any preferred geometry; over the four draws ranges from 0.85 to 2.33. The level-set draws are two-valued, , and since is a centered Gaussian field every point lies in an inclusion with probability : a draw covers about half of the disk with inclusion (area fraction ), split into many irregular components, several of which touch the boundary. The star-shaped draws, also two-valued, contain exactly two inclusions of radius about 0.3 near the center of the disk. Since the centers are drawn with standard deviation 0.3 and no non-overlap constraint is imposed, the two inclusions frequently overlap, as in the first and third draws, and can extend beyond the disk, as in the second. Of the three priors, only the star-shaped one produces fields that resemble the ground truth of § 4.3.1, two separated disks in a constant background.

Figure 13. Four draws from each EIT prior on the inversion mesh, one row per prior and the same latent seed in each column. posterior means in the top row, and the difference of the means and the two standard deviations in the bottom row; means and standard deviations each share one color scale.
Flow matching against MCMC on the canonical observation
Figure 14 to Figure 16 extend Figure 9 by the posterior standard deviations and the difference between the two posterior means, one figure per prior. Each shows the truth and the reference and flow-matching

Figure 14. Star-shaped prior (), conditioned on , against DRAM. Top: truth and posterior means. Bottom: FM minus DRAM mean, and posterior standard deviations. Circles: true inclusions.

Figure 16. Level-set prior (), conditioned on , against pCN; layout as in Figure 14.
Reference samplers For the star-shaped prior () the reference is DRAM with 100 chains of steps, thinned by 200, at an acceptance rate of 42.7%. For the two priors with the reference is pCN. Under the log-normal prior we run 4 chains of steps, thinned by 1000, with and an acceptance rate of 22.8%. Under the level-set prior we run 100 chains of steps, thinned by 300, with and an acceptance rate of 19.8%; on the 5 382 elements whose value is uncertain, the effective sample size is at least 2 039.
Effective sample size Table 4 compares the effective sample size of these chains with that of IMH using the flow as proposal, for the smallest over the latent coordinates and for the mean conductivity over all elements, as in Table 3. The ESS of the reference is computed per chain on the stored, thinned draws, summed over the chains and normalized by the total number of samples after burn-in. For pCN a sample costs one forward solve; the delayed-rejection stage of DRAM solves a second time after a first-stage rejection, so its cost per sample is higher. Per forward solve, IMH is ahead under the star-shaped prior, by a factor of about 35 in and 11 in the mean conductivity. Under the log-normal and the level-set prior IMH makes only 19 and 12 moves, so its ESS there is a rough estimate. Not included is the one-time cost of the flow’s training and validation samples.
| star-shaped | log-normal | level set | |
| sampler | DRAM | pCN | pCN |
| chains | 100 | 4 | 100 |
| burn-in per chain | |||
| samples per chain | |||
| thinning | 200 | 1000 | 300 |
| ESS () | 4 397 | 641 | 2 781 |
| ESS (mean ) | 33 830 | 1 741 | 15 961 |
| ESS () per samples | 2.2 | 0.80 | 0.46 |
| ESS (mean ) per samples | 16.9 | 2.2 | 2.7 |
| IMH, flow-matching proposals | |||
| ESS () | 78 | 3 | 6 |
| ESS (mean ) | 192 | 4 | 21 |
Table 4. Effective sample size of the MCMC reference chains on , against IMH with 10 000 flow-matching proposals (Table 3).
Star-shaped In Figure 14 both methods place all of the uncertainty in a thin annulus around each interface, the only place a two-valued posterior can be uncertain, and in both the annulus is wider on the side facing the center of the disk, farthest from the electrodes. The difference of the two means is confined to the same annulus, in line with the agreement of the inclusion probabilities reported in § 4.3.3.
Log-normal In Figure 15 both posterior means show the two inclusions only as blurred depressions, and both place a band of high conductivity along parts of the boundary where the truth is constant; the two methods are far from the truth in the same way. This reflects the mismatch between the smooth log-normal prior and the piecewise constant truth discussed in § 4.3.3, and is not an error of the flow. The standard deviations are of similar size across the disk and lower inside the inclusions and at the electrodes. The standard deviation of the flow is the smoother of the two, since the reference still carries Monte Carlo noise.

Figure 15. Log-normal prior (), conditioned on , against pCN; layout as in Figure 14.
Level set In Figure 16 the flow locates both inclusions, and both methods leave the region between them uncertain. The flow is over-dispersed, however: its standard deviation is larger throughout the background, and the difference of the means is positive inside the true inclusions and negative outside, i.e., the flow moves inclusion probability from the inclusions into the background. This is the larger inclusion area, 0.222 against 0.180, reported in § 4.3.3.
A prior draw as truth
Figure 17 repeats the comparison of Appendix § 12 on an observation that is in distribution by construction. For each prior we take one draw, which is not part of the training set, as ground truth and simulate its observation exactly as the training data were generated.
For the star-shaped and the log-normal prior the flow is accurate enough on this observation that IMH with the flow as proposal serves as the reference: with 10 000 proposals it accepts 52.8% (5 279 moves, ESS 1 841 in and 2 906 in the mean conductivity) and 38.6% (3 857 moves, ESS 352 and 1 029), respectively (Table 3). For the level-set prior the IMH chain visits only 9 distinct states in 10 000 proposals, so its mean would show little more than those states and is not the posterior mean. The reference there is pCN with 60 chains of steps each at (acceptance 17.7%), which still yields an effective sample size of only about 360 per element (median over the uncertain elements) and 285 for the inclusion area. The remaining roughness of that panel is its Monte Carlo error.
Under the star-shaped prior both means recover the two overlapping inclusions of the draw, blurred only at the interface. Under the log-normal prior both means are nearly featureless: the fine-scale fluctuations of the draw lie in directions the 195 measurements do not inform (§ 4.3.2), and the posterior mean stays close to the prior mean except near the boundary. Under the level-set prior both means resolve structure only close to the boundary, and flow and reference agree on where they place it; the interior, farthest from the electrodes, remains uncertain.
Moving and merging inclusions
A second sequence, set up as in § 4.3.4, tests whether the flow also follows inclusions that move and merge. Over 72 frames two inclusions of radius 0.25 first orbit the center of the disk once clockwise at radius 0.5 (48 frames) and then move straight to the center (24 frames), where they overlap and finally coincide in a single inclusion, halving the inclusion area. With 1 000 samples per frame, the flow follows every stage (Figure 18), including the merge, which this prior can only represent by placing its two inclusions on top of each other. The posterior median deviates from the truth by an RMSE of 0.109 on average, ranging from 0.061 to 0.157 over the frames. Its inclusion area differs from the exact area by 0.002 on average and by at most 0.029 in any frame, with a correlation of 0.961 over the frames. In the top row of Figure 18 the two posterior means rotate with the true inclusions; in the bottom row they approach each other, cover the union of the two overlapping disks in frames 62 and 67, and form a single disk in the last frame. Integrating with RK4 at 10 or at 25 steps gives the same posterior, with a per-frame RMS difference of at most 0.002 in the mean, at 21.9 against 34.2 ms per frame, i.e., 46 against 29 frames per second on one RTX 4070 Ti SUPER; the figure uses 10 steps.

Figure 18. Posterior means of the star-shaped flow for ten of the 72 frames of the orbit-and-merge sequence. Top: the clockwise orbit; bottom: the move to the center and the merge. White circles mark the true inclusions.
References
- [1]Michael S. Albergo, Nicholas M. Boffi, and Eric Vanden-Eijnden. “Stochastic Interpolants: A Unifying Framework for Flows and Diffusions”. In: Journal of Machine Learning Research 26.209 (2025), pp. 1–80. URL: http://jmlr.org/papers/v26/23-1605.html.
- [2]S. Agapiou et al. “Importance Sampling: Intrinsic Dimension and Computational Cost”. In: Statistical Science 32.3 (2017), pp. 405–431. DOI: 10.1214/17-STS611.DOI
- [3]Fabian Altekrüger, Paul Hagemann, and Gabriele Steidl. “Conditional Generative Models Are Provably Robust: Pointwise Guarantees for Bayesian Inverse Problems”. In: Transactions on Machine Learning Research (2023). ISSN: 2835-8856. URL: https://openreview.net/forum?id=Wcui061fxr.arxiv.org/abs/2303.15845
- [5]Lorenzo Baldassari et al. “Conditional Score-Based Diffusion Models for Bayesian Inference in Infinite Dimensions”. In: Advances in Neural Information Processing Systems. Vol. 36. 2023. URL: https://arxiv.org/abs/2305.19147.
- [6]Ricardo Baptista et al. “Conditional Sampling with Monotone GANs: From Generative Models to Likelihood-Free Inference”. In: SIAM/ASA Journal on Uncertainty Quantification 12.3 (2024), pp. 868–900.arxiv.org/abs/2006.06755
- [7]Joe Benton, George Deligiannidis, and Arnaud Doucet. “Error Bounds for Flow Matching Methods”. In: Transactions on Machine Learning Research (2024). URL: https://openreview.net/forum?id=uqQPyWFDhY.arxiv.org/abs/2305.16860
- [8]James Brofos et al. “Adaptation of the Independent Metropolis–Hastings Sampler with Normalizing Flow Proposals”. In: Proceedings of the 25th International Conference on Artificial Intelligence and Statistics. Vol. 151. Proceedings of Machine Learning Research. 2022, pp. 5949–5986.
- [9]Daniela Calvetti et al. “Iterative Updating of Model Error for Bayesian Inversion”. In: Inverse Problems 34.2 (2018), p. 025008.DOI
- [10]Kyle Cranmer, Johann Brehmer, and Gilles Louppe. “The Frontier of Simulation-Based Inference”. In: Proceedings of the National Academy of Sciences 117.48 (2020), pp. 30055–30062. DOI: 10.1073/pnas.1912789117.DOI
- [11]Tiangang Cui, Colin Fox, and Michael J. O’Sullivan. “A Posteriori Stochastic Correction of Reduced Models in Delayed-Acceptance MCMC, with Application to Multiphase Subsurface Inverse Problems”. In: International Journal for Numerical Methods in Engineering 118.10 (2019), pp. 578–605. DOI: 10.1002/nme.6028.DOI
- [12]Ricky T. Q. Chen et al. “Neural Ordinary Differential Equations”. In: Advances in Neural Information Processing Systems. Vol. 31. 2018.arxiv.org/abs/1806.07366
- [13]Jannis Chemseddine et al. “Conditional Wasserstein Distances with Applications in Bayesian OT Flow Matching”. In: Journal of Machine Learning Research 26.141 (2025), pp. 1–47. URL: http://jmlr.org/papers/v26/24-0586.html.arxiv.org/abs/2403.18705
- [14]Hyungjin Chung et al. “Diffusion Posterior Sampling for General Noisy Inverse Problems”. In: International Conference on Learning Representations. 2023. URL: https://openreview.net/forum?id=OnD9zGAGT0k.arxiv.org/abs/2209.14687
- [15]Tiangang Cui, Kody J.H. Law, and Youssef M. Marzouk. “Dimension-Independent Likelihood-Informed MCMC”. In: Journal of Computational Physics 304 (2016), pp. 109–137. DOI: 10.1016/j.jcp.2015.10.008.DOI
- [16]Simon L. Cotter et al. “MCMC Methods for Functions: Modifying Old Algorithms to Make Them Faster”. In: Statistical Science 28.3 (2013), pp. 424–446.DOI
- [17]Maximilian Dax et al. “Neural Importance Sampling for Rapid and Reliable Gravitational-Wave Inference”. In: Physical Review Letters 130.17 (2023), p. 171403. DOI: 10.1103/PhysRevLett.130.171403.DOI
- [18]Matthew M. Dunlop and Andrew M. Stuart. “The Bayesian Formulation of EIT: Analysis and Algorithms”. In: Inverse Problems and Imaging 10.4 (2016), pp. 1007–1036.
- [20]Tarek A. El Moselhy and Youssef M. Marzouk. “Bayesian Inference with Optimal Maps”. In: Journal of Computational Physics 231.23 (2012), pp. 7815–7850. DOI: 10.1016/j.jcp.2012.07.022.DOI
- [21]Charles J. Geyer. “Practical Markov Chain Monte Carlo”. In: Statistical Science 7.4 (1992), pp. 473–483. DOI: 10.1214/ss/1177011137.DOI
- [22]Ian Goodfellow et al. “Generative Adversarial Nets”. In: Advances in Neural Information Processing Systems. Vol. 27. 2014, pp. 2672–2680.
- [23]Will Grathwohl et al. “FFJORD: Free-Form Continuous Dynamics for Scalable Reversible Generative Models”. In: International Conference on Learning Representations. 2019.arxiv.org/abs/1810.01367
- [24]Louis Grenioux et al. “On Sampling with Approximate Transport Maps”. In: Proceedings of the 40th International Conference on Machine Learning. Ed. by Andreas Krause et al. Vol. 202. Proceedings of Machine Learning Research. PMLR, 2023, pp. 11698–11733. URL: https://proceedings.mlr.press/v202/grenioux23a.html.
- [25]Marylou Gabrié, Grant M. Rotskoff, and Eric Vanden-Eijnden. “Adaptive Monte Carlo Augmented with Normalizing Flows”. In: Proceedings of the National Academy of Sciences 119.10 (2022), e2109420119. DOI: 10.1073/pnas.2109420119.DOI
- [26]A. L. Gibbs and F. E. Su. “On Choosing and Bounding Probability Metrics”. In: International Statistical Review 70.3 (2002), pp. 419–435.
- [27]Heikki Haario et al. “DRAM: Efficient Adaptive MCMC”. In: Statistics and Computing 16.4 (2006), pp. 339–354.DOI
- [28]J. Hadamard. Lectures on Cauchy’s Problem in Linear Partial Differential Equations. Mrs. Hepsa Ely Silliman Memorial Lectures. Yale University Press, 1923. URL: https://books.google.de/books?id=vn5xmgEACAAJ.
- [30]W. Keith Hastings. “Monte Carlo Sampling Methods Using Markov Chains and Their Applications”. In: Biometrika 57.1 (1970), pp. 97–109.
- [31]Heikki Haario, Eero Saksman, and Johanna Tamminen. “An Adaptive Metropolis Algorithm”. In: Bernoulli 7.2 (2001), pp. 223–242.DOI
- [32]Martin Hairer, Andrew M. Stuart, and Sebastian J. Vollmer. “Spectral Gaps for a Metropolis–Hastings Algorithm in Infinite Dimensions”. In: The Annals of Applied Probability 24.6 (2014), pp. 2455–2490.DOI
- [34]Jari P. Kaipio and Erkki Somersalo. Statistical and Computational Inverse Problems. Springer, 2005.DOI
- [35]Xingchao Liu, Chengyue Gong, and Qiang Liu. “Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow”. In: International Conference on Learning Representations. 2023.arxiv.org/abs/2209.03003
- [36]Yaron Lipman et al. “Flow Matching for Generative Modeling”. In: International Conference on Learning Representations. 2023.arxiv.org/abs/2210.02747
- [37]Youssef Marzouk et al. “Sampling via Measure Transport: An Introduction”. In: Handbook of Uncertainty Quantification. Ed. by Roger Ghanem, David Higdon, and Houman Owhadi. Cham: Springer, 2017, pp. 785–825. DOI: 10.1007/978-3-319-11259-6_23-1.DOI
- [38]Nicholas Metropolis et al. “Equation of State Calculations by Fast Computing Machines”. In: The Journal of Chemical Physics 21.6 (1953), pp. 1087–1092.
- [39]Antonietta Mira. “On Metropolis–Hastings Algorithms with Delayed Rejection”. In: Metron 59.3-4 (2001), pp. 231–241.
- [40]Kirill Neklyudov and Dmitry Vetrov. Metropolis–Hastings View on Variational Inference and Adversarial Training. 2019. URL: https://openreview.net/forum?id=Hkg313AcFX.arxiv.org/abs/1810.07151