Calibrated Test-Time Guidance for Bayesian Inference

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

Introduction

Diffusion models have established themselves as the gold standard for generating high-quality data, acting as powerful "priors" that describe the underlying distribution of a dataset. In many practical applications—ranging from medical imaging and astronomy to text-to-image editing—practitioners "guide" these models at test-time using a specific task or "reward" function.

However, existing test-time guidance methods primarily focus on maximizing this reward rather than sampling from the true Bayesian posterior. This leads to biased, miscalibrated inference. To address this, researchers have introduced Calibrated Bayesian Guidance (CBG), a framework that utilizes consistent estimators to sample accurately from the posterior, achieving state-of-the-art results in rigorous scientific tasks like black hole imaging.

The Problem: Miscalibrated Inference

In Bayesian inference, the mathematical objective is to sample from a posterior distribution that combines a prior (the diffusion model) with a likelihood (the task or reward).

Current test-time guidance methods, such as Diffusion Posterior Sampling (DPS), rely on structural approximations that introduce fundamental biases. Instead of providing a calibrated distribution of possible solutions, these methods often collapse to a single "best" solution. In scientific fields where quantifying uncertainty is just as critical as the final prediction, this miscalibration is a significant failure point.

Methodology: Calibrated Bayesian Guidance

To resolve the bias inherent in existing methods, the authors propose replacing structural approximations with two types of mathematically consistent estimators:

  1. Gradient-Based CBG: This approach utilizes the "reparameterization trick" to compute the gradient of the diffused likelihood. It is highly effective but requires the reward function to be differentiable.
  2. Gradient-Free CBG: This variant employs a REINFORCE-style estimator. Crucially, it works with non-differentiable rewards and often exhibits lower variance than its gradient-based counterpart due to a self-normalization property.

The Renoising Trick

Standard posterior sampling is computationally prohibitive, requiring nested loops of diffusion steps that scale at $O(KN^2)$ (where $K$ is the number of samples and $N$ is the number of diffusion steps). To make CBG practical, the authors introduce the "renoising trick." By leveraging a pretrained one-step or few-step model to "renoise" and subsequently denoise a sample, they reduce the computational complexity to a much more manageable $O(KN)$.

Key Insights

  • The Consistency Breakthrough: Unlike previous guidance methods that remain biased even given infinite computing power, CBG is mathematically consistent. As the number of samples ($K$) increases, the bias systematically vanishes, converging on the true posterior.
  • The Guidance Scale Trap: In standard diffusion generation, users often artificially inflate a guidance scale ($\gamma$) to improve sample quality. The authors mathematically prove that simply rescaling the gradient is incorrect for true posterior sampling. For calibrated inference, tempering must occur inside the integral of the diffused likelihood.
  • Gradient-Free Superiority: In scenarios with sharp likelihoods, the gradient-free estimator often outperforms the gradient-based approach. By avoiding backpropagation through the diffusion process, it sidesteps the "exploding gradient" issues that frequently plague high-dimensional guidance.

Experimental Results

The researchers evaluated CBG across three distinct domains: synthetic Bayesian benchmarks, black hole imaging (InverseBench), and image domain tasks (ImageNet super-resolution and prompt alignment).

  • Scientific Precision (Black Hole Imaging): CBG established a new state-of-the-art PSNR of 27.08 dB in reconstructing black hole images from sparse radio-telescope measurements, significantly outperforming both traditional imaging methods and previous diffusion guidance techniques.
  • Benchmark Dominance: On the Bayesian Inference Benchmark (which tests the recovery of complex posterior shapes like two-moons or Gaussian mixtures), CBG was the only diffusion-based method to consistently improve its Posterior Quality as the compute budget increased, approaching the optimal score.
  • Qualitative Superiority: In prompt alignment tasks using the SANA model (e.g., generating "exactly six dogs"), baseline methods either failed to count correctly or produced distorted images. CBG successfully generated the precise number of requested objects while maintaining high image fidelity.

Limitations and Future Work

The primary limitation of CBG is the overlap requirement. The framework requires the likelihood function and the prior to have overlapping support. If the likelihood concentrates on a "measure-zero manifold"—a highly specific constraint that the prior never naturally explores—samples from the prior will likely miss the high-likelihood regions entirely.

Future work may explore projecting samples onto high-likelihood manifolds to mitigate this issue. Additionally, while the renoising trick vastly improves efficiency, CBG still requires more samples ($K$) than biased methods to achieve its superior calibration, representing an inherent trade-off between compute time and posterior accuracy.

Summary updated

BibTeX
@inproceedings{geyfman2026calibrated,
  author = {Daniel Geyfman and Felix Draxler and Jan Niklas 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