Skip to main content
QUICK REVIEW

[Paper Review] Generalizing Hamiltonian Monte Carlo with Neural Networks

Daniel Lévy, Matthew D. Hoffman|arXiv (Cornell University)|Nov 25, 2017
Markov Chains and Monte Carlo MethodsMathematics38 references25 citations
TL;DR

This paper proposes a deep neural network-based generalization of Hamiltonian Monte Carlo (HMC) that learns to sample efficiently from complex, high-dimensional distributions. By training the network to maximize expected squared jumped distance, the method achieves dramatically faster mixing—up to 106× improvement in effective sample size—while enabling more expressive, non-Gaussian posterior approximations in variational autoencoders.

ABSTRACT

We present a general-purpose method to train Markov chain Monte Carlo kernels, parameterized by deep neural networks, that converge and mix quickly to their target distribution. Our method generalizes Hamiltonian Monte Carlo and is trained to maximize expected squared jumped distance, a proxy for mixing speed. We demonstrate large empirical gains on a collection of simple but challenging distributions, for instance achieving a 106x improvement in effective sample size in one case, and mixing when standard HMC makes no measurable progress in a second. Finally, we show quantitative and qualitative gains on a real-world task: latent-variable generative modeling. We release an open source TensorFlow implementation of the algorithm.

Motivation & Objective

  • Address the limitations of standard HMC in multi-modal, ill-conditioned, or rapidly changing energy landscapes.
  • Overcome the slow mixing and poor exploration of HMC across energy levels and mode boundaries.
  • Develop a trainable, general-purpose MCMC kernel that outperforms standard HMC in convergence and mixing speed.
  • Enable more expressive posterior approximations in latent-variable models by learning complex, non-Gaussian sampling dynamics.
  • Provide a black-box, end-to-end trainable sampler that can be deployed in high-dimensional inference tasks without manual tuning.

Proposed method

  • Parameterize the HMC transition kernel using a deep neural network that maps current state and momentum to a new state.
  • Train the network using a differentiable proxy loss based on expected squared jumped distance (ESJD), which measures mixing speed.
  • Use a differentiable integrator to backpropagate through the Hamiltonian dynamics, enabling end-to-end training.
  • Apply Metropolis-Hastings accept/reject step to preserve detailed balance and ensure convergence to the target distribution.
  • Integrate the learned sampler into variational autoencoders (VAEs) to improve posterior approximation quality.
  • Use block Gibbs sampling and posterior visualization to evaluate the expressivity of the learned sampler.

Experimental results

Research questions

  • RQ1Can a neural network be trained to generalize HMC in a way that improves mixing speed across diverse target distributions?
  • RQ2To what extent can a learned MCMC kernel outperform standard HMC in terms of effective sample size and convergence speed?
  • RQ3Does the proposed method enable more expressive posterior approximations in latent-variable models compared to standard Gaussian variational inference?
  • RQ4How well does the learned sampler perform on real-world, complex data distributions such as MNIST?
  • RQ5Can the method be extended to target higher-order autocorrelation or other sample statistics beyond position jumps?

Key findings

  • The proposed method achieved a 106× improvement in effective sample size on one benchmark distribution compared to standard HMC.
  • On a challenging multi-modal distribution, the learned sampler mixed effectively while standard HMC made no measurable progress.
  • Block Gibbs inpainting using the learned sampler successfully mixed between modes (e.g., digits 3, 5, 8, and 9), whereas the standard posterior approximation got stuck on a single mode.
  • Posterior visualization revealed non-Gaussian, multi-modal structures in the latent space when using the learned sampler, confirming its expressive power.
  • The method improved log-likelihood on held-out data in variational autoencoder training, demonstrating quantitative gains in generative modeling.
  • The open-source TensorFlow implementation enables reproducibility and integration into real-world inference pipelines.

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.