Gradient-free Hamiltonian Monte Carlo with Efficient Kernel Exponential Families

Heiko Strathmann, Dino Sejdinovic, Samuel Livingstone, Zoltán Szabó, Arthur GrettonNeurIPS 2015

TL;DR

Kernel Hamiltonian Monte Carlo (KMC) brings the high-efficiency sampling of Hamiltonian Monte Carlo (HMC) to "black-box" models where gradients are unavailable. By adaptively learning a surrogate gradient using kernel-based exponential families and score matching, KMC achieves HMC-like performance on complex, high-dimensional distributions where standard random-walk methods struggle.

What Problem Does This Paper Address?

In Bayesian statistics, researchers often need to sample from complex posterior distributions using Markov Chain Monte Carlo (MCMC). Hamiltonian Monte Carlo (HMC) is widely considered the gold standard for this task. It uses gradient information to "glide" along the contours of the density, allowing for large, efficient steps even in high-dimensional spaces.

However, HMC has a major limitation: it requires the exact gradient (the derivative) of the log-target density. In many modern applications—such as Approximate Bayesian Computation (ABC) or Pseudo-Marginal MCMC—the gradient is either mathematically intractable or impossible to compute because the density itself can only be estimated through noisy simulations. Without gradients, researchers are typically forced to fall back on "Random Walk" methods, which are notoriously slow, prone to random backtracking, and scale poorly as the number of dimensions increases.

Methods

The authors propose Kernel Hamiltonian Monte Carlo (KMC) to bridge this gap. Instead of requiring the true gradient, KMC learns a surrogate gradient on the fly from the history of the Markov chain.

  1. The Surrogate Model: The log-target density is modeled using an infinite-dimensional exponential family in a Reproducing Kernel Hilbert Space (RKHS). This provides a highly flexible, non-parametric way to represent complex geometric shapes.
  2. Score Matching: To fit this model without knowing the normalization constant of the target density, the authors employ score matching. This technique learns the gradient structure directly by minimizing the difference between the model's gradient and the (estimated) target's gradient.
  3. Two Flavors of Estimators:
    • KMC lite: Uses a subsample of the chain's history. It is theoretically robust (geometrically ergodic) and "fails gracefully"—behaving like a standard random walk in unexplored regions and becoming HMC-like once it has enough data.
  4. KMC finite: Uses Random Fourier Features to create a finite-dimensional approximation. This version is computationally faster for "online" updates, allowing the algorithm to incorporate every single point in the chain's history.
  5. The MCMC Step: The learned surrogate gradient is used to simulate Hamiltonian dynamics. Any errors in the approximation are corrected by a final Metropolis-Hastings accept/reject step, ensuring the algorithm remains asymptotically exact.
Comparison of HMC and KMC trajectories on a 2D target. KMC (right) successfully mimics the smooth, elliptical trajectory of exact HMC (left) by learning from historical samples (blue crosses), maintaining a similarly high acceptance probability.

Datasets

The researchers evaluated KMC on several challenging benchmarks:

  • Synthetic Targets: A 2D Gaussian (for visualization), an 8-dimensional "Banana" distribution (highly non-linear support), and high-dimensional isotropic Gaussians (up to 100D) to test scaling.
  • UCI Glass Dataset: Used for a real-world Gaussian Process Classification task. This represents a "Pseudo-Marginal" setting where the marginal likelihood is intractable.
  • Skew-Normal Distribution: Used to test KMC in an ABC (Approximate Bayesian Computation) context.

Key Insights and Ideas

  • Global vs. Local Learning: Previous adaptive methods (like KAMH) only learned the local covariance. KMC learns a global gradient surrogate, which allows it to mimic the long-range trajectories that make HMC so powerful.
  • Bypassing Simulations in ABC: In standard "Hamiltonian ABC," you have to run expensive simulations at every small step of the trajectory. KMC only requires simulations for the final accept/reject step, potentially reducing the computational load by orders of magnitude (e.g., a factor of 100 in their experiments).
  • The "Lite" Safety Net: KMC lite is designed so that its gradients decay to zero far from the training data. This ensures the sampler doesn't get "lost" in the tails of the distribution; it simply reverts to a reliable random walk until it finds its way back to data-rich regions.

Key Results

  • Mixing Efficiency: On the 8D Banana distribution, KMC's performance (measured by Effective Sample Size) approached that of "true" HMC and significantly outperformed standard Random Walk and other adaptive kernel samplers.
  • High-Dimensional Stability: KMC maintained high acceptance rates in up to 100 dimensions, a regime where standard gradient-free methods typically collapse.
  • Accuracy in ABC: Unlike "Hamiltonian ABC" (HABC), which can introduce significant bias due to Gaussian approximations, KMC remained unbiased while being much faster.
  • Convergence: On the UCI Glass dataset, KMC converged to the ground truth much faster than competing methods, as measured by Maximum Mean Discrepancy (MMD).

Limitations and Future Work

  • Hyperparameter Sensitivity: KMC relies on two main parameters: the kernel bandwidth ($\sigma$) and a regularization term ($\lambda$). While the authors suggest using cross-validation on the score-matching objective, this adds an extra layer of complexity.
  • Initial "Cold Start": The algorithm needs an initial exploration phase (burn-in) to collect enough samples to build a decent gradient surrogate. If the initial samples are poor, the surrogate will be poor.
  • Computational Overhead: While "finite" KMC is efficient, the "lite" version requires matrix inversions that scale with the number of basis points, though the authors suggest low-rank approximations to mitigate this.
  • Future Directions: The authors point toward establishing more rigorous theoretical convergence rates and exploring KMC as a "pre-computation" strategy to speed up even standard HMC.

Summary updated

BibTeX
@inproceedings{strathmann2015gradient,
  author = {Heiko Strathmann and Dino Sejdinovic and Samuel Livingstone and Zoltán Szabó and Arthur Gretton},
  title = {{Gradient-free Hamiltonian Monte Carlo with Efficient Kernel Exponential Families}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2015},
  url = {https://openreview.net/forum?id=VCTbQYZ-tK},
}
Figure