Variational Inference as an alternative to MCMC for parameter estimation and model selection
Most applications of Bayesian Inference for parameter estimation and model selection in astrophysics involve the use of Monte Carlo techniques such as Markov Chain Monte Carlo (MCMC) and nested sampling. However, these techniques are time consuming and their convergence to the posterior could be difficult to determine. In this work, we advocate Variational inference as an alternative to solve the above problems, and demonstrate its usefulness for parameter estimation and model selection in Astrophysics. Variational inference converts the inference problem into an optimization problem by approximating the posterior from a known family of distributions and using Kullback-Leibler divergence to characterize the difference. It takes advantage of fast optimization techniques, which make it ideal to deal with large datasets and makes it trivial to parallelize on a multicore platform. We also derive a new approximate evidence estimation based on variational posterior, and importance sampling technique called posterior weighted importance sampling for the calculation of evidence (PWISE), which is useful to perform Bayesian model selection. As a proof of principle, we apply variational inference to five different problems in astrophysics, where Monte Carlo techniques were previously used. These include assessment of significance of annual modulation in the COSINE-100 dark matter experiment, measuring exoplanet orbital parameters from radial velocity data, tests of periodicities in measurements of Newton’s constant $G$, assessing the significance of a turnover in the spectral lag data of GRB 160625B and estimating the mass of a galaxy cluster using weak gravitational lensing. We find that variational inference is much faster than MCMC and nested sampling techniques for most of these problems while providing competitive results. All our analysis codes have been made publicly available.
💡 Research Summary
The paper addresses a fundamental bottleneck in modern astrophysical data analysis: the computational cost and convergence diagnostics associated with Bayesian inference methods that rely on Markov Chain Monte Carlo (MCMC) and nested sampling. While these Monte‑Carlo techniques have become the de‑facto standard for parameter estimation and model comparison across a wide range of astronomical problems, they scale poorly with data volume and dimensionality, often requiring extensive tuning of proposal distributions, step sizes, burn‑in periods, and convergence checks such as Gelman‑Rubin statistics.
To overcome these limitations, the authors propose Variational Inference (VI) as a fast, optimization‑based alternative. In VI the posterior (p(\theta|D)) is approximated by a tractable family (q_{\phi}(\theta)) (typically a multivariate Gaussian) and the Kullback‑Leibler divergence (\mathrm{KL}(q_{\phi}|p)) is minimized by maximizing the Evidence Lower Bound (ELBO). The paper adopts Automatic Differentiation Variational Inference (ADVI), which leverages automatic differentiation and stochastic gradient optimizers (e.g., Adam) to update the variational parameters (\phi) efficiently, even on GPU‑accelerated hardware.
A known drawback of VI is that it provides only a lower bound on the marginal likelihood (evidence) and can underestimate posterior uncertainties. To remedy this, the authors introduce Posterior Weighted Importance Sampling (PWISE). PWISE treats the variational posterior as an importance proposal distribution and re‑weights samples by the ratio (p(\theta|D)/q_{\phi}(\theta)), yielding an unbiased estimator of the evidence that is comparable in accuracy to nested sampling or annealed importance sampling but far cheaper to compute.
The methodology is demonstrated on five distinct astrophysical case studies that previously relied on MCMC or nested sampling:
-
COSINE‑100 dark‑matter annual modulation – testing the significance of a yearly sinusoidal signal. VI converged in ~30 minutes versus tens of hours for MCMC, and Bayes factors from PWISE matched those from nested sampling.
-
Exoplanet radial‑velocity (RV) orbital parameters – simultaneous inference of multiple planetary Keplerian elements. The variational posterior’s means and credible intervals were virtually identical to MCMC results, while runtime dropped from ~2 h to ~5 min.
-
Periodicity tests in measurements of Newton’s constant (G) – comparing a periodic model to a null model across heterogeneous experimental data. PWISE evidence estimates agreed with nested sampling, and VI provided rapid initial exploration of the parameter space.
-
Spectral‑lag transition in GRB 160625B – model comparison between a continuous lag evolution and a model with a sharp turnover. VI identified the turnover parameters quickly, and the resulting Bayes factor favored the turnover model similarly to the nested‑sampling analysis.
-
Weak‑lensing mass estimation of a galaxy cluster – inference of a multi‑parameter mass profile from thousands of background galaxy shapes. ADVI exploited GPU parallelism to achieve convergence within a few hours, whereas traditional MCMC required several days.
Across all examples, VI delivered speed‑ups ranging from an order of magnitude to three orders of magnitude without sacrificing scientific accuracy. The variational posteriors reproduced the central estimates and uncertainties of MCMC, and the PWISE evidence estimator provided reliable model‑selection metrics.
The authors also emphasize reproducibility: all analysis code, data preprocessing scripts, and notebooks are publicly released via a GitHub repository. This openness invites the broader astrophysics community to adopt VI for large‑scale problems, especially those involving high‑dimensional parameter spaces or massive datasets where traditional Monte‑Carlo methods become prohibitive.
In summary, the paper demonstrates that Automatic Differentiation Variational Inference, complemented by Posterior Weighted Importance Sampling for evidence estimation, constitutes a practical, scalable, and accurate alternative to MCMC and nested sampling for both parameter estimation and Bayesian model comparison in modern astrophysics.
Comments & Academic Discussion
Loading comments...
Leave a Comment