BAM! Bayesian Anything Model: a foundation model for generative computational imaging
Organizations: Laboratoire MAP5, UMR 8145, Université Paris Cité, CNRS · Heriot-Watt University, School of Mathematical and Computer Sciences & Maxwell Institute for Mathematical Sciences
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.) 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 Kohler 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/
Figures & tables
| Method | NFEs | DIV2K | FFHQ | ||||||
|---|---|---|---|---|---|---|---|---|---|
| PSNR | LPIPS | CMMD | FID | PSNR | LPIPS | CMMD | FID | ||
| Gaussian deblurring | |||||||||
| BAM | 3 | 24.48 | 0.35 | 0.06 | 34.4 | 29.63 | 0.25 | 0.10 | 45.0 |
| BAM | 3 | 24.44 | 0.35 | 0.04 | 35.6 | 30.16 | 0.25 | 0.08 | 51.6 |
| RAM | 1 | 25.63 | 0.43 | 0.44 | 52.6 | 30.54 | 0.35 | 1.15 | 94.7 |
| RAM | 1 | 26.00 | 0.42 | 0.34 | 47.0 | 31.53 | 0.34 | 1.07 | 92.4 |
Appendix figures & tables29 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | NFEs | PSNR | LPIPS | CMMD | FID |
|---|---|---|---|---|---|
| Gaussian deblurring | |||||
| BAM 1-step | 1 | 26.56 | 0.323 | 0.334 | 54.38 |
| BAM 2-step | 2 | 29.68 | 0.249 | 0.149 | 42.07 |
| BAM 3-step | 3 | 30.63 | 0.232 | 0.089 | 40.63 |
| SR | |||||
| BAM 1-step | 1 | 26.52 | 0.344 | 0.386 | 58.85 |
| Method | NFEs | PSNR | LPIPS | CMMD | FID |
|---|---|---|---|---|---|
| Gaussian deblurring | |||||
| BAM 1-step | 1 | 26.53 | 0.324 | 0.329 | 54.55 |
| BAM 2-step | 2 | 28.97 | 0.251 | 0.158 | 43.36 |
| BAM 3-step | 3 | 29.63 | 0.250 | 0.099 | 44.98 |
| SR | |||||
| BAM 1-step | 1 | 26.54 | 0.346 | 0.396 | 58.14 |
| Method | NFEs | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| PSNR | LPIPS | CMMD | FID | PSNR | LPIPS | CMMD | FID | ||
| Deblurring | |||||||||
| BAM | 3 | 27.41 | 0.336 | 0.23 | 33.52 | 26.89 | 0.354 | 0.26 | 35.62 |
| BAM | 3 | 26.85 | 0.294 | 0.18 | 23.89 | 26.41 | 0.311 | 0.19 | 24.21 |
| RAM | 1 | 27.85 | 0.417 | 1.17 | 52.11 | 27.46 | 0.444 | 1.41 | 60.40 |
| LATINO | 8 | 23.37 | 0.440 | 0.48 | 64.81 | 21.48 | 0.486 | 0.50 | 71.87 |
| Method | NFEs | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| PSNR | LPIPS | CMMD | FID | PSNR | LPIPS | CMMD | FID | ||
| Deblurring | |||||||||
| BAM | 3 | 25.01 | 0.334 | 0.04 | 33.51 | 24.48 | 0.349 | 0.06 | 34.43 |
| BAM | 3 | 24.91 | 0.339 | 0.03 | 33.80 | 24.44 | 0.353 | 0.04 | 35.59 |
| RAM | 1 | 26.08 | 0.401 | 0.37 | 41.35 | 25.63 | 0.427 | 0.44 | 52.55 |
| LATINO | 8 | 23.29 | 0.473 | 0.28 | 74.62 | 22.00 | 0.514 | 0.39 | 100.27 |
| Method | NFEs | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| PSNR | LPIPS | CMMD | FID | PSNR | LPIPS | CMMD | FID | ||
| Deblurring | |||||||||
| BAM | 3 | 30.63 | 0.232 | 0.09 | 40.63 | 29.63 | 0.250 | 0.10 | 44.98 |
| BAM | 3 | 31.17 | 0.225 | 0.08 | 47.33 | 30.16 | 0.245 | 0.08 | 51.61 |
| RAM | 1 | 31.07 | 0.327 | 0.94 | 83.37 | 30.54 | 0.351 | 1.15 | 94.74 |
| RAM | 1 | 32.31 | 0.316 | 0.85 | 82.58 | 31.53 | 0.341 | 1.07 | 92.38 |
| Method | NFEs | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| PSNR | LPIPS | CMMD | FID | PSNR | LPIPS | CMMD | FID | ||
| Deblurring | |||||||||
| BAM | 3 | 25.78 | 0.154 | 1.86 | 89.35 | 25.38 | 0.160 | 2.15 | 90.52 |
| BAM | 3 | 26.16 | 0.155 | 1.02 | 49.41 | 25.79 | 0.160 | 1.26 | 48.28 |
| RAM | 1 | 25.97 | 0.213 | 1.92 | 77.53 | 25.58 | 0.239 | 2.20 | 87.09 |
| RAM | 1 | 27.25 | 0.304 | 1.87 | 76.90 | 26.59 | 0.333 | 2.11 | 86.54 |
| Known kernel | Spatially varying | |||||||
|---|---|---|---|---|---|---|---|---|
| Method | PSNR | LPIPS | CMMD | FID | PSNR | LPIPS | CMMD | FID |
| BAM | 25.81 | 0.329 | 0.05 | 40.56 | 23.37 | 0.340 | 0.20 | 40.32 |
| RAM | 27.49 | 0.355 | 0.25 | 45.84 | 22.85 | 0.388 | 0.50 | 50.80 |
| Method | PSNR | LPIPS | CMMD | FID |
|---|---|---|---|---|
| BAM | 16.14 | 0.746 | 2.11 | 312.88 |
| BAM | 30.95 | 0.236 | 0.12 | 43.10 |
| RAM | 8.96 | 0.826 | 2.41 | 377.62 |
| RAM | 30.44 | 0.424 | 0.63 | 103.79 |
| SILO | 23.54 | 0.446 | 0.83 | 110.87 |
| UD2M | 30.95 | 0.283 | 0.42 | 55.71 |
| Problem | BAM PSNR(mean) | BAM mean PSNR | RAM |
|---|---|---|---|
| Deblurring | 32.49 | 30.61 | 32.31 |
| Super-resolution | 31.57 | 29.97 | 32.36 |
| Inpainting | 34.20 | 32.90 | 33.36 |
| Demosaicing | 38.10 | 36.44 | 37.36 |
| Compressed sensing | 36.18 | 34.58 | 33.74 |
| Model | Latency (ms) | Throughput (qps) | PSNR | LPIPS |
|---|---|---|---|---|
| Baseline | 280.56 | 3.56 | 22.49 | 0.400 |
| INT8-Optimized | 79.91 | 12.51 | 21.20 | 0.427 |