Calibrated Test-Time Guidance for Bayesian Inference

Daniel Geyfman, Felix Draxler, Jan Groeneveld, Hyunsoo Lee, Theofanis Karaletsos, Stephan Mandt

Abstract

Test-time guidance is a widely used mechanism for steering pretrained diffusion models toward outcomes specified by a reward function. Existing approaches, however, focus on maximizing reward rather than sampling from the true Bayesian posterior, leading to miscalibrated inference. In this work, we show that common test-time guidance methods do not recover the correct posterior distribution and identify the structural approximations responsible for this failure. We then propose consistent alternative estimators that enable calibrated sampling from the Bayesian posterior. We significantly outperform previous methods on a set of Bayesian inference tasks, and match state-of-the-art in black hole image reconstruction.

Introduction

Diffusion models have emerged as powerful generative priors, yet steering them to satisfy specific constraints—a process known as test-time guidance—remains a challenge for rigorous Bayesian inference. While methods like Diffusion Posterior Sampling (DPS) are popular for solving inverse problems, they often rely on structural approximations that lead to statistically miscalibrated samples. This paper introduces Calibrated Bayesian Guidance (CBG), a framework that replaces these biased shortcuts with consistent estimators, enabling true posterior sampling for scientific and high-stakes applications.

The Failure of Common Approximations

Most existing guidance techniques attempt to estimate the likelihood of a noisy intermediate state $x_t$ by approximating the distribution of the clean data $x_0$ given $x_t$. A common shortcut is to assume this distribution is a point mass at the posterior mean (the model's current best guess for the clean image).

The authors prove that this "posterior mean approximation" introduces a systematic bias that persists regardless of the number of diffusion steps. As shown in Figure 1, while the proposed Diffusion Posterior (CBG) accurately recovers the multi-modal tempered posterior, existing methods like DPS or Gaussian approximations ($\Pi$GDM) either shift the mean incorrectly or collapse the variance, failing to represent the true uncertainty of the problem.

Comparison of guidance methods on a multi-modal distribution. CBG (ours) accurately captures the posterior, while others exhibit significant bias or variance collapse.

Calibrated Bayesian Guidance (CBG)

To resolve these issues, CBG employs consistent estimators for the diffused likelihood. The framework offers two primary implementations:

  1. Gradient-Based CBG: Utilizes the reparameterization trick to compute gradients of the diffused likelihood, requiring a differentiable reward function.
  2. Gradient-Free CBG: Employs a self-normalized importance sampling (REINFORCE-style) estimator. This allows guidance by non-differentiable objectives, such as complex scientific simulators or discrete reward functions.

Crucially, CBG is mathematically consistent: as the number of internal samples $K$ increases, the approximation converges to the exact Bayesian posterior. The authors also identify a "scaling fallacy" in current literature, demonstrating that the standard practice of scaling gradients by a factor $\\gamma$ does not result in a valid tempered posterior unless the scaling is integrated directly into the likelihood estimation.

Experimental Results

The researchers validated CBG across a variety of tasks, ranging from synthetic benchmarks to real-world scientific imaging.

Bayesian Inference Benchmark

On a suite of tasks designed to test distributional fit (e.g., the "two-moons" distribution), CBG achieved near-perfect scores on the Classifier 2-Sample Test (C2ST). A score of 0.5 indicates that the generated samples are statistically indistinguishable from the ground truth. While previous methods plateaued at higher scores, CBG continued to improve as more compute (larger $K$) was applied.

Black Hole Image Reconstruction

In a high-stakes application, CBG was used to reconstruct black hole images from sparse interferometric data. This task is a classic inverse problem where capturing the correct ring structure and uncertainty is vital. CBG achieved a state-of-the-art PSNR of 26.10, outperforming traditional imaging algorithms and previous diffusion-based methods.

Qualitative comparison of black hole image reconstructions. CBG produces sharper, more faithful results compared to the blurred or distorted outputs of previous methods.

Conclusion and Future Work

Calibrated Bayesian Guidance provides a theoretically sound foundation for steering diffusion models. By moving away from biased point-estimates toward consistent integral approximations, it enables reliable uncertainty quantification in scientific domains. The primary trade-off is computational; CBG requires multiple model evaluations per diffusion step. Future research into distilling these calibrated signals into faster, few-step models could make this rigorous approach viable for real-time applications.

Summary updated

BibTeX
@inproceedings{geyfman2026calibrated,
  author = {Daniel Geyfman and Felix Draxler and Jan Groeneveld and Hyunsoo Lee and Theofanis Karaletsos and Stephan Mandt},
  title = {{Calibrated Test-Time Guidance for Bayesian Inference}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=NZvWGf2XXM},
}
Figure