Bayesian Inference with Latent Hamiltonian Neural Networks

Somayajulu L. N. Dhulipala, Yifeng Che, Michael D. Shields
8/12/2022
cs.LGstat.COstat.ML
bayesian

Official code: IdahoLabResearch/BIhNNs (17 stars, Python, MIT, last commit 2026-06-18).

Abstract

When sampling for Bayesian inference, one popular approach is to use Hamiltonian Monte Carlo (HMC) and specifically the No-U-Turn Sampler (NUTS) which automatically decides the end time of the Hamiltonian trajectory. However, HMC and NUTS can require numerous numerical gradients of the target density, and can prove slow in practice.

Show full abstract

We propose Hamiltonian neural networks (HNNs) with HMC and NUTS for solving Bayesian inference problems. Once trained, HNNs do not require numerical gradients of the target density during sampling. Moreover, they satisfy important properties such as perfect time reversibility and Hamiltonian conservation, making them well-suited for use within HMC and NUTS because stationarity can be shown. We also propose an HNN extension called latent HNNs (L-HNNs), which are capable of predicting latent variable outputs. Compared to HNNs, L-HNNs offer improved expressivity and reduced integration errors. Finally, we employ L-HNNs in NUTS with an online error monitoring scheme to prevent sample degeneracy in regions of low probability density. We demonstrate L-HNNs in NUTS with online error monitoring on several examples involving complex, heavy-tailed, and high-local-curvature probability densities. Overall, L-HNNs in NUTS with online error monitoring satisfactorily inferred these probability densities. Compared to traditional NUTS, L-HNNs in NUTS with online error monitoring required 1--2 orders of magnitude fewer numerical gradients of the target density and improved the effective sample size (ESS) per gradient by an order of magnitude.

View on arXivView PDF

Code Implementations(1)

MIT

The code enables to perform Bayesian inference in an efficient manner through the use of Hamiltonian Neural Networks (HNNs), Deep Neural Networks (DNNs), Neural ODEs, and Symplectic Neural Networks (SympNets) used with state-of-the-art sampling schemes like Hamiltonian Monte Carlo (HMC) and the No-U-Turn-Sampler (NUTS).

175PythonOct 3, 20225 months agoMIT
bayesian-inferencehamiltonian-monte-carlolangevin-dynamicsneural-networksno-u-turn-sampler+2 more

Similar Papers

Cite this paper

@article{dhulipala2022bayesian,
  title  = {Bayesian Inference with Latent Hamiltonian Neural Networks},
  author = {Somayajulu L. N. Dhulipala and Yifeng Che and Michael D. Shields},
  year   = {2022},
  eprint = {2208.06120},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2208.06120}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2208.06120.svg)](https://codeofpaper.com/paper/2208.06120)

Discussion