BAM! Bayesian Anything Model

Physics-informed generative AI for uncertainty-aware quantitative computational imaging.

Why quantitative imaging matters

Digital images inform decisions with major consequences for the economy, society, and the environment - spanning medical practice, disaster recovery, agriculture, forestry, climate action, quality control, pollution monitoring, and defence. These images are predominantly generated by specialised instruments such as medical scanners, telescopes, and radars, which embody decades of advances in sensor technology and instrumentation engineering.

Beyond state-of-the-art hardware, modern imaging devices rely equally on sophisticated mathematical techniques and computational algorithms to transform raw measurements into high-quality images and extract actionable information. Crucially, these images are not merely visual representations: they are quantitative measurements of high-dimensional physical quantities. A satellite image measuring a vegetation index to estimate water deficit for forest-fire forecasting is one example. Because quantitative images serve as evidence in scientific research and high-stakes decision-making, they must meet stringent standards of accuracy and robustness.

From measurements to uncertainty-aware images

The EPSRC Open Fellowship Learned Quantitative Stochastic Imaging is pioneering a mathematical and computational foundation for the next generation of quantitative imaging technologies. At its core is a physics-informed generative AI framework purpose-built for computational imaging and for transforming image data into robust, uncertainty-aware evidence for science and decision-making.

Drawing an analogy to text-to-image AI, where a model generates a photographic image from a text prompt, these models take as their prompt the raw measurements from a physical instrument, paired with a mathematical description of how that instrument operates. The output is a high-quality reconstruction together with a quantitative estimate of its uncertainty.

BAM: a foundation model for computational imaging

Building on this framework, the Bayesian Anything Model (BAM) is a lightweight generative AI foundation model for quantitative computational imaging. BAM upgrades the operator-conditioned Reconstruct Anything Model (RAM) backbone into a conditional flow map, allowing the imaging physics to be supplied at inference time rather than fixed during training.

The current paper presents a 36-million-parameter model that produces posterior samples in three network evaluations. A single network is trained across image datasets, forward operators, and noise levels, so it can be applied to new imaging problems without retraining - or with only lightweight fine-tuning. This approach is designed to reduce the cost of developing bespoke models for individual instruments and modalities, while supporting trustworthy reconstruction and uncertainty quantification.

By making these ideas accessible through demos and fine-tuning tools, the broader BAM project aims to catalyse research into trustworthy, uncertainty-aware generative AI for computational imaging - from new foundation models to methods for validating them in deployment.

Method

Schematic of the BAM conditional flow map
BAM transports a Gaussian reference to the measurement-conditioned posterior using a conditional flow map. The forward operator and the rescaled measurement are supplied at inference time.

Applications

BAM is evaluated on a range of inverse problems, including:

  • $\times 4$ super-resolution;
  • Gaussian and motion deblurring;
  • inpainting;
  • JPEG restoration;
  • demosaicing and compressed sensing; and
  • sparse-view computed tomography.

The experiments use FFHQ, AFHQ, LSUN, DIV2K, and the Kohler camera-shake benchmark. Across the main benchmark settings, BAM achieves the best perceptual quality in 38 of 40 settings for LPIPS and 36 of 40 settings for CMMD, while using substantially fewer neural function evaluations than competing posterior samplers.

Selected results

The official project page reports the following results:

Result Evidence
Perceptual quality A BAM variant achieves the best LPIPS in 38 of 40 settings and the best CMMD in 36 of 40 settings across four datasets, five problems, and two noise levels.
Efficient inference INT8 TensorRT inference reconstructs a $512 \times 512$ image in 80 ms on an NVIDIA A40, compared with 281 ms before quantisation - a 3.5x speed-up.
Uncertainty quantification After fine-tuning on sparse-view CT, the variation across 64 posterior samples highlights anatomical edges and lung vessels.
Posterior means Averaging repeated BAM samples gives a posterior-mean estimate with higher PSNR than the fine-tuned RAM MMSE model on four of five problems.

Posterior sampling

At each step, BAM combines the current noisy image estimate with a noise-matched version of the measurement and applies one conditional flow-map update. Repeating this process with independent random draws produces independent posterior samples, which can be used both for reconstruction and for uncertainty quantification.

Citation

@misc{spagnoletti2026bam,
  title  = {{BAM!} {B}ayesian {A}nything {M}odel: a foundation model for generative computational imaging},
  author = {Spagnoletti, Alessio and Kemajou Mbakam, Charlesquin and Spence, Jonathan and Almansa, Andr{\'e}s and Pereyra, Marcelo},
  year   = {2026},
  eprint = {2609.39660},
  archivePrefix = {arXiv},
  primaryClass = {cs.CV}
}

The paper is by Alessio Spagnoletti, Charlesquin Kemajou Mbakam, Jonathan Spence, Andres Almansa, and Marcelo Pereyra.