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

Automatic Laplace Collapsed Sampling: Scalable Marginalisation of Latent Parameters via Automatic Differentiation

Toby Lovick, David Yallup, Will HandleyarXiv 2026

TL;DR

Automatic Laplace Collapsed Sampling (ALCS) is a novel framework that makes high-dimensional Bayesian model comparison scalable by analytically stripping away nuisance parameters. By combining nested sampling with automatic differentiation, ALCS collapses the parameter space down to just the core hyperparameters of interest, turning a potentially decades-long computation into a matter of minutes.

What Problem Does This Paper Address?

In Bayesian inference, computing the "evidence" (or marginal likelihood) is essential for comparing different scientific models. However, standard algorithms like nested sampling suffer from a severe curse of dimensionality: their computational cost scales cubically $O(d^3)$ with the number of parameters $d$.

Many real-world problems—especially in astrophysics and cosmology—have a specific hierarchical structure. They contain a few primary parameters of interest ($\theta$, like cosmological constants) but thousands or millions of latent "nuisance" variables ($z$, like per-object measurement noise or calibration offsets). Jointly sampling both $\theta$ and $z$ quickly becomes computationally intractable, forcing researchers to make oversimplifying assumptions that sacrifice accuracy.

Methods

ALCS solves this by "collapsing" the high-dimensional latent variables $z$ into a scalar contribution at each likelihood evaluation of the outer sampler. Instead of sampling $z$, ALCS uses a two-step local approximation:

  1. Optimisation: It finds the conditional Maximum A Posteriori (MAP) estimate of the latents $\hat{z}(\theta)$ using a gradient-based optimizer (L-BFGS).
  2. Laplace Approximation: It computes the negative Hessian matrix at this mode using JAX's automatic differentiation (jax.hessian). This Hessian is used to analytically integrate out $z$ under a local Gaussian assumption.

Crucially, the paper introduces two major algorithmic extensions:

  • Beyond Gaussian (Student-$t$ Extension): By leveraging autodiff to compute the fourth derivative at the MAP, ALCS can fit a Student-$t$ distribution, drastically improving evidence estimates for heavy-tailed latent variables.
  • Sparse Hessian Support: For structured latent spaces (like time-series models), ALCS exploits graph coloring and tridiagonal Cholesky recurrences to bypass expensive dense matrix operations.

The entire pipeline is implemented in JAX and parallelized across live points on GPU hardware using jax.vmap.

Datasets

The authors evaluated ALCS on a diverse set of synthetic and standard benchmarks:

  • Synthetic Supernova Cosmology: A hierarchical Type Ia supernova model scaled up to $d_z = 25,600$ latent dimensions.
  • Synthetic Student-$t$ Prior Model: Designed to test heavy-tailed latent distributions.
  • Tanh Funnel Model: A highly non-Gaussian controlled failure case.
  • Inference Gym Benchmarks: Six standard models spanning hierarchical, time-series, and discrete-likelihood structures (Eight Schools, Radon, Brownian Motion, Log-Gaussian Cox Process, Stochastic Volatility, and Item Response Theory).

Key Insights and Ideas

  • Autodiff Unlocks the Hessian: Historically, Laplace marginalization was a bespoke, manual process because deriving Hessians by hand is incredibly difficult. Modern automatic differentiation makes exact second derivatives tractable even for $10^5$ dimensions.
  • Aggressive Dimension Reduction: By reducing the effective dimension from $d_\theta + d_z$ to just $d_\theta$, the outer nested sampler only has to explore a low-dimensional space, drastically reducing the required number of live points and sampler steps.
  • Post-Hoc Diagnostic: The authors developed an Importance Sampling (IS) Effective Sample Size (ESS) diagnostic. This allows researchers to check after the run exactly where the Gaussian approximation holds or fails across the hyperparameter space, without needing an expensive joint sampling run.

Key Results

  • Massive Speedups at Scale: On the supernova cosmology benchmark, ALCS handled 25,600 latent dimensions in just 12 minutes. In contrast, a traditional full joint nested sampling run at that scale is projectively estimated to take 37 years.
Figure 1: Supernova cosmology scaling for ΛCDM and wCDM. (a–b) Test 1: wall time and evi- dence error δ log Z vs N at fixed dz,block = 2. (c–d) Test 2: wall time (log–log) and δ log Z vs total latent dimension D at fixed N = 100; the D3 full-NS reference is projected. Top axis in (c) shows latents per object.
  • Inference Gym Success: ALCS achieved up to a $17\times$ wall-time speedup over NUTS on near-Gaussian models (like Radon) while providing exact evidence calculations. On the Log-Gaussian Cox Process, it delivered a $64\times$ speedup over full joint nested sampling.
  • Robustness to Tail Behavior: The Student-$t$ extension successfully reduced evidence error on heavy-tailed benchmarks (e.g., reducing error from $-1.00$ nats to just $-0.17$ nats at $N_{\text{obj}} = 50$).

Limitations and Future Work

The primary limitation of ALCS is its reliance on the unimodality of the latent conditional distribution. If the latent space is multimodal or exhibits severe non-Gaussian geometry (like the flat shoulders in the Tanh Funnel experiment), the MAP optimization can fail or yield biased evidence estimates.

Additionally, computing a dense Hessian still scales quadratically $O(d_z^2)$ in memory. For ultra-high-dimensional "field-level" inferences ($d_z \sim 10^6$), even a single dense evaluation is impossible. The authors note that future work will focus on integrating stochastic trace estimators and Hessian-vector products to scale ALCS to these massive field-level problems.

Summary updated

BibTeX
@misc{lovick2026automatic,
  author = {Toby Lovick and David Yallup and Will Handley},
  title = {{Automatic Laplace Collapsed Sampling: Scalable Marginalisation of Latent Parameters via Automatic Differentiation}},
  year = {2026},
  eprint = {2603.26644},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.26644},
}
Figure