Skip to main content
QUICK REVIEW

[Paper Review] Leveraging Sparsity to Improve No-U-Turn Sampling Efficiency for Hierarchical Bayesian Models

Cole C. Monnahan, Kasper Kristensen|arXiv (Cornell University)|Mar 2, 2026
Gaussian Processes and Bayesian InferenceComputer Science0 citations
TL;DR

SNUTS preconditions Bayesian posterior geometry with a sparse precision matrix computed via Template Model Builder, enabling Stan’s NUTS to be dramatically faster on high-dimensional, sparse hierarchical models.

ABSTRACT

Analysts routinely use Bayesian hierarchical models to understand natural processes. The no-U-turn sampler (NUTS) is the most widely used algorithm to sample high-dimensional, continuously differentiable models. But NUTS is slowed by high correlations, especially in high dimensions, limiting the complexity of applied analyses. Here we introduce Sparse NUTS (SNUTS), which preconditions (decorrelates and descales) posteriors using a sparse precision matrix ($Q$). We use Template Model Builder (TMB) to efficiently compute $Q$ from the mode of the Laplace approximation to the marginal posterior, then pass the preconditioned posterior to NUTS through the Bayesian software Stan for sampling. We apply SNUTS to seventeen diverse case studies to demonstrate that preconditioning with $Q$ converges one to two orders of magnitude faster than Stan's industry standard diagonal or dense preconditioners. SNUTS also outperforms preconditioning with the inverse of the covariance estimated with Pathfinder variational inference. SNUTS does not improve sampling efficiency for models with the highly varying curvature found in funnels, wide tails, or multiple modes. SNUTS is most advantageous, and can be scaled beyond $10^4$ parameters, in the presence of high dimensionality, sparseness, and high correlations, all of which are widespread in applied statistics. An open-source implementation of SNUTS is provided in the R package SparseNUTS.

Motivation & Objective

  • Motivate the need to improve NUTS efficiency in high-dimensional hierarchical models with challenging posterior geometry.
  • Propose a sparse preconditioning approach using a sparse precision matrix Q derived from Laplace approximations via TMB.
  • Develop and implement SNUTS in an R package to automate preconditioner selection and warmup length.
  • Benchmark SNUTS against standard NUTS and Pathfinder across diverse case studies to assess speedups and accuracy.
  • Provide guidance on when sparse preconditioning helps and when it may not (e.g., funnels, multi-modality).

Proposed method

  • Describe Hamiltonian Monte Carlo and why correlations inflate condition numbers and slow NUTS.
  • Introduce Q-based sparse preconditioning: transform q to q' via L where Q=LL^T and optionally permute for sparsity.
  • Compute Q from the Laplace approximation at the posterior mode using TMB (Eq. 5) and derive g_{q'} from transformed posteriors.
  • Optionally apply dense/diagonal preconditioning when sparsity is insufficient or inappropriate.
  • Pass f_{q'} and g_{q'} to Stan/NUTS and re-condition back to the original space for inference.
  • Provide an open-source SparseNUTS workflow to automate preconditioner choice and warmup length.
Figure 1: Warmup time comparisons. Simple illustration of the impact of the ratio of marginal standard deviations (a) and correlations (b) on warmup (dashed lines) and total NUTS run time (solid lines) for a simple bivariate normal model $\mathbf{X}\sim\mathcal{N}(\mathbf{0},\Sigma)$ . In (a) $\Sigm
Figure 1: Warmup time comparisons. Simple illustration of the impact of the ratio of marginal standard deviations (a) and correlations (b) on warmup (dashed lines) and total NUTS run time (solid lines) for a simple bivariate normal model $\mathbf{X}\sim\mathcal{N}(\mathbf{0},\Sigma)$ . In (a) $\Sigm

Experimental results

Research questions

  • RQ1Does sparse preconditioning with Q improve NUTS efficiency for high-dimensional hierarchical Bayesian models?
  • RQ2How does SNUTS compare to Pathfinder and standard NUTS in terms of run time and effective sample size?
  • RQ3Which model structures (sparsity, correlation, dimension) benefit most from SNUTS?
  • RQ4Can Q-based preconditioning scale to very large models (≥10^4 parameters) without prohibitive costs?
  • RQ5When might embedded Laplace approximation (ELA) variant be advantageous over full SNUTS?

Key findings

  • SNUTS accelerates sampling by 1–2 orders of magnitude over Stan’s NUTS for many case studies, especially with high dimensionality, sparseness, and correlations.
  • TMB-based sparse Q captures posterior geometry well in most models, outperforming Pathfinder in accuracy and speed across many cases.
  • Overhead for computing the preconditioner and transformed gradients is small relative to total SNUTS runtime, often <2%.
  • SNUTS achieved 20–70x efficiency improvements in SPDE/spatial models and 20x improvements in GLMMs relative to NUTS, with substantial ESS gains.
  • ELA variants can be more efficient than full SNUTS in some cases, but overall full SNUTS generally outperforms ELA-NUTS on most models examined.
  • SNUTS performance degrades for models with funnels, wide tails, or multiple modes where Q poorly approximates the posterior.
Figure 2: Visualizations of Q. The resulting sparsity pattern detected automatically by TMB for the precision matrix $Q$ (top left), correlation matrix derived from $\Sigma=Q^{-1}$ (top right), the lower triangle Cholesky decomposition of $Q$ itself (bottom left), and the Cholesky decomposition of $
Figure 2: Visualizations of Q. The resulting sparsity pattern detected automatically by TMB for the precision matrix $Q$ (top left), correlation matrix derived from $\Sigma=Q^{-1}$ (top right), the lower triangle Cholesky decomposition of $Q$ itself (bottom left), and the Cholesky decomposition of $

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.