NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Nested Slice Sampling: Vectorized Nested Sampling for GPU-Accelerated Inference

David Yallup, Namu Kroupa, Will Handley

TL;DR

The authors introduce Nested Slice Sampling (NSS), a fully vectorized, GPU-friendly formulation of Nested Sampling designed for scalable Bayesian inference and model comparison. By leveraging Hit-and-Run Slice Sampling and deriving a near-optimal tuning rule for slice width, NSS mitigates the control-flow overheads that typically plague accelerator-based implementations. The resulting algorithm achieves massive speedups over traditional CPU-bound methods while remaining highly robust on complex, multimodal probability landscapes.

What Problem Does This Paper Address?

In Bayesian computation, calculating the marginal likelihood (or "evidence," $Z$) is essential for model comparison but notoriously difficult for complex, multimodal distributions. Nested Sampling (NS) is a powerful alternative to standard Markov Chain Monte Carlo (MCMC) for this task because it systematically shrinks a population of "live points" through nested hard energy constraints.

However, classical NS is inherently sequential and relies on data-dependent control flow (such as rejection sampling or variable-length MCMC chains to find valid points within a constrained boundary). This makes it a poor fit for modern Single Instruction, Multiple Data (SIMD) hardware like GPUs, where threads executing different code paths cause severe performance penalties known as warp divergence. As a result, practitioners have been forced to choose between the robustness of Nested Sampling on CPUs and the raw speed of hardware-accelerated methods like Sequential Monte Carlo (SMC) on GPUs.

Methods

The paper introduces Nested Slice Sampling (NSS) to bridge this gap using two main innovations:

  1. Vectorized Outer Loop: NSS unrolls the traditional sequential deletion step into a batched operation, removing and replacing $k$ live points simultaneously. All operations—energy evaluation, thresholding, resampling, and mutation—are expressed as array programs compiled via JAX to run in parallel on the GPU.
  2. Hit-and-Run Slice Sampling (HRSS) with Optimal Tuning: NSS uses HRSS as its inner MCMC kernel to evolve cloned particles under hard constraints. Crucially, the authors provide a rigorous mathematical analysis of slice width ($w$) tuning. They prove that the optimal slice width scales as $d^{-1/2}$ in high dimensions and show that operating near this optimum causes the computational cost per step to concentrate tightly around its mean.

This cost concentration is the secret sauce: it ensures that parallel chains evaluate roughly the same number of likelihood functions, drastically reducing warp divergence on the GPU.

Validation of slice width theory against numerical cost simulations.

Datasets

The authors evaluate NSS across a diverse suite of synthetic and real-world benchmarks:

  • Synthetic Targets: A highly multimodal 2D Mixture of Gaussians (MoG) with 40 modes, a 10D MoG with 5 modes and randomized covariances, and the hierarchical 10D Neal's Funnel.
  • Inference Gym Benchmarks: Standard real-data problems including EightSchools ($d=10$), GermanCredit logistic regression ($d=25$), S&P500 stochastic volatility ($d=103$), and RadonIndiana linear regression ($d=97$).
  • Machine Learning Application: Full Bayesian Gaussian Process (GP) hyperparameter marginalization using Mauna Loa $\text{CO}_2$ and Airline Passengers datasets, utilizing an 11-dimensional non-linear Spectral Mixture kernel.

Key Insights and Ideas

  • Warp Divergence is a Solvable Problem: While slice sampling is adaptive and has a variable step count, optimizing the slice width ($w_* \approx 1.36\ell$, where $\ell$ is the chord length) minimizes the variance of the step distribution. This allows adaptive algorithms to run efficiently in lockstep on parallel hardware.
  • Anisotropy "Washes Out" in High Dimensions: The theoretical analysis reveals that the optimal high-dimensional slice width depends primarily on the mean eigenvalue of the target's local geometry, rather than its full anisotropic spectrum. This justifies using a simple empirical covariance metric for adaptive whitening.
  • Slice Sampling beats Random Walks under Constraints: Rejection-based random walks suffer from heavy-tailed cost distributions because particles repeatedly slam into the hard constraint boundaries. Slice sampling natively adapts to the local geometry, maintaining a flat, predictable cost across dimensions.
Comparison of likelihood evaluations per step between NSS (slice sampling) and a constrained random walk (RW).

Key Results

  • Substantial Speedups: On the Mauna Loa GP task, NSS achieves a $12\times$ to $30\times$ speedup over CPU-centric state-of-the-art implementations like UltraNest, while providing superior predictive accuracy and using fewer likelihood evaluations.
  • Linear GPU Scaling: Scaling experiments on the GermanCredit dataset show nearly linear runtime speedup as the deletion batch size $k$ increases, provided the compression ratio $k/m \le 0.5$.
  • Robust Mode Discovery: On the challenging 40-mode MoG, NSS successfully recovers all modes with correct weights, whereas tempered SMC baselines frequently suffer from systematic negative bias due to mixing failures in high dimensions.
Posterior samples for the 40-mode Mixture of Gaussians, showing perfect mode recovery by NSS.

Limitations and Future Work

Despite its strong performance, the authors note a few areas for improvement:

  • SIMD Synchronization Penalty: If the target distribution features extremely non-convex or highly irregular geometries, the per-chain costs can still vary, leading to wasted compute as fast threads wait for stragglers.
  • Dimensional Limits: For extremely high-dimensional problems ($d > 10^3$), gradient-free slice sampling will eventually face efficiency drops. Integrating gradient information into the constrained inner kernel is a key direction for future work.
  • Hyperparameter Tuning: The optimal number of inner mutation steps ($p$) is currently set using a heuristic ($p=d$) and would ideally be adapted online based on live decorrelation diagnostics.

Summary updated

BibTeX
@article{yallup2026nested,
  author = {David Yallup and Namu Kroupa and Will Handley},
  title = {{Nested Slice Sampling: Vectorized Nested Sampling for GPU-Accelerated Inference}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2026},
}
Figure