# nbi: the Astronomer's Package for Neural Posterior Estimation

arXiv: https://arxiv.org/abs/2312.03824 · HTML: https://mlsanity.com/paper/2312.03824/

## Key facts

- Cited by 2 papers in the map (data through 14 Oct 2026).
- Builds on 9 of its 22 references that are in the map.
- First posted on arXiv 6 Dec 2023.

## Builds on (most cited first, 9 of 9)

- [Automatic Posterior Transformation for Likelihood-Free Inference](https://mlsanity.com/paper/1905.07488/) (2019)
- [Neural Importance Sampling](https://mlsanity.com/paper/1808.03856/) (2018)
- [Real-time gravitational-wave science with neural posterior estimation](https://mlsanity.com/paper/2106.12594/) (2021)
- [Neural Importance Sampling for Rapid and Reliable Gravitational-Wave Inference](https://mlsanity.com/paper/2210.05686/) (2022)
- [Inference Networks for Sequential Monte Carlo in Graphical Models](https://mlsanity.com/paper/1602.06701/) (2016)
- [Scalable End-to-end Recurrent Neural Network for Variable star classification](https://mlsanity.com/paper/2002.00994/) (2020)
- [Real-Time Likelihood-Free Inference of Roman Binary Microlensing Events with Amortized Neural Posterior Estimation](https://mlsanity.com/paper/2102.05673/) (2021)
- [Accelerated Bayesian SED Modeling using Amortized Neural Posterior Estimation](https://mlsanity.com/paper/2203.07391/) (2022)
- [Classification of Periodic Variable Stars with Novel Cyclic-Permutation Invariant Neural Networks](https://mlsanity.com/paper/2011.01243/) (2020)

## Built on by (most cited first, 2 of 2)

- [Domain-Adaptive Neural Posterior Estimation for Strong Gravitational Lens Analysis](https://mlsanity.com/paper/2410.16347/) (2024)
- [Stellar Spectra Fitting with Amortized Neural Posterior Estimation and nbi](https://mlsanity.com/paper/2312.05687/) (2023)

## Abstract (arXiv)

Despite the promise of Neural Posterior Estimation (NPE) methods in astronomy, the adaptation of NPE into the routine inference workflow has been slow. We identify three critical issues: the need for custom featurizer networks tailored to the observed data, the inference inexactness, and the under-specification of physical forward models. To address the first two issues, we introduce a new framework and open-source software nbi (Neural Bayesian Inference), which supports both amortized and sequential NPE. First, nbi provides built-in "featurizer" networks with demonstrated efficacy on sequential data, such as light curve and spectra, thus obviating the need for this customization on the user end. Second, we introduce a modified algorithm SNPE-IS, which facilities asymptotically exact inference by using the surrogate posterior under NPE only as a proposal distribution for importance sampling. These features allow nbi to be applied off-the-shelf to astronomical inference problems involving light curves and spectra. We discuss how nbi may serve as an effective alternative to existing methods such as Nested Sampling. Our package is at https://github.com/kmzzhang/nbi.
