Simulation-based inference with neural posterior estimation applied to X-ray spectral fitting - III Deriving exact posteriors with dimension reduction and importance sampling
Didier Barret, Simon Dupourqué
TL;DR
The paper demonstrates that simulation-based inference using neural posterior estimation, when combined with auto-encoder–based spectrum compression and likelihood-based importance sampling, can recover exact posterior distributions for complex X-ray spectral models at large speedups. The SIXSA pipeline iteratively refines the posterior through multi-round inferences with truncated proposals and employs a neural likelihood emulator to accelerate importance sampling, achieving posteriors statistically indistinguishable from nested sampling or BXA references. Across synthetic tests and XRISM-Resolve data, SIXSA outperforms traditional dimensionality reduction like PCA and remains robust to model complexity and degeneracies, enabling practical Bayesian X-ray spectral fitting on standard laptops. The approach preserves narrow spectral features, scales across instruments, and provides diagnostics to assess information retention and convergence, with an open-source SIXSA package for community use and further development.
Abstract
Simulation-based inference (SBI) with neural posterior estimation (NPE) provides rapid X-ray spectral fitting in both Gaussian and Poisson regimes by learning approximate parameter posteriors from simulations. We investigate auto-encoders for compressing high-resolution X-ray spectra, motivated by newAthena X-ray Integral Field Unit (X-IFU), and use likelihood-based importance sampling to refine NPE outputs. Our auto-encoder maps spectra to a low-dimensional latent space and is trained with a custom loss equal to the Cash statistic (C-stat) between simulated and reconstructed spectra. A neural density estimator is then trained on the latent representations. Both models are trained in multiple rounds: at each round, new simulations are drawn from a truncated proposal concentrated around the observation, improving efficiency as the proposal contracts. After NPE convergence, we apply likelihood-based importance sampling to correct the learned posterior. To assess information retention, we train a diagnostic network that predicts the original spectral parameters from the latent space, and we also train a network to learn the likelihood directly to accelerate importance sampling. On X-IFU-like simulations, the auto-encoder and multi-round NPE outperforms PCA and hand-crafted spectral summaries in accuracy and robustness. After importance sampling, the resulting posteriors are statistically indistinguishable from those obtained with nested sampling. On a standard laptop, the full pipeline (simulation, compression, inference, correction) delivers 10x speedups. We further demonstrate the approach on XRISM/Resolve and on lower-resolution NICER and XMM-Newton EPIC-pn data, confirming applicability across instruments and resolutions. Overall, NPE on compressed spectra paired with likelihood-based importance sampling offers an exact yet efficient alternative for Bayesian X-ray spectral fitting.
