Abstract
Hamiltonian Monte Carlo (HMC) has become a go-to family of Markov chain Monte Carlo (MCMC) algorithms for Bayesian inference problems, in part because we have good procedures for automatically tuning its parameters. Much less attention has been paid to automatic tuning of generalized HMC (GHMC), in which the auxiliary momentum vector is partially updated frequently instead of being completely resampled infrequently. Since GHMC spreads progress over many iterations, it is not straightforward to tune GHMC based on quantities typically used to tune HMC such as average acceptance rate and squared jumped distance. In this work, we propose an ensemble-chain adaptation (ECA) algorithm for GHMC that automatically selects values for all of GHMC’s tunable parameters each iteration based on statistics collected from a population of many chains. This algorithm is designed to make good use of SIMD hardware accelerators such as GPUs, allowing most chains to be updated in parallel each iteration. Unlike typical adaptive-MCMC algorithms, our ECA algorithm does not perturb the chain’s stationary distribution, and therefore does not need to be “frozen” after warmup. Empirically, we find that the proposed algorithm quickly converges to its stationary distribution, producing accurate estimates of posterior expectations with relatively few gradient evaluations per chain.
Introduction
Hamiltonian Monte Carlo (HMC) is the workhorse of modern Bayesian inference, utilized extensively in probabilistic programming frameworks like Stan and PyMC. While standard HMC benefits from robust automatic tuning via the No-U-Turn Sampler (NUTS), its heavy control flow makes it difficult to deploy efficiently on parallel hardware like GPUs.
Generalized HMC (GHMC) offers a hardware-friendly alternative through fixed-length trajectories and partial momentum updates. However, GHMC has historically been difficult to tune, requiring manual intervention for parameters such as step size ($\epsilon$), damping ($\alpha$), and slice drift ($\delta$). This paper introduces MEADS (Maximum-Eigenvalue Adaptation of Damping and Step-size), a method to automatically tune GHMC, making it as accessible as NUTS while maintaining its hardware advantages.
Methods: Ensemble-Chain Adaptation
MEADS utilizes an Ensemble-Chain Adaptation (ECA) framework. Rather than tuning a single chain in isolation, MEADS runs a large population of chains and uses their collective statistics to inform parameter updates.
K-Fold Adaptation
To preserve the stationary distribution of the Markov chains, MEADS employs a K-fold strategy. The ensemble is divided into groups (e.g., 4 folds). Chains within one fold update their parameters based on statistics (mean, variance, etc.) derived from a neighboring fold. This dependency structure ensures that the adaptation remains theoretically valid even if parameters continue to change throughout the sampling process.
Curvature-Based Tuning Rules
The algorithm targets the geometry of the distribution by estimating the average negative Hessian using the outer product of gradients. By focusing on the largest eigenvalues ($\lambda_{max}$) of the estimated Hessian and empirical covariance, MEADS derives robust heuristics for setting $\epsilon$, $\alpha$, and $\delta$. A novel ratio-based estimator ($tr(\Sigma^2)/tr(\Sigma)$) is introduced to stably find these eigenvalues from noisy, low-rank ensemble data.
Experimental Evaluation
MEADS was benchmarked against NUTS and ChEES-HMC using the Inference Gym suite. The targets included a wide range of dimensionalities, from the 2D "Banana" distribution to a 2519D Stochastic Volatility model.
Convergence Performance
MEADS demonstrated rapid convergence, reaching "low bias" states as fast as or faster than NUTS on 5 out of 8 benchmarks. In high-dimensional tasks like Sparse Logistic Regression, MEADS significantly outperformed NUTS in terms of the number of gradient evaluations required to reach stationarity.
Efficiency and Robustness
In terms of Gradients per Effective Sample Size (Grads/ESS), MEADS proved highly competitive, particularly on complex models like Brownian Motion and Item Response Theory. Ablation studies further confirmed that the algorithm is robust to its own internal hyperparameters, such as the number of folds, reinforcing its status as a "tuning-free" solution.
Conclusion
MEADS provides a robust path forward for scaling Bayesian inference to modern parallel architectures. By automating the tuning of GHMC through ensemble statistics, it offers a sampler that is both easy to use and highly efficient on GPUs. Future work may explore dense preconditioning and the integration of stochastic gradients to further scale the algorithm to massive datasets.
Summary updated