SBI++: Flexible, Ultra-fast Likelihood-free Inference Customized for Astronomical Applications

Bingjie Wang, Joel Leja, V. Ashley Villar, Joshua S. Speagle

Research output: Contribution to journalArticlepeer-review

3 Scopus citations


Flagship near-future surveys targeting 108-109 galaxies across cosmic time will soon reveal the processes of galaxy assembly in unprecedented resolution. This creates an immediate computational challenge on effective analyses of the full data set. With simulation-based inference (SBI), it is possible to attain complex posterior distributions with the accuracy of traditional methods but with a >104 increase in speed. However, it comes with a major limitation. Standard SBI requires the simulated data to have characteristics identical to those of the observed data, which is often violated in astronomical surveys due to inhomogeneous coverage and/or fluctuating sky and telescope conditions. In this work, we present a complete SBI-based methodology, SBI++, for treating out-of-distribution measurement errors and missing data. We show that out-of-distribution errors can be approximated by using standard SBI evaluations and that missing data can be marginalized over using SBI evaluations over nearby data realizations in the training set. In addition to the validation set, we apply SBI++ to galaxies identified in extragalactic images acquired by the James Webb Space Telescope, and show that SBI++ can infer photometric redshifts at least as accurately as traditional sampling methods—and crucially, better than the original SBI algorithm using training data with a wide range of observational errors. SBI++ retains the fast inference speed of ∼1 s for objects in the observational training set distribution, and additionally permits parameter inference outside of the trained noise and data at ∼1 minute per object. This expanded regime has broad implications for future applications to astronomical surveys. (Code and a Jupyter tutorial are made publicly available at

Original languageEnglish (US)
Article numberL10
JournalAstrophysical Journal Letters
Issue number1
StatePublished - Jul 1 2023

All Science Journal Classification (ASJC) codes

  • Astronomy and Astrophysics
  • Space and Planetary Science

Cite this