arXiv:2610.08021cs.LGOct 2026

Manuscript Offprint

arXiv:2610.08021

Spectra: Exact Component Transport for Test-Time Prior Adaptation in Simulation-Based Inference

Xin Zhao, Nico Scherf, Robert Trampel, Kerrin J. Pine, Nikolaus Weiskopf

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

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.

1 INTRODUCTION

Bayesian inference estimates unknown model parameters θ\theta from observed data x and quantifies their uncertainty through the posterior p(θ∣x)p(\theta \mid x). For complex scientific models, however, the likelihood p(x∣θ)p(x \mid \theta) is intractable or too costly to evaluate, even though synthetic data can be generated readily from a simulator (Cranmer et al., 2020). This makes standard likelihood-based Markov chain Monte Carlo impractical or unavailable (Robert & Casella, 2004). Simulation-based inference (SBI) instead learns from simulated parameter–observation pairs (Cranmer et al., 2020; Lueckmann et al., 2021). Amortized SBI makes this posterior inference reusable across observations by training an inference model once and applying it to new observations without repeating simulation and training (Greenberg et al., 2019; Gloeckler et al., 2024). This reuse has enabled applications ranging from real-time gravitational-wave inference (Dax et al., 2021; 2025) to cosmological constraints from galaxy clustering (Hahn et al., 2024) and identification of neural circuit configurations from electrophysiological recordings (Gonçalves et al., 2020).

Posterior distributions in scientific applications are often multimodal or strongly correlated, motivating flexible generative posterior models. Diffusion and score-based models generate samples by learning to reverse a gradual noising process (Sohl-Dickstein et al., 2015; Ho et al., 2020; Song et al., 2021), and have been adapted to posterior sampling in SBI (Geffner et al., 2023; Sharrock et al., 2024; Gloeckler et al., 2024). Flow matching and consistency models have also been developed for SBI: flow matching learns time-dependent velocity fields for posterior sampling, while consistency models reduce generation to only a few inference steps (Wildberger et al., 2023; Schmitt et al., 2024). Transformer-based

(a) Prior shift

Figure

(b) Posterior shift

(c) Test-time adaptation

Figure 1: Prior shift and test-time adaptation on the simple likelihood complex posterior (SLCP) task. (a) A concentrated target prior replaces the broad training prior. (b) The frozen model represents the base posterior under the training prior, while the target prior concentrates posterior mass on two of its four modes. (c) Both PriorGuide and Spectra recover the target modes. However, PriorGuide retains visible mass outside the target contours, whereas Spectra follows the target geometry more closely. The posterior panels show the (θ3,θ4)(\theta_3, \theta_4) projection. Full results across tasks and observations are reported in Table 1 and Figure 3.

approaches can amortize across datasets by conditioning on a dataset provided as context at inference time, allowing a single model to be reused across datasets and tasks (Müller et al., 2022; Chang et al., 2025; Mittal et al., 2025; Whittle et al., 2026). In the standard fixed-prior setting considered here, training pairs are generated by drawing θ\theta from a chosen prior πtr\pi_{\mathrm{tr}} and then simulating x∼p(x∣θ)x \sim p(x \mid \theta). This amortization therefore applies across observations, but only under the training prior πtr\pi_{\mathrm{tr}}.

However, the prior fixed at training time is rarely the only one needed in a scientific analysis. In gravitational-wave astronomy, population-level observations can inform priors for individual events (Moore & Gerosa, 2021), while assumptions about black-hole masses and spins can change the inferred properties of a source (Vitale et al., 2017). The same issue appears in other fields: fossil-calibration priors affect estimates of species divergence times in evolutionary biology (Warnock et al., 2015), and prior-sensitivity analyses in cognitive science examine how evidence for competing models varies with the prior (Elsemüller et al., 2024). Priors may therefore need to change both as new information becomes available and as researchers test the robustness of their conclusions to alternative assumptions (Gelman et al., 2020). A single study may consequently require posterior inference under several plausible priors.

Each of these posteriors could be computed separately using a non-amortized inference procedure or by retraining the amortized model, but both options forgo much of the benefit of amortization. Retraining, in particular, repeats costly simulation and optimization for every new prior. Importance sampling can instead reweight samples from the original posterior, but becomes inefficient when the new posterior concentrates in regions poorly covered by the original samples (Agapiou et al., 2017). Another way to avoid per-prior retraining is to train across a family of priors, but test-time flexibility is constrained by the prior representation built into the model during training (Elsemüller et al., 2024; Chang et al., 2025; Whittle et al., 2026). In-context SBI with tabular foundation models avoids task-specific retraining, but still requires suitable simulated examples as context at inference time (Hollmann et al., 2025; Vetter et al., 2025). For an already trained diffusion-SBI model, recent methods adapt the prior at test time, either through an approximate sampling correction (Yang et al., 2026) or by training an auxiliary correction model for each target prior (Zang et al., 2026). For this setting, an effective adapter must remain accurate under substantial prior shifts, add little inference-time cost, and require neither additional simulation nor retraining.

We introduce Spectra, a test-time method for adapting pretrained diffusion-SBI models while leaving both the simulator and the trained model unchanged. Because diffusion sampling repeatedly queries the score network across noise levels, prior adaptation requires the corresponding score under the revised prior. Spectra obtains this score by exploiting analytic structure in the known prior change, using a single transformed query to the frozen model. For isotropic exponential–quadratic prior-ratio factors, this transformation is exact. Positive mixtures of such factors extend the construction to richer prior changes. Figure 1 illustrates the adaptation problem and a representative result on one benchmark task. Our main contributions are:

• Exact score transport and characterization. For prior changes that reweight the training prior by an isotropic exponential–quadratic factor, the adapted diffusion score follows exactly from one frozen-model query at a transformed state and noise level, without a score Jacobian or any Gaussian assumption on the base posterior. We further prove that, within this affine Gaussian transport construction, isotropic exponential–quadratic factors are the only positive reweightings that admit such an exact mapping.

• Composition of richer prior changes. Richer prior changes can be represented as positive mixtures of transportable factors, yielding mixtures of exactly transported posterior components. For a fixed observation, Spectra estimates the component weights once and samples one component per reverse trajectory. Online sampling therefore still requires only one frozen-score evaluation per reverse step, independent of the number of components.

• Accuracy and efficiency. Across six SBI benchmarks, Spectra remains accurate under strong prior shifts and for mixture priors while keeping one frozen-score query per reverse step. Compared with a strengthened version of PriorGuide, the closest test-time method, its accuracy gains are largest on nonlinear problems, and its online sampling is 2.4−3.2×2.4-3.2\times faster.

References (51)