Suppose you want to know the most plausible value of 100 parameters given your data. Bayes's theorem tells you the shape of the answer — the posterior distribution — but computing it requires sampling from a probability density that lives in a 100-dimensional space.
The naive approach, random-walk Metropolis, shuffles its proposal one tiny step at a time. In low dimensions that works. In high dimensions the sampler spends nearly all its time in "corners" where the density is negligible, and the sliver of space that actually carries probability mass is so thin that random steps almost never land on it. Mixing becomes catastrophically slow.
Hamiltonian Monte Carlo (HMC), introduced by Simon Duane et al. in 1987 in the context of lattice field theory and popularized for statistics by Radford Neal and later the Stan team, sidesteps this by treating the negative log-posterior as a potential energy surface. It augments each parameter with a fictitious momentum, then simulates the physical trajectory of a particle rolling across that surface. Because the particle follows the gradient, it glides toward regions of high probability instead of stumbling around randomly — and it can leap across the full width of the posterior in a single proposal.
The mathematics is elegant: Hamiltonian dynamics conserve total energy and are time-reversible, so the Metropolis acceptance step still guarantees the sampler converges to the exact posterior. In practice, HMC accepts proposals at rates above 90 % even in hundreds of dimensions, while random walk would need thousands of tiny steps to travel the same distance.
Comments
Loading comments...