In Bayesian machine learning, a fundamental trade-off exists between the accuracy of domain-specific priors and the computational feasibility of inference. While complex priors—such as sparsity-inducing or diversity-promoting distributions—often better reflect real-world constraints, they typically render inference computationally grueling. Consequently, researchers often settle for "convenient" false priors (e.g., Gaussians) that allow for fast, tractable inference, even at the cost of model fidelity.
This paper introduces Prior Swapping (PS), a framework that resolves this dilemma. Prior Swapping allows practitioners to perform initial inference with a convenient prior and subsequently "swap" it for a complex target prior without re-processing the original dataset. By treating the initial result as a surrogate for the likelihood, PS enables efficient, accurate inference under complex priors at a fraction of the cost of standard data-dependent methods.
The Challenge of Data-Dependent Inference
The core difficulty in Bayesian inference is that the posterior distribution depends on both the prior and the likelihood. Standard algorithms, such as Markov Chain Monte Carlo (MCMC) or Variational Inference (VI), are data-dependent: every iteration requires a pass over the entire dataset. Changing the prior usually necessitates re-running these expensive algorithms from scratch.
A common shortcut is Importance Sampling (IS), which reweights samples from a "false" posterior to approximate a "target" one. However, IS fails spectacularly when the false and target priors are dissimilar. As shown in Figure 1, even with $10^8$ samples, IS can maintain significant error if the distributions lack sufficient overlap.
Prior Swapping: A Data-Independent Framework
The key insight of Prior Swapping is that the initial inference result (the "false posterior") already encapsulates the information from the data. The authors define a prior swap density $p_s(\theta)$:
$$p_s(\theta) \propto \frac{\tilde{p}_f(\theta)\pi(\theta)}{\pi_f(\theta)}$$
Where $\tilde{p}_f$ is the false posterior, $\pi$ is the target prior, and $\pi_f$ is the false prior. Crucially, this expression is independent of the raw data $x^n$. The paper outlines three implementation strategies:
- Prior Swap Exact: Direct MCMC on the swap density when the false posterior has a closed-form PDF.
- Prior Swap Parametric: Fitting a parametric density estimate to samples from the false posterior.
- Prior Swap Semiparametric: Using a parametric start with a non-parametric kernel correction to ensure asymptotic consistency.
Because these methods are data-independent, the computational cost per iteration is $O(1)$ relative to the dataset size, allowing for near-instantaneous updates regardless of the number of observations.
Key Results and Performance
The authors evaluated Prior Swapping across regression, classification, and topic modeling tasks using large-scale datasets like YearPredictionMSD ($n \approx 515,000$) and MiniBooNE ($n \approx 130,000$).
- Speed and Accuracy: In Bayesian linear and logistic regression, Prior Swapping reached near-zero error in seconds, whereas standard IS remained stuck at high error levels. Unlike IS, which is a one-shot reweighting, PS uses the swap density as a target for iterative sampling, allowing it to move toward high-probability regions of the target posterior.
- Scalability: While standard MCMC and VI wall times grow with dataset size $n$, Prior Swapping's wall time remains flat once the initial false posterior is computed.
- Complex Priors: PS successfully applied diversity-promoting priors to LDA topic models, merging redundant topics into distinct, meaningful clusters without re-running the full LDA pipeline.
Conclusion
Prior Swapping offers a powerful paradigm shift for Bayesian practitioners. By decoupling data processing from prior selection, it allows for iterative hypothesis testing and the use of sophisticated priors that were previously considered too expensive. While the method's success depends on the quality of the initial false posterior and the accuracy of density estimation, it provides a scalable path forward for fast inference in large-scale Bayesian models.
Summary updated