Manuscript Offprint

arXiv:2609.39660

BAM! Bayesian Anything Model: a foundation model for generative computational imaging

Alessio Spagnoletti, Charlesquin Kemajou Mbakam, Jonathan Spence, Andrés Almansa, Marcelo Pereyra

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Generative models are transforming Bayesian computational imaging, yet the field still lacks physics-aware foundation models. Current practice falls into two camps. Large foundation image models are deployed as plug-and-play priors with zero-shot approximate likelihood guidance, which introduces significant bias and computational cost. Physics-aware generative models avoid this bias, but each is tied to a specific dataset, task and instrument. We introduce BAM (Bayesian Anything Model), a lightweight foundation model for few-step, physics-aware posterior sampling that generalises robustly to unseen data and tasks, zero-shot or with minimal finetuning. BAM upgrades the operator-conditioned Reconstruct Anything Model (RAM) backbone (Terris et al., 2026) into a conditional flow map, so instrument physics is specified at inference time rather than fixed during training. BAM has just 36M parameters and is pre-trained jointly on large image corpora and libraries of forward operators. A single network then draws posterior samples in a few steps, with no likelihood approximation and no guidance weights to tune. Across linear inverse problems on FFHQ, AFHQ, LSUN, DIV2K and the Köhler camera-shake benchmark, BAM outperforms in just 3 steps both specialised models and leading zero-shot methods in sample quality, at a fraction of their computational cost. BAM gives the community an accessible entry point to generative computational imaging, lowers the economic and environmental cost of training imaging models, and opens a new path for research on physics-aware Bayesian computational imaging. Official page: https://bayesian-anything-model.github.io/

Figure

DIV2K | SR x4

AFHQ | Gaussian deblurring

FFHQ | Inpainting

FFHQ | JPEG (Q = 10)

Kohler | Blind motion deblurring

LSUN | Inpainting

LSUN | SR x4

Figure 1: BAM! One small network, many imaging problems, few steps. Each tile pairs an observation (left) with a BAM! posterior sample (right). A single 36M-parameter network, with the forward operator supplied at inference time, covers ×4 super-resolution (DIV2K, LSUN), Gaussian deblurring (AFHQ), inpainting (FFHQ, LSUN), non-linear JPEG restoration at Q = 10 (FFHQ) and blind motion deblurring (Köhler), all in 3 steps. Settings are given in Section 4.

1 INTRODUCTION

We consider imaging problems involving an unknown image x∗∈Rdx^* \in \mathbb{R}^d and a measurement y∈Rmy \in \mathbb{R}^m, related through the observation model y=Ax∗+σywy = Ax^* + \sigma_y w, where ww is additive Gaussian noise and the forward operator A∈Rm×dA \in \mathbb{R}^{m \times d} and the noise level σy>0\sigma_y > 0 are known at inference time. We are interested in problems where estimating x∗x^* from yy is ill-posed or ill-conditioned. Additional information is then required to reduce the uncertainty about x∗x^* and deliver meaningful solutions. Within the Bayesian framework, this is achieved by modelling x∗x^* as a realization of x∼p(x)\boldsymbol{x} \sim p(\boldsymbol{x}), the so-called prior distribution, and yy as a realisation from p(y∣x∗)p(\boldsymbol{y} \mid x^*). Prior and observed information are then combined in the posterior distribution p(x∣y,A,σy)=p(y∣x,A,σy)p(x)/p(y∣A,σy)p(\boldsymbol{x} \mid y, A, \sigma_y) = p(y \mid \boldsymbol{x}, A, \sigma_y) p(\boldsymbol{x}) / p(y \mid A, \sigma_y). This posterior underpins Bayesian inference about x\boldsymbol{x}, from point estimators such as the posterior mean to uncertainty quantification through posterior variances and credible regions, all of which can be approximated from posterior samples.

State-of-the-art Bayesian imaging methods learn from representative data via plug-and-play (PnP) or end-to-end strategies. PnP methods plug a pre-trained denoiser or generative prior into an iterative scheme that enforces the likelihood (Venkatakrishnan et al., 2013; Romano et al., 2017; Kamilov et al., 2023), and zero-shot posterior samplers extend this idea beyond point estimates (Laumont et al., 2022; Kawar et al., 2022; Chung et al., 2023). With modern diffusion model (DM) priors (Ho et al., 2020; Song et al., 2021), this flexibility carries three costs: a biased likelihood approximation with tunable guidance weights, hundreds of neural function evaluations (NFEs), and priors that, even in latent space, reach billions of parameters (Podell et al., 2024). Dis-

Figure

Figure 2: Pareto frontier drawn by SOTA methods compared to BAM.

tilled consistency and flow-map models (Song et al., 2023; Luo et al., 2023; Boffi et al., 2025) cut sampling to a few NFEs, and zero-shot solvers built on distilled latent models now set the state of the art (Garber & Tirer, 2025; Spagnoletti et al., 2025; 2026), but the biased likelihood and large prior remain. End-to-end methods instead learn the reconstruction directly, typically with physics-aware unrolled or equilibrium networks (Monga et al., 2021; Gilton et al., 2021) trained per operator, often by fine-tuning a pre-trained denoiser, returning point estimates. Conditional diffusion and bridge models sample the posterior (Liu et al., 2023a; Zhao et al., 2024; Mbakam et al., 2025) but are mostly task-specific and as costly as the underlying DM. Since y is highly informative about x, posterior sampling should need far fewer parameters than unconditional generation, yet lightweight networks that generalize across operators remain largely unexplored. A notable exception is the Reconstruct Anything Model (RAM) (Terris et al., 2026), an operator-conditioned DRUNet that solves many linear inverse problems with one network, but returns a point estimate of x not posterior samples.

We introduce the Bayesian Anything Model (BAM), a lightweight foundation model for few-step, physics-aware posterior sampling that bridges these two camps. BAM is a conditional flow map that transports a Gaussian reference to the posterior p(x∣y,A,σy)p(\boldsymbol{x} \mid y, A, \sigma_y), with the instrument physics specified at inference time rather than fixed during training. Pre-trained jointly on large image corpora and libraries of forward operators, a single model draws posterior samples in a few steps, with no likelihood approximation and no guidance weights to tune. Our contributions are as follows:

• A flow-map training paradigm. We propose a recipe that upgrades an unfolded reconstruction network into such a flow map, via Lagrangian self-distillation on a normalized stochastic interpolant of the measurement.

• A lightweight foundation model. Built on the 36M-parameter RAM backbone, a UNet with unrolled physics-aware updates, BAM learns this map across operators, noise levels and datasets, delivering high-quality posterior samples (Figure 1) and generalizing to new data and tasks.

• State-of-the-art quality at a fraction of the cost. On FFHQ, AFHQ, LSUN, DIV2K and the Köhler benchmark, BAM outperforms specialized models and leading zero-shot methods in sample quality in just three steps, advancing the quality–cost Pareto frontier (Figure 2).

BAM lowers the barrier to generative computational imaging, cuts the economic and environmental cost of training imaging models, and opens a new direction for physics-aware Bayesian imaging.

BACKGROUND

Diffusion models. DMs generate samples from ρ0\rho_0 by learning to reverse a process that gradually corrupts data with Gaussian noise. The noising process is xt=αtx0+σtz\boldsymbol{x}_t = \alpha_t \boldsymbol{x}_0 + \sigma_t \boldsymbol{z}, where x0∼ρ0\boldsymbol{x}_0 \sim \rho_0 and z∼N(0,σd2Id)\boldsymbol{z} \sim \mathcal{N}(0, \sigma_d^2 \text{Id}) are independent, and the schedules satisfy α0=σ1=1\alpha_0 = \sigma_1 = 1 and α1=σ0=0\alpha_1 = \sigma_0 = 0. Each marginal ρt\rho_t, the law of xt\boldsymbol{x}_t, is therefore a rescaled, Gaussian-smoothed version of the data distribution. Sampling reverses this process through the probability-flow ODE (Song et al., 2021)

x˙t=ftxt−12gt2∇log⁡ρt(xt),ft=α˙tαt,gt2=2σd2αtσtddt(σtαt).(1)\dot{x}_{t}=f_{t}x_{t}-\frac{1}{2}g_{t}^{2}\nabla\log\rho_{t}(x_{t}),\qquad f_{t}=\frac{\dot{\alpha}_{t}}{\alpha_{t}},\quad g_{t}^{2}=2\sigma_{d}^{2}\alpha_{t}\sigma_{t}\frac{\mathrm{d}}{\mathrm{d}t}\Big(\frac{\sigma_{t}}{\alpha_{t}}\Big). \tag{1}

Integrated backwards in time, its solutions transport ρ1\rho_1 onto ρt\rho_t for every t∈[0,1]t \in [0, 1]. The associated integrated flow Xt,0X_{t,0} sends each state to its endpoint at t=0t = 0, so that (Xt,0)#ρt=ρ0(X_{t,0})_{\#} \rho_t = \rho_0. DMs learn only the score ∇log⁡ρt\nabla \log \rho_t, which makes them easy to train but slow to sample. A standard DM solver needs hundreds of NFEs to integrate (1) for each sample.

Flow matching. Flow matching (FM) learns the velocity field of the probability-flow ODE directly, rather than through the score (Lipman et al., 2023; Liu et al., 2023b; Albergo et al., 2025). The drift that transports the marginals (ρt)t∈[0,1](\rho_t)_{t\in[0,1]} is the average velocity of the noising paths through each state,

bt(x)=E[α˙tx0+σ˙tz∣xt=x],(2)b_{t}(x)=\mathbb{E}\big[\dot{\alpha}_{t}\boldsymbol{x}_{0}+\dot{\sigma}_{t}\boldsymbol{z}\mid\boldsymbol{x}_{t}=x\big], \tag{2}

so the probability flow reads x˙t=bt(xt)\dot{x}_t = b_t(x_t). The drift btb_t minimises E∥v(xt)−α˙tx0−σ˙tz∥2\mathbb{E}\|v(x_t) - \dot{\alpha}_t x_0 - \dot{\sigma}_t z\|^2 over functions vv, so it can be learned by least-squares regression on (x0,z)(x_0, z) pairs without simulating ODE trajectories. FM typically uses αt=1−t\alpha_t = 1 - t and σt=t\sigma_t = t, for which bt(x)=E[z−x0∣xt=x]b_t(x) = \mathbb{E}[z - x_0 \mid x_t = x]. By Tweedie's formula, bt(x)=ftx−12gt2∇log⁡ρt(x)b_t(x) = f_t x - \frac{1}{2} g_t^2 \nabla \log \rho_t(x), the r.h.s. of (1). So FM and DMs learn the same ODE and differ only in parametrization, loss weighting and choice of solver (Gao et al., 2025).

Consistency models. Consistency models (CMs) dramatically accelerate sampling by learning the integrated flow Xt,0X_{t,0} directly, mapping a noisy state to the endpoint of its trajectory in a single network evaluation. Training enforces two properties of this map. The first is self-consistency: all points on the same trajectory of (1) share an endpoint, so Xt,0(xt)=Xs,0(xs)X_{t,0}(x_t) = X_{s,0}(x_s). The second is the boundary condition X0,0(x)=xX_{0,0}(x) = x. CMs can be distilled from a pre-trained DM or trained directly from data (Song et al., 2023; Song & Dhariwal, 2024; Boffi et al., 2025).

Flow maps. Flow maps generalize CMs to jumps between any two times (Boffi et al., 2025). The flow map Xt,sX_{t,s} moves a point along its trajectory of (1) from time tt to time s≤ts \leq t, i.e. Xt,s(xt)=xsX_{t,s}(x_t) = x_s. Thus Xt,t(x)=xX_{t,t}(x) = x, Xt,0X_{t,0} is the CM map, and X1,0X_{1,0} transports pure noise to data. The parametrization

Xt,s(x)=x+(s−t)vt,s(x)(3)X_{t,s}(x)=x+(s-t)v_{t,s}(x) \tag{3}

enforces Xt,t(x)=xX_{t,t}(x) = x by construction, and vt,sv_{t,s} is the average velocity along the trajectory between t and s. On the so-called diagonal (t=s)(t = s), it reduces to the FM drift:

∂sXt,s(x)∣s=t=vt,t(x)=bt(x).(4)\partial_{s}X_{t,s}(x)\big|_{s=t}=v_{t,t}(x)=b_{t}(x). \tag{4}

Under mild regularity, flow maps verify the following characterizations (Boffi et al., 2025, Prop. 2.2):

∂sXt,s(x)=bs(Xt,s(x))⏟Lagrangian,∂tXt,s(x)+DXt,s(x)bt(x)=0⏟Eulerian,Xu,s∘Xt,u=Xt,s⏟semigroup.(5)\underbrace{\partial_{s}X_{t,s}(x)=b_{s}\big(X_{t,s}(x)\big)}_{Lagrangian},\qquad\underbrace{\partial_{t}X_{t,s}(x)+D X_{t,s}(x)b_{t}(x)=0}_{Eulerian},\qquad\underbrace{X_{u,s}\circ X_{t,u}=X_{t,s}}_{semigroup}. \tag{5}

for s≤u≤ts \leq u \leq t, where DXt,sDX_{t,s} denotes the Jacobian. The three characterizations are equivalent, as each determines the flow map uniquely. With s=0s = 0, the semigroup property is exactly CM self-consistency, and the Eulerian equation is its infinitesimal form. The Lagrangian form avoids the Jacobian, which makes it cheaper and more stable to train.

For a network Xt,sθ(x)=x+(s−t)vt,sθ(x)X_{t,s}^{\theta}(x) = x + (s - t) v_{t,s}^{\theta}(x), the tangent and Lagrangian conditions give two losses:

Lb(θ)=E∥vt,tθ(xt)−α˙tx0−σ˙tz∥2,LLSD(θ)=E∥∂sXt,sθ(xt)−vs,sθ−(Xt,sθ(xt))∥2.(6)\mathcal{L}_{b}(\theta)=\mathbb{E}\big\|v_{t,t}^{\theta}(\boldsymbol{x}_{t})-\dot{\alpha}_{t}\boldsymbol{x}_{0}-\dot{\sigma}_{t}\boldsymbol{z}\big\|^{2},\qquad\mathcal{L}_{\mathrm{L S D}}(\theta)=\mathbb{E}\big\|\partial_{s}X_{t,s}^{\theta}(\boldsymbol{x}_{t})-v_{s,s}^{\theta^{-}}\big(X_{t,s}^{\theta}(\boldsymbol{x}_{t})\big)\big\|^{2}. \tag{6}

The times s≤ts \leq t are drawn at random, and θ−\theta^{-}is an exponential moving average (EMA) of θ\theta that serves as a detached teacher. Lb\mathcal{L}_b is the FM loss on the diagonal, whereas the Lagrangian self-distillation loss LLSD\mathcal{L}_{\text{LSD}} propagates that drift to finite jumps.

We use this formulation to train BAM, our lightweight foundation model for few-step, physics-aware posterior sampling, which transfers to unseen data and tasks zero-shot or with minimal finetuning.

3 BAM! BAYESIAN ANYTHING MODEL

Model. BAM is designed for imaging problems of the form y=Ax⋆+σywy = Ax^\star + \sigma_y w, where we assume that the unknown image x⋆x^\star is a realization of a r.v. x∼p(x)\boldsymbol{x} \sim p(\boldsymbol{x}), the additive noise ww is a realization of w∼N(0,Id)\boldsymbol{w} \sim \mathcal{N}(\mathbf{0}, \text{Id}), and the forward operator A∈Rm×dA \in \mathbb{R}^{m \times d} and noise level σy>0\sigma_y > 0 are known at inference time. The goal is to draw accurate samples from the posterior p(x∣y,A,σy)p(\boldsymbol{x} \mid y, A, \sigma_y) in a small number of network evaluations. Moreover, rather than train a separate model for each problem or narrow problem class, BAM amortizes over a wide family of operators and noise levels encountered in practice, which are randomized during training. A single model therefore serves the entire family, requiring no retraining, or at most light finetuning, when the forward model changes. Finally, following Terris et al. (2026), BAM is deliberately lightweight, compatible with modest local hardware.

To this end, BAM is built as a lightweight few-step conditional flow map targeting the posterior p(x∣y,A,σy)p(\boldsymbol{x} \mid y, A, \sigma_y). Feeding (y,A,σy,t,s)(y, \mathcal{A}, \sigma_y, t, s) directly as inputs to a small network is numerically fragile, as σy\sigma_y and (t,s)(t, s) span several orders of magnitude while the spectrum of A\mathcal{A} is fixed, so the network receives inputs whose relative scales vary inconsistently across the training range. We therefore condition on a rescaled measurement, defined through the stochastic interpolant

yσ=ασAx+ςσw,(7)y_{\sigma}=\alpha_{\sigma}A x+\varsigma_{\sigma}w, \tag{7}

with schedule ασ\alpha_{\sigma} and ςσ\varsigma_{\sigma}, respectively decreasing and increasing in σ\sigma, satisfying ςσ/ασ=σ\varsigma_{\sigma}/\alpha_{\sigma} = \sigma. Hence yy is a realization of yσy_{\sigma} at σ=σy\sigma = \sigma_y, up to the known factor ασ\alpha_{\sigma}, and we condition on yσ:=ασyy_{\sigma} := \alpha_{\sigma}y.

Using the linear interpolant of section 2, we construct a flow map to transport ρ1=N(0,σd2Id)\rho_1 = \mathcal{N}(\mathbf{0}, \sigma_d^2 \text{Id}) to ρ0=p(x∣y,A,σy)\rho_0 = p(\boldsymbol{x} \mid y, A, \sigma_y). We parametrize this flow map as

Xt,sθ(x∣yσ,ασA)=x+(s−t)vθ(x,t,s,yσ,ασA),0≤s≤t≤1,(8)\boldsymbol{X}_{t,s}^{\theta}(x\mid y_{\sigma},\alpha_{\sigma}A)=x+(s-t)\boldsymbol{v}_{\theta}(x,t,s,y_{\sigma},\alpha_{\sigma}A),\qquad0\leq s\leq t\leq1, \tag{8}

so that the identity boundary condition Xt,tθ(x∣yσ,ασA)=x\mathbf{X}_{t,t}^{\theta}(x \mid y_{\sigma}, \alpha_{\sigma}A) = x holds ∀x∈Rd\forall x \in \mathbb{R}^d by construction. The velocity must then satisfy two conditions. On the diagonal, the tangent condition requires vθ(x,t,t,yσ,ασA)=bt(x∣yσ,ασA)\boldsymbol{v}_{\theta}(x, t, t, y_{\sigma}, \alpha_{\sigma}A) = \boldsymbol{b}_t(x \mid y_{\sigma}, \alpha_{\sigma}A), the conditional probability-flow drift. Off the diagonal, backwards jumps from tt to ss are governed by the Lagrangian condition of section 2, applied conditionally for posterior sampling. Together these two conditions characterize the conditional flow map and lead to BAM's two main training objectives. Note that σy\sigma_y is not supplied to the network in (8). It enters only through the rescaling (7), so vθ\boldsymbol{v}_{\theta} acts partially blindly w.r.t. σy\sigma_y. Since σy\sigma_y is easily estimated from yy, dropping the explicit conditioning costs little and removes an embedding pathway, keeping the architecture lightweight.

The network vθv_{\theta} can be realized by any physics-aware architecture for linear imaging problems, notably deep unfolding architectures, by conditioning on the augmented measurement [xt;yσ][x_t; y_{\sigma}] and the stacked forward operator [(1−t)Id;ασA][(1-t)\text{Id}; \alpha_{\sigma}A] supplied at inference time. For BAM we adopt a RAM backbone, which embeds the unfolding philosophy in a DRUNet, and assign its two noise-level embeddings to input tt and ss (see sections B and D.2 for architecture details and ablations).

Training. As mentioned previously, BAM relies on the following two flow map training objectives. On the diagonal (t=s)(t = s), the velocity is fitted to the interpolant slope by minimizing

Lb(θ)=E[∥vθ(xt,t,t,yσ,A)−(z−x0)∥22].(9)\mathcal{L}_{b}(\theta)=\mathbb{E}\Big[\big\|\boldsymbol{v}_{\theta}(\boldsymbol{x}_{t},\boldsymbol{t},\boldsymbol{t},\boldsymbol{y}_{\sigma},\boldsymbol{A})-(\boldsymbol{z}-\boldsymbol{x}_{0})\big\|_{2}^{2}\Big]. \tag{9}

Off diagonal (s<t)(s < t), holding the flow's starting point (xt,t)(x_t, t) and the conditioning (yσ,σA)(y_\sigma, \sigma A) fixed, the endpoint derivative of (8) is

∂sXt,sθ=vθ(xt,t,s,yσ,ασA)+(s−t)∂svθ(xt,t,s,yσ,ασA),(10)\partial_{s}\boldsymbol{X}_{t,s}^{\theta}=\boldsymbol{v}_{\theta}(x_{t},t,s,y_{\sigma},\alpha_{\sigma}A)+(s-t)\partial_{s}\boldsymbol{v}_{\theta}(x_{t},t,s,y_{\sigma},\alpha_{\sigma}A), \tag{10}

which we compare with the diagonal velocity of the EMA teacher at the transported point, i.e.,

LLSD(θ)=E[∥∂sXt,sθ−sg[vθ−(x^t,s,s,s,yσ,A)]∥22],x^t,s:=Xt,sθ(xt∣yσ,σA).(11)\mathcal{L}_{\mathrm{L S D}}(\theta)=\mathbb{E}\Big[\big\|\partial_{s}\boldsymbol{X}_{t,s}^{\theta}-\mathrm{s g}\big[\boldsymbol{v}_{\theta^{-}}(\hat{\boldsymbol{x}}_{t,s},\boldsymbol{s},\boldsymbol{s},\boldsymbol{y}_{\sigma},\boldsymbol{A})\big]\big\|_{2}^{2}\Big],\quad\hat{\boldsymbol{x}}_{t,s}:=\boldsymbol{X}_{t,s}^{\theta}(\boldsymbol{x}_{t}\mid\boldsymbol{y}_{\sigma},\boldsymbol{\sigma}\boldsymbol{A}). \tag{11}

BAM is trained on the flow objective Lb+λLLSD\mathcal{L}_b + \lambda \mathcal{L}_{\text{LSD}}, with the expectations taken over xt=(1−t)x+tz\boldsymbol{x}_t = (1-t)\boldsymbol{x} + t\boldsymbol{z} with x∼px\boldsymbol{x} \sim p_{\boldsymbol{x}} and z∼N(0,Id)\boldsymbol{z} \sim \mathcal{N}(\mathbf{0}, \text{Id}) independent of x\boldsymbol{x}, y∼N(Ax,σ2Id)\boldsymbol{y} \sim N(\boldsymbol{A}\boldsymbol{x}, \sigma^2 \text{Id}) with A∼pA\boldsymbol{A} \sim p_{\boldsymbol{A}} independent of (x,z)(\boldsymbol{x}, \boldsymbol{z}), and t∼U[0,1]t \sim \mathcal{U}[0, 1] and s∣ts|t from (17). Rather than draw σ\sigma independently, we tie it to tt during training through σ(t)=σmax⁡γt/(1−(1−γ)t)\sigma(t) = \sigma_{\max} \gamma t / (1 - (1 - \gamma)t), which increases from 0 to σmax⁡\sigma_{\max} with shape controlled by γ>0\gamma > 0. This concentrates the capacity of the network on the regime where yσy_\sigma and xtx_t carry broadly comparable amounts of noise, a challenging regime where the flow must bend to take both yσy_\sigma and xtx_t into account. Note that sg in (11) stops gradients through the complete teacher evaluation, including its input, and ∂sXt,sθ\partial_s X_{t,s}^\theta is evaluated by an automatic-differentiation Jacobian–vector product that retains the graph needed to optimize it.

The above flow objective is paired with two auxiliary terms, targeting perceptual quality and contrast bias, which act near s≈0s \approx 0. More precisely, the full objective for BAM is

L(θ)=E[λbℓb+λLℓLSD+g(s){λpℓLPIPS(x^t,s,x0)+λcℓctr(x^t,s,x0)}],(12)\mathcal{L}(\theta)=\mathbb{E}\Big[\lambda_{b}\ell_{b}+\lambda_{L}\ell_{\mathrm{L S D}}+g(s)\big\{\lambda_{p}\ell_{\mathrm{L P I P S}}(\hat{\boldsymbol{x}}_{t,s},\boldsymbol{x}_{0})+\lambda_{c}\ell_{\mathrm{c t r}}(\hat{\boldsymbol{x}}_{t,s},\boldsymbol{x}_{0})\big\}\Big], \tag{12}

where g(s)=exp⁡(−4s)g(s) = \exp(-4s) assigns weight to the auxiliary losses only when ss is small, ℓLPIPS\ell_{\text{LPIPS}} is the squeeze-based perceptual loss of Zhang et al. (2018), applied to the clipped output, and ℓctr\ell_{\text{ctr}} compares intensity histograms to penalize contrast bias. The latter provides robustness when training across datasets with differing image statistics, and we set λc=0\lambda_c = 0 after pre-training. No adversarial loss is used at any stage. Sections C, D.3 and D.4, detail the loss functions, their optimization and ablations.

Posterior sampling. Since BAM is trained on the locus where the noise in yσy_\sigma and in xtx_t is balanced, each sampling step should pair the current iterate xtx_t with a draw of the interpolant yσy_\sigma at the matching level σ\sigma. For σ>σy\sigma > \sigma_y, such a draw consistent with yy is obtained by adding the missing noise,

yσ=ασy+ςσ2−ασ2σy2ε,ε∼N(0,Id),(13)\boldsymbol{y}_{\sigma}=\alpha_{\sigma}y+\sqrt{\varsigma_{\sigma}^{2}-\alpha_{\sigma}^{2}\sigma_{y}^{2}}\varepsilon,\qquad\varepsilon\sim\mathcal{N}(\mathbf{0},\mathrm{I d}), \tag{13}

which has noise variance ζσ2\zeta_{\sigma}^2. We hold ε\varepsilon fixed across steps. Sampling follows a decreasing schedule 1=t1>t2>t31 = t_1 > t_2 > t_3, each step noising the current iterate to level tkt_k and mapping it back to s=0s = 0,

xtk=(1−tk)x^(k−1)+tkz(k),z(k)∼N(0,σd2Id),(14)\boldsymbol{x}_{t_{k}}=(1-t_{k})\hat{\boldsymbol{x}}^{(k-1)}+t_{k}\boldsymbol{z}^{(k)},\qquad\boldsymbol{z}^{(k)}\sim\mathcal{N}(\mathbf{0},\sigma_{d}^{2}\mathrm{I d}), \tag{14} x^(k)=xtk−tkvθ(xtk,tk,0,yσk,σkA),(15)\hat{\boldsymbol{x}}^{(k)}=\boldsymbol{x}_{t_{k}}-t_{k}\boldsymbol{v}_{\theta}(\boldsymbol{x}_{t_{k}},t_{k},0,\boldsymbol{y}_{\sigma_{k}},\sigma_{k}A), \tag{15}

where σk=σ(tk)\sigma_k = \sigma(t_k) and t1=1t_1 = 1, so that xt1=z(1)\boldsymbol{x}_{t_1} = \boldsymbol{z}^{(1)} is pure noise and (14) requires no previous iterate. When σy\sigma_y is small, the intermediate level satisfies σ2∈(σy,σ1)\sigma_2 \in (\sigma_y, \sigma_1) and the final step is taken at σ3=σy\sigma_3 = \sigma_y, where no re-noising of the measurement is required. When σy\sigma_y is large, ending at σy\sigma_y would leave a long final jump and thus introduce some sampling bias. Hence, we instead set σ2=σy\sigma_2 = \sigma_y and take the last step at σ3<σy\sigma_3 < \sigma_y, drawing the interpolant by a Brownian bridge between Ax^(2)\mathbf{A}\hat{\boldsymbol{x}}^{(2)} and the rescaled measurement. Each prediction costs one network evaluation and applies Xtk,0θ\mathbf{X}_{t_k,0}^\theta rather than composing consecutive maps. Randomness enters through the initialization, (13), and the re-noising, so independent runs give independent posterior samples.

4 EXPERIMENTS

References (78)