Abstract
Hamiltonian Monte Carlo (HMC) is the mainstay of applied Bayesian inference for differentiable models. However, HMC still struggles to sample from hierarchical models that induce densities with multiscale geometry: a large step size is needed to efficiently explore low curvature regions while a small step size is needed to accurately explore high curvature regions. We introduce the delayed rejection generalized HMC (DR-G-HMC) sampler that overcomes this challenge by employing dynamic step size selection, inspired by differential equation solvers. In generalized HMC, each iteration does a single leapfrog step. DR-G-HMC sequentially makes proposals with geometrically decreasing step sizes upon rejection of earlier proposals. This simulates Hamiltonian dynamics that can adjust its step size along a (stochastic) Hamiltonian trajectory to deal with regions of high curvature. DR-G-HMC makes generalized HMC competitive by decreasing the number of rejections which otherwise cause inefficient backtracking and prevents directed movement. We present experiments to demonstrate that DR-G-HMC (1) correctly samples from multiscale densities, (2) makes generalized HMC methods competitive with the state of the art No-U-Turn sampler, and (3) is robust to tuning parameters.
Introduction
In Bayesian inference, Hamiltonian Monte Carlo (HMC) is widely regarded as the gold standard for sampling from posterior distributions. However, its efficiency is highly sensitive to the choice of step size. This presents a "Goldilocks" problem: a large step size enables rapid exploration of flat, low-curvature regions but causes instability and rejections in narrow, high-curvature regions. Conversely, a small step size ensures stability in curved regions but leads to slow exploration elsewhere. This challenge is particularly acute in hierarchical models, which often exhibit "multiscale" geometries where the scale of the density varies by orders of magnitude.
Methodology: DR-G-HMC
The proposed algorithm, Delayed Rejection Generalized Hamiltonian Monte Carlo (DR-G-HMC), addresses these limitations by integrating two concepts: Generalized HMC (G-HMC) and Delayed Rejection (DR).
G-HMC utilizes partial momentum refreshes instead of full updates, encouraging directed motion. However, it suffers from a "backtracking" issue where rejections trigger momentum flips, reversing the sampler's progress. DR-G-HMC mitigates this by employing a "second-chance" mechanism. If a proposal is rejected, the sampler attempts a new proposal from the same state using a geometrically smaller step size ($\epsilon_k = \epsilon / r^{k-1}$).
As shown in the figure above, the algorithm effectively reduces its step size in regions with high Hessian condition numbers (high curvature), allowing it to navigate narrow "necks" that would typically cause standard HMC to fail. This dynamic adaptation allows the sampler to maintain directed movement even in complex landscapes.
Experimental Results
The authors evaluated DR-G-HMC against several benchmarks, including Neal’s Funnel, the Eight Schools model, and high-dimensional real-world posteriors. A key finding is the sampler's performance on Neal’s Funnel, a classic pathological case for HMC. While the state-of-the-art No-U-Turn Sampler (NUTS) often fails to enter the narrow "neck" of the funnel, DR-G-HMC successfully explores the entire geometry.
The comparison in the figure above illustrates this advantage: DR-G-HMC and its variants closely match the true reference density, while NUTS exhibits significant bias due to its inability to sample from high-curvature regions. Furthermore, on simpler, non-multiscale densities like Item Response Theory (IRT) models, DR-G-HMC remains competitive with NUTS, demonstrating that its specialized mechanisms do not compromise general performance.
Conclusion and Future Work
DR-G-HMC represents a significant advancement in sampling for hierarchical models. By fixing the backtracking flaw in G-HMC and introducing dynamic step-size selection via delayed rejection, it provides a robust solution for multiscale densities. While the current implementation requires some manual tuning of hyperparameters, future work aims to automate this process and integrate the sampler into popular probabilistic programming languages like Stan.
Summary updated