Skip to main content
QUICK REVIEW

[Paper Review] JAXNS: a high-performance nested sampling package based on JAX

Joshua G. Albert|arXiv (Cornell University)|Dec 30, 2020
Gaussian Processes and Bayesian InferenceComputer Science11 references4 citations
TL;DR

JAXNS is a high-performance nested sampling package built on JAX and XLA primitives, achieving 2–3 orders of magnitude faster evidence computation than PolyChord, MultiNEST, and dynesty while preserving accuracy. It leverages static-memory computation and JIT compilation to accelerate likelihood evaluations across diverse Bayesian inference problems, enabling practical use in machine learning and data science.

ABSTRACT

Since its debut by John Skilling in 2004, nested sampling has proven a valuable tool to the scientist, providing hypothesis evidence calculations and parameter inference for complicated posterior distributions, particularly in the field of astronomy. Due to its computational complexity and long-running nature, in the past, nested sampling has been reserved for offline-type Bayesian inference, leaving tools such as variational inference and MCMC for online-type, time-constrained, Bayesian computations. These tools do not easily handle complicated multi-modal posteriors, discrete random variables, and posteriors lacking gradients, nor do they enable practical calculations of the Bayesian evidence. An opening thus remains for a high-performance out-of-the-box nested sampling package that can close the gap in computational time, and let nested sampling become common place in the data science toolbox. We present JAX-based nested sampling (JAXNS), a high-performance nested sampling package written in XLA-primitives using JAX, and show that it is several orders of magnitude faster than the currently available nested sampling implementations of PolyChord, MultiNEST, and dynesty, while maintaining the same accuracy of evidence calculation. The JAXNS package is publically available at \url{https://github.com/joshuaalbert/jaxns}.

Motivation & Objective

  • To address the computational bottleneck of nested sampling in time-constrained and high-throughput data science applications.
  • To enable efficient, out-of-the-box Bayesian evidence computation for complex, multi-modal, and non-gradient-based posteriors.
  • To integrate nested sampling into modern machine learning frameworks like JAX, where no such native implementation previously existed.
  • To overcome the performance limitations of existing nested sampling tools, which are too slow for real-time or large-scale inference.
  • To extend nested sampling to discrete priors and scalable, memory-efficient sampling strategies in future work.

Proposed method

  • Reformulating nested sampling as a static-memory algorithm using JAX's XLA-compiled primitives for high-performance execution on accelerators.
  • Implementing likelihood evaluations via JAX's JIT compilation and automatic differentiation, enabling fast, vectorized computation.
  • Using XLA's low-level optimizations to minimize memory overhead and maximize computational throughput.
  • Designing a static-memory variant of reservoir sampling to maintain representative samples without storing all intermediate points.
  • Ensuring compatibility with both continuous and discrete random variables, as originally defined in Skilling (2004).
  • Building a modular, open-source package (JAXNS) with Pythonic interfaces for seamless integration into probabilistic programming workflows.

Experimental results

Research questions

  • RQ1Can nested sampling be accelerated sufficiently to become practical for real-time and large-scale Bayesian inference in data science?
  • RQ2To what extent can JAX's XLA compilation and static-memory design improve the performance of nested sampling compared to traditional implementations?
  • RQ3Can nested sampling be efficiently integrated into modern machine learning backends like JAX, enabling evidence-based model selection in neural networks?
  • RQ4How does JAXNS maintain accuracy in Bayesian evidence estimation while achieving significant speedups over existing tools?
  • RQ5What are the limitations of static-memory nested sampling, and how can online resampling strategies mitigate them?

Key findings

  • JAXNS achieves 2–3 orders of magnitude faster evidence computation than PolyChord, MultiNEST, and dynesty in their sequential evaluation modes.
  • The performance gain is attributed to XLA-compiled, static-memory computation, which optimizes memory access and computation for accelerators.
  • JAXNS maintains the same accuracy in evidence calculation as existing tools, ensuring reliable Bayesian model comparison.
  • The package is publicly available at https://github.com/joshuaalbert/jaxns, enabling broad adoption in the research community.
  • JAXNS enables previously infeasible applications, such as evidence-based training in reinforcement learning and Bayesian neural networks with multi-modal posteriors.
  • Future extensions will include support for discrete priors and a static-memory reservoir sampling variant to improve memory efficiency without sacrificing statistical fidelity.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.