Simulation-Based Inference (SBI) serves as a vital framework for parameter inference in scientific fields where simulators involve intractable likelihoods, yet while amortized generative models offer rapid posterior estimation, they are often restricted by the specific priors used during training, thereby limiting their flexibility as prior knowledge evolves. To address this prior dependency, PriorGuide was introduced as an inference-time guidance method, but due to its intractable formulation, it relies on Gaussian approximations of the reverse transition kernel and Gaussian mixture model fitting for the prior ratio, both of which introduce systematic bias. Motivated by these limitations, we propose an unbiased test-time guidance framework that leverages Density Ratio Estimation (DRE) to learn a score guidance term, effectively decoupling the inference process from the prior training. Moreover, our framework remains agnostic to the specific density ratio estimators, making it a general and flexible framework for handling prior changes. Experimental results across multiple tasks demonstrate that our method matches or outperforms PriorGuide on C2ST and MMD in most tasks while maintaining robustness even under limited overlap between the training and target priors. Furthermore, we apply our method to Bayesian updating for parameter inference from planetary light-curve data, where it also demonstrates strong effectiveness and robustness. Code is available at https://github.com/a-chenchen/dre-based-prior-guidance .
Figures & tables
Figure 1: Two-dimensional Posterior approximations under prior shift for Ornstein-Uhlenbeck Process. Grey shading denotes the true posterior; dashed contour the base model; colored contours our method and PriorGuide after guidance. Our method closely tracks the truth while PriorGuide exhibits deviation.
Figure 2: C2ST scores ( ↓ better, chance level = 0.5) across five benchmark tasks under ID and OOD settings. Our methods (NRE and KLIEP) are best or not significantly worse than the best method on most tasks, with the largest gains under OOD shift; Two Moons and Turin are exceptions, analysed in Appendix I .
Figure 3: Posterior predictive comparison on time series forecasting. (a) OUP (OOD), (b) Turin (ID). Solid lines show predictive means, dashed lines and shaded regions indicate 95% confidence intervals. Black lines represent observed data (solid) and ground truth (dashed). Vertical line marks the prediction boundary.
Figure 4: Sequential posterior evolution for WASP-39b over 5 observations. The n -th row shows p(θ∣x(1:n)) for parameters k , a , inc, and P . Grey: prior; red dashed: reference value from ( 8 ) .
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
Method
g(v)
Optimal h⋆
NRE
−log(1−ev)
logp+qq
Pearson χ2
41v2+v
2(pq−1)
Reverse KL
−1−log(−v)
−p/q
Hellinger
1−vv
1−p/q
Appendix
Table 1: Instantiations of the generalized DRE framework. Various choices of the convex generator g(v) induce distinct variational objectives, yet they consistently recover the same optimal density ratio q/p .
Algorithm 1 Sequential Posterior Update via DRE-based Diffusion Guidance
ID
OOD
C2ST
MMD
WS-2
RMSE
C2ST
MMD
WS-2
RMSE
Two Moons
Simformer
0.79(0.02)
0.34(0.06)
0.68(0.43)
0.71(0.42)
0.69(0.06)
0.01(0.01)
0.25(0.24)
1.04(0.89)
PriorGuide
0.68(0.01)
0.01(0.00)
0.15(0.10)
0.20(0.08)
0.71(0.06)
0.00(0.01)
0.14(0.12)
1.03(0.86)
WSM
0.91(0.02)
0.28(0.06)
4.79(3.63)
5.01(3.70)
0.86(0.03)
0.03(0.03)
0.34(0.11)
1.10(0.78)
Ours (NRE)
0.69(0.01)
0.02(0.00)
0.16(0.08)
0.21(0.06)
0.72(0.06)
0.00(0.01)
0.15(0.11)
1.03(0.86)
Ours (KLIEP)
0.69(0.01)
0.01(0.00)
0.15(0.08)
0.20(0.06)
0.72(0.06)
0.01(0.01)
0.20(0.16)
1.03(0.86)
Appendix
Table 2: Posterior inference performance ( θ ) under prior shift. Mean (standard dev.) over 10 simulated observations, where each observation’s value is averaged over 3 independent runs. Bold indicates the best result or one not significantly worse than the best (one-sided Wilcoxon signed-rank test paired by observation, p>0.05 ). Gray rows are shown for reference only and are excluded from the comparison. All evaluation metrics are computed using 5,000 posterior samples per method run: C2ST, MMD, and W2 are calculated between these 5,000 generated samples and 5,000 reference (ground-truth) posterior samples, while RMSE is computed between the 5,000 generated samples and the true parameters θ∗ .
RMSE
ID
OOD
OUP
Simformer
0.54(0.10)
0.59(0.15)
PriorGuide
0.82(0.57)
1.18(1.06)
WSM
0.55(0.10)
0.66(0.24)
Ours (NRE)
0.56(0.12)
0.60(0.13)
Ours (KLIEP)
0.56(0.12)
0.61(0.15)
Appendix
Table 3: Posterior predictive RMSE. Mean (standard dev.) over 10 simulated observations, where each observation’s value is averaged over 3 independent runs. Bold indicates the best result or one not significantly worse than the best (one-sided Wilcoxon signed-rank test paired by observation, p>0.05 ). Gray rows are shown for reference only and are excluded from the comparison.
Figure 5: Posterior predictive results across all tasks and observation sets. Each row corresponds to a task setting (OUP ID, OUP OOD, Turin ID, Turin OOD), and each column shows one of the first five observations. Solid lines denote predictive means, while dashed lines and shaded regions indicate 95% confidence intervals. Black curves represent observed data (solid) and ground truth (dashed). The vertical line marks the prediction boundary.
ESS/N
Task
ID
OOD
Two Moons
0.913
0.990
OUP
0.957
0.487
SLCP
0.854
0.127
Gaussian Linear 6D
0.574
0.209
Turin
0.642
0.006
Appendix
Table 4: Effective sample fraction ESS/N of the prior-ratio weights wi=q(θ(i))/p(θ(i)) over base-model posterior samples.
Figure 6: Example observation sequence for WASP-39 b. Each window xobs(n) is a normalized light-curve segment centered on a transit event; the five segments x1,…,x5 are incorporated sequentially in the posterior updates shown in Figure 4 .
Index
Parameter
Description
Mean ( μ )
Std ( σ )
0
⋆
k
Planet-to-star radius ratio
0.10
0.04
1
⋆
a
Scaled semi-major axis ( a/R∗ )
10.0
3.0
2
⋆
inc
Orbital inclination (deg)
87.5
2.0
3
⋆
P
Orbital period (days)
3.6
0.8
4
t0
Transit midpoint offset (days)
0.0
0.05
5
u1
Limb-darkening coefficient 1
0.35
0.08
Appendix
Table 5: Training prior specifications for the light curve task. Parameters marked with ⋆ are the primary parameters of interest.
Figure 7: Sequential posterior evolution for the GJ 436 b system (reference value from [ 16 ] ). Layout and notation follow Figure 4 .
Figure 8: Sequential posterior evolution for the WASP-126 b system (reference value from [ 24 ] ). Layout and notation follow Figure 4 .
Figure 9: Normalized posterior RMSE across sequential observations for three exoplanet systems, computed using the transit parameters k , a , inc, and P (normalized per parameter, then averaged). Our method maintains stable error across sequential updates, while PriorGuide exhibits progressively increasing error.
Simulation-based inference (SBI) has become a powerful approach to Bayesian inference in complex scientific models whose likelihoods are difficult or impossible to evaluate. Amortized SBI learns reusable inference models from simulated data, enabling rapid posterior inference for new observations, and modern generative models have made these models increasingly expressive. However, this reuse is limited to the prior distribution chosen during training, whereas scientific analyses often need revised priors as knowledge accumulates or alternative assumptions are tested. We introduce Spectra, a test-time adaptation method for diffusion-based SBI. Spectra uses an exact score-transport identity to obtain the adapted score from a frozen diffusion model in closed form for structured prior changes, without additional simulation or training. Across six SBI benchmarks, Spectra achieves accurate adaptation under strong prior shifts at low online sampling cost. This enables pretrained SBI models to incorporate updated prior information at test time.
Xin Zhao, Nico Scherf, Robert Trampel +2
Department of Neurophysics, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Germany · International Max Planck Research School on Cognitive NeuroImaging, Leipzig, Germany · Methods and Development Group Neural Data Science and Statistical Computing, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Germany +3
Density ratios quantify distribution shift from a probability-mass point of view, whereas displacement fields describe, from a dynamical point of view, how one distribution is transported onto another. Although both offer complementary insights, they are usually estimated separately, and converting one into the other requires post-processing. In this paper, we estimate the density ratio between a target and a base distribution by parametrizing it through a displacement field acting on the base: the log-ratio is modeled as minus the Stein operator of the base applied to the field, up to a normalizing constant. This gives both statistical and dynamical descriptions of the distribution shift through a single convex optimization problem. Iterating this estimate-and-move step gives two inference algorithms: push-forward moves the model and corrects a pretrained sampler without retraining it, whereas pull-back moves the data closer to the base and fits a transformation model one layer at a time. Applications to distribution shift in simulation-based inference and to nonlinear independent component analysis illustrate the benefits and limitations of the approach.
Bayesian simulation-based inference (SBI) can struggle to recover increasingly concentrated posteriors as observation size grows. We consider learning sufficient summary statistics jointly with the posterior as a general principle for scalable inference in various SBI methods. A common measure taken in SBI is dimension reduction through predetermined summaries, which may partially discard posterior information. Our approach instead imposes structure on how the posterior learner depends on a learned summary (e.g., affinity), and learns the summary simultaneously with the posterior. We identify an important mechanism named two-way guidance: under a structural restriction on the summary, the posterior sufficiency of the learned summary simplifies posterior learning, whereas a suitable posterior objective guides the learned summary towards posterior sufficiency. This mechanism explains a counterintuitive finding that the structural restriction on the summary statistics improves posterior learning, rather than limit its performance. We establish theoretical guarantees on both posterior estimation error and the learned summary's departure from sufficiency, thus identifying conditions on the simulation budget for recovering increasingly concentrated posteriors as observation size grows.
Percy S. Zhai, Max Pachman, Peverel D. Shipley +1
University of Chicago · North Carolina State University