Manuscript Offprint
arXiv:2610.02377Flow Matching for Fast Posterior Sampling in Bayesian Inverse Problems
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Jan Blechschmidt, Oliver G. Ernst, Moritz Poguntke, Björn Sprungk
October 5, 2026
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 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 of the underlying approximate posterior in total-variation distance and Kullback–Leibler divergence and, moreover, propose a hybrid sampler that is asymptotically exact by Metropolization. We validate the accuracy estimates and demonstrate the amortization in several numerical examples, including electrical impedance tomography and a likelihood-free Lotka–Volterra model.
1. 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 [Cot+13; HSV14], likelihood-informed [CLM16; RS18] and adaptive [Haa+06; HST01] 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 repeated from scratch for each new observation. In applications where the same inverse problem is solved again and again 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 [EM12] 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 classical disintegration argument in [Mar+17, Sec. 7] shows that this transport map reproduces the posterior for (almost) all possible observations. Hence, 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 (= evaluation of the transport map), and no further likelihood evaluations are needed. These are substantial promises, in particular for PDE-based Bayesian inverse problems with computationally expensive likelihoods.
For the construction and training of suitable transport maps, generative machine learning has supplied several flexible and scalable approaches in recent years. In the foundational works [EM12;
Par15; Mar+17] the authors focused on monotone triangular transport maps motivated by the classical Knothe-Rosenblatt rearrangement. More recently, Baptista et al. [Bap+24] use monotone generative adversarial networks (GANs) [Goo+14] for learning suitable transport maps and Wang et al. [Wan+25] employ continuous-time normalizing flows in the form of neural ordinary differential equations [Che+18; Gra+19] to derive conditional optimal transport maps. Score-based diffusion models [Son+21] have been applied to Bayesian inverse problems as well, e.g., in [Chu+23; Bal+23]. Closely related to these is the flow matching approach to learn a neural ODE-based transport map [Lip+23; LGL23; ABV23]. Its significant advantage over [Che+18; Gra+19] is that expensive likelihood-based training is replaced by a simple least-squares regression that requires no ODE solves during training, reducing training cost by orders of magnitude. Bayesian flow matching, i.e., flow matching for sampling conditional distributions, has been derived and discussed in detail in [Che+25; Hag25; WS25] but demonstrated primarily on low-dimensional benchmarks and imaging-type applications. Very recently, [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 found Bayesian flow matching to be the “clear winner”. Moreover, due to the likelihood-free training, flow matching can also be used for simulation-based inference [Wil+23; CBL20] where the likelihood is either unknown or computationally intractable — and, hence, classical MCMC methods, which rely on likelihood evaluations, are not applicable.
Thus, flow matching seems to be one of 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 the performance of flow matching for PDE-based Bayesian inverse problems — not compared to other transport-based approaches but rather to competitive gold-standard MCMC algorithms and done on Bayesian inverse problems of increasing difficulty. Furthermore, this paper aims to provide computable a-posteriori bounds, both lower and upper, of the accuracy of the learned flow matching posteriors. These bounds are derived by means of (Markov chain) Monte Carlo theory and exploit a combination of flow matching and the independent Metropolis–Hastings algorithm, which yields a computationally efficient, asymptotically unbiased flow matching-based sampler outperforming standard MCMC samplers in some challenging Bayesian inverse problems. In this regard, we also mention previous works on the combination of transport maps and MCMC, namely, Parno and Marzouk [PM18], in which monotone triangular transport maps were exploited for posterior-adapted proposals accelerating MCMC and Grenioux et al. [Gre+23], in which discrete-time normalizing flows were also studied as proposals within independent Metropolis–Hastings. Moreover, we also refer to [BDD24] for a-priori error bounds for unconditional flow matching in Wasserstein distance which, however, are not computable in practice.
-
Exploiting the tractable density of the flow and using classical Monte Carlo theory we derive computable bounds on the accuracy of the learned posterior in total variation (TV) distance and Kullback–Leibler (KL) divergence (Section 3.4).
-
As a by-product of the above we derive, similar to [Gre+23], an asymptotically correct hybrid sampler, in which the bias of flow matching samples is removed via Metropolization (Section 3.3).
-
We demonstrate the efficiency and accuracy of flow matching for PDE-based Bayesian inverse problems in a number of numerical experiments, in which we
- validate the derived accuracy estimates for the learned posterior for a simple illustrative example (Section 4.1),
All examples will be published upon acceptance as code on GitHub
-
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 KL terms (Section 4.2), and
-
illustrate the benefits of flow matching-based sampling compared to MCMC as an amortized sampler in EIT (Section 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 (Section 4.4).
In Section 5 we weigh the advantages and disadvantages of both approaches against each other and state when to rely on which. 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: 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 forward 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. Since (1) is ill-posed in the sense of Hadamard [Had23], we adopt the Bayesian approach [Stu10]: 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 [Stu10],
with
In the following, we focus mainly on the finite-dimensional case and an absolutely continuous prior with Lebesgue density also denoted by . Then, the posterior also admits a Lebesgue density given by
In this paper we use etc. to denote both the measures and their Lebesgue densities.
The computational task is then to sample from , either for a single observation y or — the setting emphasized in this paper — for multiple observations y under the same prior and forward model. Two features of (3) are important for the design of sampling algorithms: the normalization is unavailable, so algorithms may access the posterior only through ratios of the unnormalized density; and each evaluation of F requires one solve of the forward model, which dominates the computational cost in the PDE-based problems of Section 4.
Section 2 recalls the Metropolis–Hastings MCMC variants used as baselines. Section 3 presents conditional sampling via flow matching including the proposed sample-based diagnostics. Section 4 contains the numerical study, and Section 5 collects our findings, limitations, and open questions.
2. Posterior sampling via Markov chain Monte Carlo
Markov chain Monte Carlo constructs an ergodic Markov chain on or , respectively, with as its invariant distribution, so that the states approximately follow the posterior for sufficiently large . We restrict attention to the Metropolis–Hastings (MH) class, which contains the de facto standard algorithms for Bayesian inverse problems and suffices for the comparisons in this paper; we recall the general mechanism, discuss its efficiency, and recall three variants of MH algorithms commonly used as baselines.
2.1. 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 A. Only ratios of the posterior enter (4), so is never needed, but every iteration costs at least one evaluation of F and hence one forward solve. Under mild positivity assumptions [RC99] on q, 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 being absolutely integrable w.r.t. we have under mild assumptions [RC99] that almost surely
What distinguishes good from poor MH samplers, i.e., a good from a poor choice for the proposal q, is not these asymptotic guarantees but rather the rate of convergence in (5) and the asymptotic variance of the path average estimator . A common computable measure for the efficiency of a Markov chain Monte Carlo algorithm is therefore its effective sample size (ESS) given by
where — given stationarity — the quantity corresponds to the number of independent samples w.r.t. yielding the same variance or statistical efficiency of the empirical average of as correlated samples taken from the Markov chain.
Computational aspects MH algorithms share a common cost structure that frames the comparison in this paper. The Markov chain is inherently sequential — 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 spends at least one forward solve, the dominant cost in PDE-based Bayesian inverse problems. Moreover, the entire computation is tied to a single observation y: 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 Sections 3.3 and 3.4 we show how the two approaches can be recombined to recover it.
2.2. Common MH algorithms
In this paper four MH variants serve as baselines; 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., or with , respectively. 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 Section 3.3 we exploit the flow matching approximation as proposal within IMH which yields unbiased samples as well as an empirical estimate of the accuracy of the flow matching proxy in TV distance.
Random walk Metropolis (RWMH) [Met+53; Has70] 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) [Cot+13; HSV14] 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 directly on the function space and its convergence behavior is robust under mesh refinement [Cot+13; HSV14], which makes it a natural reference for the function-space examples of Section 4.
Delayed rejection adaptive Metropolis (DRAM) [Haa+06] combines adaptive Metropolis [HST01], which periodically updates the proposal covariance from the chain history, with delayed rejection [Mir01], which upon rejection retries with a scaled proposal before the 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.
3. 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 (Section 3.1). We then introduce the representation of the transport map as the flow of a neural ordinary differential equation 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 (Section 3.2). Finally, we discuss how flow matching combined with MCMC can yield unbiased simulations of the posterior (Section 3.3) and how classical Monte Carlo theory yields computable lower and upper bounds on the accuracy of the flow matching approximation (Section 3.4).
3.1. Posterior sampling as a transport problem
The measure transport approach to computational Bayesian inference [EM12; Mar+17] seeks a map pushing forward a tractable reference distribution on the parameter space —throughout 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 [Mar+17]. The approach pursued here differs in two respects: the map is constructed from samples of the joint distribution of parameter and observation, i.e., of the prior and the prior predictive distribution, rather than from density evaluations, and it is conditional, i.e., the observation enters as a parameter, . The theoretical basis is the following disintegration result; it is the finite-dimensional core of the conditional sampling technique via triangular transports summarized in [Mar+17, Sec. 7, Lem. 1], and we state it in the block-triangular Banach space formulation of Baptista et al. [Bap+24].
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 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 .
Theorem 3.1 converts the approximation of the posterior with respect to all possible observations into a single transport problem on S, 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 . How do we now determine ? A common approach in the machine learning literature is the minimization of the joint KL divergence between and , which is actually 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
D_{\mathrm{K L}}\big(\pi\left\|T_{*}\nu\right\)=\underbrace{D_{\mathrm{K L}}\big(\pi_{Y}\left\|\nu_{Y}\right\)}_{=0}+\mathbf{E}_{y\sim\pi_{Y}}\left[D_{\mathrm{K L}}\big(\pi^{y}\left\|T_{\theta}(\cdot;y)_{*}\eta\right)\right].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 forward 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 w.r.t. . The feasibility and computational efficiency of this may depend on the architecture of . And third, the training objective (8) yields only -almost everywhere guarantees for the approximation of by . Although pointwise guarantees are also available in the literature [AHS23] under additional assumptions, the simple practical flip side of the training in terms of expectations w.r.t. is that for observations belonging to the ‘tail region’ of the prior predictive distribution the approximation quality of can be very poor, in particular since with high probability no training data reaches such tail regions.
In the following, we present a convenient approach for transport maps with computable push-forward density and explain how they can be trained computationally efficiently via the flow matching objective — which differs from the classical KL divergence-based loss (8) above.
3.2. 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 . The one relevant here represents the transport map as the solution operator or flow map of an ordinary differential equation
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 [Che+18]. If is globally Lipschitz continuous in the state , 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 [Che+18], we have
so that integrating (9) backward from a point x and accumulating the divergence along the trajectory yields
This tractable density distinguishes deterministic flows from diffusion-based generative samplers and enables Metropolization as well as quantitative diagnostics, see Sections 3.3 and 3.4. In particular, it allows one to determine the parameters of the velocity field by maximum-likelihood/minimizing the KL divergence as outlined above, i.e., minimizing the loss (8) w.r.t. . In fact, this is the approach for training in the conditional continuous normalizing flows (CCNF) literature [Wan+25; Bap+24]. The computational difficulty here, however, is that every evaluation of (8) — and of its gradient, at every step of stochastic gradient descent — requires solving the ODE (9) backward for every sample in the current batch via (11), differentiating through the unrolled numerical solver (or employing the adjoint method [Che+18], with its own stability issues), and evaluating the divergence , whose parameter gradient involves mixed second derivatives of the network, in practice approximated by stochastic trace estimators [Gra+19]. 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 [Lip+23; LGL23; ABV23] 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 [Che+25; Hag25; WS25] is referred to as guided or Bayesian flow matching. To derive the flow matching objective, let and be independent and connect the endpoints by linear interpolation in the parameter component,
while the observation component is held fixed at Y. For each fixed observation , (12) defines a stochastic process on the parameter space [ABV23; WS25] whose time marginals connect the reference to the posterior: since is independent of Y, 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 . In order to get a causal process with the same time marginals one can consider conditioning on the current state resulting in a velocity field
It can be shown under mild regularity assumptions, see [LGL23, 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
— a rewriting 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, this expectation is estimated by plain Monte Carlo, where sampling and is trivial and sampling requires one forward solve of , and minimized via stochastic gradient descent which now requires only a simple backpropagation for computing gradients of the objective.
Other couplings, e.g., optimal couplings w.r.t. conditional Wasserstein distances [Che+25], are possible but not always computationally feasible.
If the so-trained velocity field recovers the ideal field , the neural transport block-triangular map propagates to — as explained above. Flow matching thus trades the expensive objective (8) for a cheap regression whose minimizer provably provides the desired transport. However, the error incurred by finite network capacity, finite training data, inexact optimization, and ODE discretization at sampling time is not controlled by this argument, but a-priori error bounds — for the unconditional case — are available for instance in [BDD24] and the conditional setting is the subject of ongoing analysis — which is precisely why a-posteriori diagnostics such as those presented in Section 3.4 are highly relevant in applications.
Computational aspects Applying flow matching for posterior sampling separates into two phases. Offline phase (training): one generates joint samples by prior sampling and forward simulation, and minimizes (15) by stochastic gradient descent over minibatches of . Online phase (sampling): given an observation , draw and integrate (9) with the trained field using a standard ODE solver; the resulting are independent draws from the flow matching approximation of , generated in parallel at the cost of a few network evaluations each — no forward-model solves, no likelihood evaluations are required anymore. When necessary, the density of the approximation is available through (11) at the cost of one further ODE solve. Pseudocode for data generation, training and sampling is given in Algorithms 2 to 4 in Appendix B.
Remark 3.1 (Likelihood-free inference). Both training and sampling require only draws from the joint distribution , i.e., prior samples pushed through the forward model; 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 [CBL20; Wil+23; Bap+24], such as the stochastic Lotka–Volterra model of Section 4.4. In contrast, the Metropolization of Section 3.3 and the diagnostics of Section 3.4 require the unnormalized posterior density and are hence available only for tractable likelihoods.
3.3. 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 the minimum of (15) is not reached — 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 explicitly 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 distribution as the proposal distribution within the IMH, i.e., the proposal distribution is given by the pushforward of the reference distribution . Thus, we generate a Markov chain where given a possible next state is proposed by independent samples with which are accepted 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 correctness of MCMC methods. The proposal is generated independently of the current state , allowing for parallel sampling of candidates prior to the acceptance step.
Note that the idea of exploiting normalizing flows for enhancing MCMC sampling has already been proposed in previous works, e.g., [Gre+23].
3.4. 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 the IMH is closely related to the TV distance between proposal q and target distribution .
Proposition 3.2 ([Egé+26]). Let the target and the proposal have densities and , respectively, and let
denote the mean acceptance rate of the stationary IMH chain. Then
These bounds are based on [NV19, Theorem 1] and formally shown in [Egé+26] with applications in multimodal sampling. 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's inequality:
i.e.,
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 [GS02] that
where the divergence is defined by
if the Radon–Nikodym derivative exists, and otherwise. Note that even in the first case we might have . Now, considering the normalized importance weights
for i.i.d. flow matching samples , it is also well known from importance sampling theory [Aga+17, 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 n sufficiently large.
In summary, we derived empirically computable 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. It 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 taken from the proposal distribution.
Remark 3.3. In many machine learning applications such as image generation the quality of the generative model is evaluated via the Fréchet inception distance, which is, in fact, the 2-Wasserstein distance between two Gaussian measures. That is, it is implicitly assumed that the target and are Gaussian. In image generation this seems to be a moderate assumption (specifically, when considered in latent spaces), but for our setting, i.e., non-Gaussian posteriors in Bayesian inverse problems, this assumption seems rather far-fetched.
4. Numerical experiments
This section applies the conditional flow model presented in Section 3, trained using Bayesian flow matching, to four example problems. The first example is a two-point boundary value problem with two unknown scalar parameters for which the exact posterior and the KL divergence to the true posterior can be approximated numerically. The second example is a stationary diffusion problem in one space dimension where the goal is to reconstruct a distributed diffusion coefficient. Thirdly, we consider the Bayesian formulation of electrical impedance tomography (EIT) [DIS17], a well-known challenging problem in the inverse problems community. Finally, we consider a stochastic Lotka–Volterra problem which poses the challenge that no 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 the influence of issues such as the concentration of the posterior and the likelihood of an observation under the prior on the learned posterior.
4.1. 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 .

Figure 1: The blue markers show 5000 samples from the prior predictive distribution of the observations (20b) of the solution of (20a). The color intensity of the red markers at to indicates the value of the prior predictive density at these locations.
For our example we assume noisy observations that are given by evaluations of the solution u at two positions, i.e.,
In the following we consider a Gaussian prior on and a uniform prior on . We condition the prior on 20 observations equally distributed between and in data space. Samples from the prior predictive distribution together with the values of the prior predictive density (likelihood) at these 20 sample observations are shown in Fig. 1. The corresponding likelihoods are seen to vary significantly.
To compare our results, we run RWMH for every observation for one million steps after a burn-in of 100 000 steps and proposal covariance of . Additionally, we compute the true posterior numerically, which is feasible due to the low dimensionality of the problem. Flow matching training proceeded as follows: training ran over 4000 epochs with an initial learning rate of and a cosine decay schedule with a final learning rate of . We consider a multilayer perceptron (MLP) with 6 hidden layers, a hidden dimension of , a batch size of 10 000 and a training set size of 1 million pairs of the joint distribution, i.e., fewer samples than those seen by one RWMH run. The nonlinear activation function used in training is the swish function [RZL17].
Figure 2 shows samples generated by RWMH as well as samples generated by the flow matching procedure for the observations , and , respectively. 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 Fig. 3, using a flow matching posterior as the proposal within IMH can eliminate this small deviation completely. The same holds true for all other sample points , with a minimum IMH acceptance rate of about 80%, as is shown in Fig. 4. Furthermore, this figure shows TV distances and Kullback–Leibler divergences for the sample points together with their respective bounds derived in (17) and (19), resp. The values for the true TV and KL distances were approximated by numerical integration of
with the midpoint rule on a grid over . Both densities are normalized on the grid.

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

Figure 3: Samples from RWMH and IMH with flow matching proposal with their marginal distributions. Shown are points , and . The corresponding acceptance rates are , and .

Figure 4: Left: Marginal density for test observations and sample acceptance rate of IMH with FM proposal based on 500 000 FM samples. Middle: Estimated KL divergence with bounds. Right: Estimated TV distances with bounds.
4.2. 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 to Section 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 with a Matérn 1/2 (exponential) covariance kernel
with unit marginal variance and correlation length . In practice, is represented by a truncated Karhunen–Loève (KL) expansion
where are the dominant eigenpairs of the covariance operator associated with the kernel , so that the unknown is effectively parameterized 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-MH and DRAM-MH. For pCN, we slightly tune the parameter to obtain an acceptance rate close to 23.4% [RR01]. For DRAM, all computations are performed using the same setup, i.e., a covariance matrix update is performed every 1000 iterations, and the delayed rejection threshold is set to 0.2. The Markov chains used in the analysis are extracted after a burn-in period of 1M samples and thinned by a factor of 500. With a chain length (after burn-in) of 20 million, this results in 40 000 samples. We stick with this setup since it allows for a fair comparison over all studies. Further adaptations to this specific setup could improve the overall performance; however, difficulties with concentrated posteriors cannot be remedied completely. Unless indicated otherwise, the default architecture of the MLP used to approximate the FM vector-field is as follows: The models are trained using 2 million samples, and validated against 200 000 samples. The network takes as input and returns the velocity directly, with no further structure imposed; two modifications of this construction are introduced in Section 4.2.1. The neural network has 3 hidden layers of neurons each and uses the swish activation function. Learning begins with an initial learning rate of on a cosine decay schedule with a final learning rate of . The batch size is set to 5000; the number of epochs is 500. 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 Section 4.2.1; this applies to all results in this section.
4.2.1. Comparison of FM and MCMC
Figures 5 and 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: , (Fig. 5) and , (Fig. 6), each for the same number of terms. In both figures

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 Fig. 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.
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.
A different picture emerges when the FM posterior is used as the proposal of an independence Metropolis–Hastings sampler (FM-IMH, Section 3.3). For the MLP with neurons per layer, the acceptance rates in Table 1 drop sharply from the setting of Fig. 5 to that of Fig. 6. Hence, as the posterior concentrates, the FM posterior deviates from the true posterior much more than the two figures suggest.
The discrepancy becomes visible in the latent coefficients rather than in the field; Fig. 12 in Appendix C shows the marginals of in the setting of Fig. 6. Three observations 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 Fig. 6. Third, the FM loss sums the squared velocity
| 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 Figures 5 and 6; the best rate for each ground truth is set in bold.
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.
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 Fig. 6, each modification raises the acceptance rate for every ground truth, the weighting more than the Gauss head, e.g., for from to and , respectively, and the combination of both the most, to . In the wider setting of Fig. 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 Fig. 12, the combination with matches the widths of DRAM for and to within for . The plotted posterior, on the other hand, does not reveal the improvement: in the setting of Fig. 6, the MLP and the combination of both modifications with and all reproduce the posterior mean and the bounds of the band of DRAM to between and 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 Section 4.2.2.
In Table 2, we report the ESS of 1000000 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 1 000 000 proposals, integrated as in Table 1, and run the independent sampler on them. The ESS is estimated for each latent coefficient [Gey92], 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 a well-known effect due to DRAM adapting 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 pre-specified 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. Since each step of all three samplers requires exactly one evaluation of the forward model, and the FM proposals can moreover be generated in parallel, FM-IMH is more cost-efficient than pCN or DRAM even when inference is required for only one observation .
| Fig. 5: , | ||||
| pCN | 104 | 76 | 83 | 75 |
| DRAM | 1483 | 1471 | 1589 | 1078 |
| FM-IMH | ||||
| MLP, | 138 289 | 470 585 | 419 401 | 416 965 |
| gauss + weights, | 26 612 | 585 327 | 403 723 | 418 203 |
| gauss + weights, | 18 243 | 351 710 | 257 563 | 258 677 |
| Fig. 6: , | ||||
| pCN | 3.31 | 3.07 | 3.68 | 3.16 |
| DRAM | 1367 | 1445 | 1412 | 1442 |
| FM-IMH | ||||
| MLP, | 97 | 24 846 | 8995 | 4281 |
| gauss + weights, | 1749 | 155 014 | 87 703 | 91 129 |
| gauss + weights, | 1894 | 178 779 | 136 480 | 121 768 |
Table 2: Effective sample size of 1 000 000 consecutive samples for the four ground truths at the two configurations shown in Figures 5 and 6, minimum over the 128 latent coefficients.
4.2.2. 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 per-channel training statistics, compared against the distribution of over the training set itself. In the setting of Fig. 6, the observations of have radii and 0.87, against a median training radius of 0.85. The radius orders the four ground truths exactly as the acceptance rate does, e.g., , , and for the combination of gauss and

Figure 7: Influence of m 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 Fig. 7, but at m = 32 with varying.
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 KL 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.
4.2.3. Parameter studies
Figure 7 varies the number of observations m and the noise variance at fixed , and Fig. 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, 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.
The acceptance rate of FM-IMH decreases as the posterior concentrates. It falls with m at every noise level, most strongly for the smallest noise variance, from about 88% at m = 2 to 37% at m = 256 for (left panel of Fig. 7). It also falls with (left panel of Fig. 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.
4.3. 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 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 [DS16] and work with all three prior distributions studied there — log-Gaussian, 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 needs to be trained only once, whereas a Markov chain must be restarted for each frame
4.3.1. 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 [DS16] we fix this by taking the representative with .
We set to be the unit disk with electrodes with contact impedances placed equidistantly along achieving 50% boundary coverage and inject linearly independent adjacent current patterns of amplitude 0.1. We discretize (24) 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 meshing of consisting of 12 144 elements; both are comparable in size to the meshes used in [DS16]. Solving (24) once per pattern yields a array of electrode voltages. Since our measurement setup departs from [DS16] 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 [DS16, 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 Section 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 the one of [DS16]: a background containing two disjoint circular inclusions of radius 0.3 at with .
4.3.2. Priors
All three priors of [DS16] are used, each written as a pushforward of the standard Gaussian latent in (26); typical draws are shown in Appendix D. 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 [DS16], giving a marginal standard deviation of of about 0.125. [DS16] 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 .
Level set with as in (27), , and . Since and only its sign enters, for every . The amplitude is therefore meaningless, and we normalize to unit marginal standard deviation. The same invariance makes the latent posterior scale-invariant.
Star-shaped, two inclusions [DS16] 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 no non-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.
[DS16] report a relative error of 10% but do not state how it is defined. We could not reproduce this value, neither with our measurement setup nor with theirs, which uses absolute electrode voltages.
4.3.3. Results
For each prior we condition the flow on , draw samples, and compare them with an MCMC reference posterior, with every step size tuned on stationary states; Fig. 9 shows the posterior means, and Appendix E 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 Section 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 :
-
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, for the reasons 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 y, 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, and the low acceptance there has two causes. First, y is out of distribution for both priors: its normalized radius (23) 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 y and has to extrapolate, and neural networks are notoriously unreliable outside the range of their training data [Xu+21]: 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 y 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 0.15%, 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 y 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

Figure 9: Posterior means of the conductivity conditioned on y, 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 E.
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 F shows the posterior means for one such observation, the second block of Table 3.
We point out that low ESS values should be read as a warning rather than as a measurement. The reason is a drawback of IMH itself: once the chain reaches a proposal of high likelihood, whose posterior density is large relative to the flow's density there, it rejects 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.
Implementation details The architectures were obtained by a small and non-exhaustive hyperparameter search. All three flows are MLPs with the Gauss head (22), 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 layers of width 800 with GELU activations and is trained for 120 epochs. For the level-set prior we set and in (22), 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.
Table 3: IMH with flow-matching proposals (RK4, 25 steps) on , on the prior draw of Fig. 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.
| star-shaped | log-normal | level set | |
|---|---|---|---|
| Two inclusions setting, shown in Fig. 9 | |||
| acceptance | 7.5% | 0.20% | 0.13% |
| accepted moves | 753 | 19 | 12 |
| ESS (ξ) | 78 | 3 | 6 |
| ESS (mean σ) | 192 | 4 | 21 |
| Typical prior draw, shown in Fig. 17 | |||
| acceptance | 52.8% | 38.6% | 0.09% |
| accepted moves | 5279 | 3857 | 8 |
| ESS (ξ) | 1841 | 352 | 6 |
| ESS (mean σ) | 2906 | 1029 | 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% |
4.3.4. 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. We condition the star-shaped flow of Section 4.3.2, trained once, on each frame's 195-vector of a time-varying phantom in turn; 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 radius 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 the flow follows both phases (Fig. 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 G 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 on samples and validated on , whose forward solves are independent and can be generated in parallel, once; every subsequent frame is answered by an ODE integration without any forward solve.
4.4. 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 probability rates of these transitions are governed by the propensity vector , parameterized 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). Rather than a deterministic differential equation, the underlying dynamical system governing the state trajectory is expressed exactly via 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 . This lack of a closed-form likelihood necessitates the use of likelihood-free inference (LFI) or Approximate Bayesian Computation (ABC) methodologies.
The authors of [Wan+25] compare a CCNF, trained by minimizing the expected negative log-likelihood (NLL) (8), i.e., the KL divergence (see Section 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 Section 3.2, and motivated in [Lip+23; LGL23] 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 setup of [Wan+25], to approximately 70 seconds, using Bayesian flow matching (Section 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]. For the velocity field we employ a six-layer MLP with swish activation and a hidden dimension of .
As the stochastic Lotka–Volterra problem does not have a likelihood, we cannot compare it against MCMC methods, and in particular cannot compute the error measures derived in Section 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 Fig. 11.
In particular, when comparing our model trained on the large training set, displayed in Fig. 11, against the SMC-ABC result from [Wan+25], a good agreement can be found. 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 the figures presented in [Wan+25] and is due to the low number of training samples.
https://github.com/EmoryMLIP/COT-Flow


Figure 11: Posterior distribution of the flow-based model 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 cross/bars denote the MAP.
5. 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 a-posteriori bounds on the TV distance and KL divergence between true posterior and flow matching approximation which mainly were based upon 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 in Section 4.1.
Moreover, we have compared flow matching against a state-of-the-art MCMC reference in various settings in Section 4.2 and Section 4.3. Across these examples, whenever the true observations were covered by the spread of observations within the training data, flow matching produced almost perfect fits to the MCMC generated samples in terms of posterior means, standard deviations and quantiles with negligible training and online cost compared to MCMC. However, the fit in TV distance can be sometimes disappointing: for instance, in the setting of Fig. 6, flow matching reproduces the posterior mean and the 95% band of DRAM samples to about 1% in relative -norm, yet accepts only 5% to 11% (Table 1). The explanation for these contrary observations is that flow matching can fit the marginals of the highly informed parameter directions rather poorly, which, due to their comparably small posterior variance, do not significantly contribute to posterior mean and spread, but differences in the marginals is strongly punished in TV distance. In general, we noticed in our experiments that flow matching may suffer from large or accurate observational data. We have also discussed possible remedies for this in terms of accounting for the very different posterior spread across coordinates during training by weighting the loss with the (approximated) inverse posterior covariance and/or to include an additional linear layer in the neural network architecture for the velocity field, which can reproduce a Gaussian approximation to the posterior.
Another limitation of flow matching found in our studies is the low performance when the true observations lie in the tails of the prior predictive distribution for the observables — a well-known effect in machine learning known 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 y at hand are sufficiently covered by prior prediction by comparing the normalized radius of Eq. (23) with that of the training observations.
However, in our experiments we also verified the great potential and two important advantages of Bayesian flow matching over MCMC simulation: a) amortization and b) likelihood-free inference, both of which were clearly demonstrated in Section 4.3 for EIT applications and Section 4.4 for a stochastic Lotka–Volterra problem. In both problems the gold standard MCMC simulation would have either been simply infeasible (Section 4.4) or computationally prohibitively expensive (Section 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) unbiasedness 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 — particularly since the flow matching-based IMH Markov chain showed outstandingly good mixing in our experiments.
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 [KS05; Cal+18], in which training samples are drawn in a region localized around the observations actually encountered and the flow is iteratively refined there, trading part of the amortization for accuracy.
References
[ABV23] Michael S. Albergo, Nicholas M. Boffi, and Eric Vanden-Eijnden. Stochastic Interpolants: A Unifying Framework for Flows and Diffusions. 2023. arXiv: 2303.08797 [cs.LG].
[Aga+17] 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.
[AHS23] 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.
[Bal+23] 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.
[Bap+24] 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.
[BDD24] 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.
[Cal+18] Daniela Calvetti et al. “Iterative Updating of Model Error for Bayesian Inversion”. In: Inverse Problems 34.2 (2018), p. 025008.
[CBL20] 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.
[Che+18] Ricky T. Q. Chen et al. “Neural Ordinary Differential Equations”. In: Advances in Neural Information Processing Systems. Vol. 31. 2018.
[Che+25] 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.
[Chu+23] 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.
[CLM16] 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.
[Cot+13] 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.
[DIS17] Matthew M. Dunlop, Marco A. Iglesias, and Andrew M. Stuart. “Hierarchical Bayesian Level Set Inversion”. In: Statistics and Computing 27 (2017), pp. 1555–1584. DOI: 10.1007/s11222-016-9704-8.
[DS16] 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.
[Egé+26] Maxime Egéa et al. Multimodal Laplace-Based Sampling. in preparation. 2026.
[EM12] 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.
[Gey92] Charles J. Geyer. "Practical Markov Chain Monte Carlo". In: Statistical Science 7.4 (1992), pp. 473–483. DOI: 10.1214/ss/1177011137.
[Goo+14] Ian Goodfellow et al. “Generative Adversarial Nets”. In: Advances in Neural Information Processing Systems. Vol. 27. 2014, pp. 2672–2680.
[Gra+19] Will Grathwohl et al. “FFJORD: Free-Form Continuous Dynamics for Scalable Reversible Generative Models”. In: International Conference on Learning Representations. 2019.
[Gre+23] 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.
[GS02] A. L. Gibbs and F. E. Su. “On Choosing and Bounding Probability Metrics”. In: International Statistical Review 70.3 (2002), pp. 419–435.
[Haa+06] Heikki Haario et al. “DRAM: Efficient Adaptive MCMC”. In: Statistics and Computing 16.4 (2006), pp. 339–354.
[Had23] 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.
[Hag25] Paul Hagemann. “Conditional Generative Models for Bayesian Inverse Problems”. PhD thesis. Technische Universität Berlin, 2025. URL: https://depositonce.tu-berlin.de/items/416bf4f2-a250-4e22-b1c7-11a28539ea48.
[Has70] W. Keith Hastings. “Monte Carlo Sampling Methods Using Markov Chains and Their Applications”. In: Biometrika 57.1 (1970), pp. 97–109.
[HST01] Heikki Haario, Eero Saksman, and Johanna Tamminen. "An Adaptive Metropolis Algorithm". In: Bernoulli 7.2 (2001), pp. 223–242.
[HSV14] 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.
[Krü+26] Patrick Krüger et al. How Well Do Generative Models Solve Inverse Problems? A Benchmark Study. 2026. arXiv: 2601.23238 [cs.LG]. URL: https://arxiv.org/abs/2601.23238.
[KS05] Jari P. Kaipio and Erkki Somersalo. Statistical and Computational Inverse Problems. Springer, 2005.
[LGL23] 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.
[Lip+23] Yaron Lipman et al. "Flow Matching for Generative Modeling". In: International Conference on Learning Representations. 2023.
[Mar+17] 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.
[Met+53] Nicholas Metropolis et al. “Equation of State Calculations by Fast Computing Machines”. In: The Journal of Chemical Physics 21.6 (1953), pp. 1087–1092.
[Mir01] Antonietta Mira. “On Metropolis–Hastings Algorithms with Delayed Rejection”. In: Metron 59.3-4 (2001), pp. 231–241.
[NV19] Kirill Neklyudov and Dmitry Vetrov. Metropolis–Hastings View on Variational Inference and Adversarial Training. 2019. URL: https://openreview.net/forum?id=Hkg313AcFX.
[Par15] Matthew David Parno. “Transport Maps for Accelerated Bayesian Computation”. PhD thesis. Massachusetts Institute of Technology, 2015.
[PM18] Matthew D. Parno and Youssef M. Marzouk. “Transport Map Accelerated Markov Chain Monte Carlo”. In: SIAM/ASA Journal on Uncertainty Quantification 6.2 (2018), pp. 645–682. DOI: 10.1137/17M1134640.
[RC99] Christian P. Robert and George Casella. Monte Carlo Statistical Methods. New York: Springer, 1999.
[RR01] Gareth O. Roberts and Jeffrey S. Rosenthal. “Optimal Scaling for Various Metropolis–Hastings Algorithms”. In: Statistical Science 16.4 (2001), pp. 351–367.
[RS18] Daniel Rudolf and Björn Sprungk. “On a Generalization of the Preconditioned Crank–Nicolson Metropolis Algorithm”. In: Foundations of Computational Mathematics 18.2 (2018), pp. 309–343.
[RZL17] Prajit Ramachandran, Barret Zoph, and Quoc V. Le. Searching for Activation Functions. 2017. arXiv: 1710.05941 [cs.NE].
[SCI92] Erkki Somersalo, Margaret Cheney, and David Isaacson. “Existence and Uniqueness for Electrode Models for Electric Current Computed Tomography”. In: SIAM Journal on Applied Mathematics 52.4 (1992), pp. 1023–1040.
[Son+21] Yang Song et al. “Score-Based Generative Modeling through Stochastic Differential Equations”. In: International Conference on Learning Representations. 2021. URL: https://openreview.net/pdf?id=PxTIG12RRHS.
[Stu10] Andrew M. Stuart. “Inverse Problems: A Bayesian Perspective”. In: Acta Numerica 19 (2010), pp. 451–559. DOI: 10.1017/S0962492910000061.
[Wan+25] Zheyu Oliver Wang et al. “Efficient Neural Network Approaches for Conditional Optimal Transport with Applications in Bayesian Inference”. In: SIAM Journal on Scientific Computing (2025). DOI: 10.1137/24M1678659.
[Wil+23] Jonas Wildberger et al. “Flow Matching for Scalable Simulation-Based Inference”. In: Advances in Neural Information Processing Systems. Ed. by A. Oh et al. Vol. 36. Curran Associates, Inc., 2023, pp. 16837–16864. URL: https://proceedings.neurips.cc/paper_files/paper/2023/file/3663ae53ec078860bb0b9c6606e092a0-Paper-Conference.pdf.
[Will12] Darren J. Wilkinson. Stochastic Modelling for Systems Biology. Boca Raton: Taylor and Francis, 2012. ISBN: 9781439837726. URL: http://www.worldcat.org/search?qt=worldcat_org_all&q=9781439837726.
[WS25] Christian Wald and Gabriele Steidl. Flow Matching: Markov Kernels, Stochastic Processes and Transport Plans. 2025. arXiv: 2501.16839 [cs.LG]. URL: https://arxiv.org/abs/2501.16839.
[Xu+21] Keyulu Xu et al. “How Neural Networks Extrapolate: From Feedforward to Graph Neural Networks”. In: International Conference on Learning Representations. 2021.
A. The Metropolis–Hastings algorithm
Algorithm 1 states the generic Metropolis–Hastings iteration of Section 2.1. The samplers used in this paper differ only in the proposal density : random walk, pCN and DRAM propose locally around the current state (Section 2.2), whereas IMH draws its proposals independently of it, here from the flow (Section 3.3).
Algorithm 1 Generic Metropolis–Hastings MCMC
Require: unnormalized target density , proposal density , initial state , chain length 1: for do 2: sample candidate 3: compute the acceptance probability 4: sample 5: if then 6: 7: else 8: 9: end if 10: end for
Ensure: states
B. Flow matching in practice
Algorithms 2 to 4 state the three stages used throughout Section 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 , forward map , noise covariance , size
1: for do 2: 3: 4: 5: end for
Ensure: pairs from the joint distribution
Algorithm 3 Flow matching training
Require: pairs from Algorithm 2, initial parameters of the velocity field , batch size
1:
2: while not converged do
3: draw of the pairs, for
4: , ,
5:
6:
7: end while
Ensure: minimizing (15), i.e.
Algorithm 4 Approximate posterior sampling
Require: trained , observation , number of samples
1: for do 2: 3: , from 4: end for
Ensure: approximate posterior samples
C. Marginals of the leading KL coefficients
Figure 12 complements Fig. 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 Section 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.
D. Draws from the EIT priors
Figure 13 shows four draws from each of the three priors of Section 4.3.2, one row per prior; each column uses the same latent seed for all three. The log-normal draws are rough 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
DRAM FM, gauss + weights, FM, MLP,

Figure 12: Marginal posterior densities of the KL coefficients (columns) for the four ground truths (rows) in the setting of Fig. 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.
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 Section 4.3.1, two separated disks in a constant background.
log-normal, M = 32

level set, M = 32
star-shaped, d = 29
Figure 13: Four draws from each EIT prior on the inversion mesh, one row per prior and the same latent seed in each column.
E. Flow matching against MCMC on the canonical observation
Figures 14 to 16 extend Fig. 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 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.
Reference samplers For the star-shaped prior (d = 26) the reference is DRAM with 100 chains of steps, thinned by 200, at an acceptance rate of 42.7%. For the two priors with d = 1024 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 5382 elements whose value is uncertain, the effective sample size is at least 2039.
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 all three priors, by a factor of about 35 in and 11 in the mean conductivity under the star-shaped prior. 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.
Table 4: Effective sample size of the MCMC reference chains on , against IMH with 10 000 flow-matching proposals (Table 3).
| star-shaped | log-normal | level set | |
| sampling | DRAM | pCN | pCN |
| chains | 100 | 4 | 100 |
| burn-in per chain | |||
| samples per chain | |||
| thinning | 200 | 1000 | 300 |
| ESS () | 4397 | 641 | 2781 |
| ESS (mean ) | 33830 | 1741 | 15961 |
| 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 |
Star-shaped In Fig. 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 Section 4.3.3.
Log-normal In Fig. 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, which is the out-of-distribution position of discussed in Section 4.3.3 and 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.
Level set In Fig. 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 Section 4.3.3.
F. A prior draw as truth
Figure 17 repeats the comparison of Appendix E 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.



FM – DRAM mean
DRAM std

FM std

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

pCN mean

FM mean
FM – pCN mean

pCN std

FM std
Figure 15: Log-normal prior (M = 32), conditioned on y, against pCN; layout as in Fig. 14.

Figure 16: Level-set prior (M = 32), conditioned on y, against pCN; layout as in Fig. 14.
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 (Section 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.
G. Moving and merging inclusions
A second sequence, set up as in Section 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 (Fig. 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 one 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 Fig. 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 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.
frame 0

frame 48
frame 10

frame 56
frame 19

frame 62
frame 29

frame 67
frame 38

frame 71
1.0
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.