Semi-Separable Hamiltonian Monte Carlo for Inference in Bayesian Hierarchical Models

Yichuan Zhang, Charles Sutton

TL;DR

This paper introduces Semi-Separable Hamiltonian Monte Carlo (SSHMC), a new sampling method designed specifically for hierarchical Bayesian models. By using a clever block-diagonal mass matrix, the authors decompose a complex, non-separable Hamiltonian system into two simpler ones, allowing for a highly efficient "alternating blockwise leapfrog algorithm" that outperforms both standard HMC and computationally heavy Riemannian methods.

What Problem Does This Paper Address?

Hierarchical models are a cornerstone of modern Bayesian statistics, allowing researchers to share "statistical strength" across different groups of data. However, they are notoriously difficult to sample from using Markov Chain Monte Carlo (MCMC) methods.

The primary culprit is pathological correlation: the model parameters ($\theta$) and hyperparameters ($\phi$) are often so tightly coupled that the posterior distribution looks like a narrow "funnel." Standard Hamiltonian Monte Carlo (HMC) tends to get stuck in the neck of these funnels because it uses a constant mass matrix that can't adapt to the changing curvature of the space. While Riemannian Manifold HMC (RMHMC) can adapt, it is computationally grueling, requiring $O(d^3)$ time to solve complex differential equations at every step.

Methods

The authors propose SSHMC, which strikes a balance between the simplicity of standard HMC and the geometric awareness of RMHMC.

  1. Semi-Separable Hamiltonian: The key innovation is a specially designed mass matrix $G(\theta, \phi)$. They restrict it to a block-diagonal form where the precision matrix for the parameters ($G_\theta$) depends only on the hyperparameters ($\phi$), and vice versa.
  2. Alternating Blockwise Leapfrog Algorithm (ABLA): Because of this structure, if you fix one set of variables (say, $\phi$ and its momentum), the remaining system becomes a standard separable Hamiltonian. This allows the authors to use the simple, fast leapfrog integrator we know and love, but in an alternating fashion.
  3. Energy Borrowing: Unlike "HMC within Gibbs" (which ignores the coupling between blocks during the update), SSHMC includes "auxiliary potential" terms. This allows the two blocks to "borrow energy" from each other, enabling much larger moves in the hyperparameter space.

Datasets

The authors evaluated SSHMC against standard HMC and RMHMC-within-Gibbs on four challenging benchmarks:

  • Gaussian Funnel: A synthetic 101-dimensional distribution designed specifically to break MCMC samplers.
  • Hierarchical Bayesian Logistic Regression: Using the Statlog (German credit) dataset, partitioned into 10 groups to create a hierarchical structure.
  • Stochastic Volatility Model: A time-series model where latent volatilities are modeled by an AR(1) process.
  • Log-Gaussian Cox Point Process (LGCPP): A spatial model with 1024 latent variables, often used to test high-dimensional sampling.

Key Insights and Ideas

  • Breaking the $O(d^3)$ Barrier: By using the semi-separable structure, SSHMC avoids the need for the Generalized Leapfrog Integrator (GLI). This reduces the computational cost of matrix operations from $O((n+m)^3)$ to $O(n^3)$, making it feasible for much larger models.
  • Geometric Preconditioning: The choice of mass matrix acts as a local preconditioner. For example, in the Gaussian funnel, using $G_x = e^v I$ allows the sampler to perfectly adapt to the changing scale of the parameters as the hyperparameter $v$ changes.
  • Superior Mixing: As shown in Figure 1, standard HMC (left) suffers from rapid oscillations and fails to explore the hyperparameter space effectively. In contrast, SSHMC (right) shows much wider energy variations and a trajectory that spans a significantly larger range of the funnel.
Figure 1: The trace of energy over the simulation time and the trajectory of the first dimension of 100 dimensional Gaussian x1 (vertical axis) and hyperparameter v (horizontal axis). The two simulations start with the same initial point sampled from the Gaussian Funnel.

Key Results

In every experiment, SSHMC produced more "Effective Samples per Second" (ESS/s) than the competitors:

  • Gaussian Funnel: SSHMC achieved a minimum ESS/s of 41.27, compared to just 5.09 for HMC and 3.21 for RMHMC(Gibbs). It was also the only method to provide nearly unbiased estimates of the hyperparameter variance.
  • Logistic Regression: SSHMC was roughly 2.7x faster than standard HMC in terms of normalized ESS.
  • LGCPP: On this high-dimensional spatial task, SSHMC generated about six times as many effective samples per hour as RMHMC within Gibbs.

Limitations and Future Work

While SSHMC is powerful, the authors note a few areas for further exploration:

  • Mass Matrix Choice: The performance depends on choosing a good mass matrix $G$. While the Hessian of the log-prior is a natural choice, it might ignore the curvature of the likelihood. The authors suggest this is acceptable when data is sparse, but more complex choices might be needed for dense data.
  • Tuning: Like all HMC methods, the number of leapfrog steps and step sizes must be tuned. The authors used manual tuning for their experiments.
  • Discrete Models: The paper focuses on continuous variables, but the authors suggest that SSHMC could be extended to discrete models by following previous work on discrete HMC.

Summary updated

Abstract

Sampling from hierarchical Bayesian models is often difficult for MCMC methods, because of the strong correlations between the model parameters and the hyperparameters. Recent Riemannian manifold Hamiltonian Monte Carlo (RMHMC) methods have significant potential advantages in this setting, but are computationally expensive. We introduce a new RMHMC method, which we call semi-separable Hamiltonian Monte Carlo, which uses a specially designed mass matrix that allows the joint Hamiltonian over model parameters and hyperparameters to decompose into two simpler Hamiltonians. This structure is exploited by a new integrator which we call the alternating blockwise leapfrog algorithm. The resulting method can mix faster than simpler Gibbs sampling while being simpler and more efficient than previous instances of RMHMC.
BibTeX
@inproceedings{zhang2014semi,
  author = {Yichuan Zhang and Charles Sutton},
  title = {{Semi-Separable Hamiltonian Monte Carlo for Inference in Bayesian Hierarchical Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2014},
  url = {https://openreview.net/forum?id=HJV6eYZOZS},
}
Figure