- Introduced by
- Livingstone, Zanella and related researchers building on Duane et al. (1987)
- Year
- 2010s–2020s
- Type
- Robust MCMC sampler
- Family
- Bayesian / computational
What does it do?
Robust Hamiltonian Monte Carlo (Robust HMC) is a loosely defined label for Hamiltonian Monte Carlo samplers modified to cope with heavy-tailed posteriors or difficult posterior geometry.
The modifications discussed here are heavier-tailed kinetic energies, position-dependent (Riemannian) mass matrices, and adaptive tuning with partial momentum refreshment, and they aim to keep exploration reliable where standard HMC or NUTS reports problems. Because the term does not refer to a single standard algorithm, any analysis should state exactly which modification was used.
The intuition behind the method
Hamiltonian Monte Carlo (HMC) proposes distant moves by simulating Hamiltonian dynamics driven by the gradient of the log-posterior. When the posterior has very heavy tails or rapidly changing curvature, the numerical integration can become inaccurate, and large energy errors lead to divergent transitions and slow exploration. Methods grouped under the Robust HMC label change the kinetic energy, the mass matrix, or the tuning and momentum-refresh scheme so that trajectories behave better in these regions. The Barker proposal of Livingstone and Zanella (2022) is sometimes discussed alongside these methods, but it is a separate gradient-based MCMC scheme and not a Hamiltonian method; the cited paper concerns its robustness to step-size tuning.
History
Hamiltonian Monte Carlo was introduced in physics simulations by Duane et al. (1987) and was popularised for Bayesian computation by Neal (2011). Riemannian HMC, which uses the Fisher information metric as a position-dependent mass matrix, was developed by Girolami and Calderhead (2011). The No-U-Turn Sampler of Hoffman and Gelman (2014), implemented in Stan, brought adaptive HMC into common Bayesian practice. The label 'Robust HMC' has no single originating paper in this page's references; the robust kinetic energy variants mentioned here are not traced to a specific source, and the Barker proposal of Livingstone and Zanella (2022) is a separate gradient-based method.
When to use it
Consider Robust HMC when a standard NUTS run reports divergent transitions, very low effective sample sizes, or high R-hat values even after extended warm-up, since these indicate that the posterior geometry is difficult for the default sampler. It is most relevant for heavy-tailed posteriors, such as those arising from Student-t likelihoods, and for hierarchical models with weakly identified variance components, where curvature changes sharply. The benefit of a heavier-tailed kinetic energy for any particular heavy-tailed posterior is unverified and should be checked empirically. Before switching samplers, check whether a reparameterisation, such as a non-centred form, removes the problem. Avoid these variants when a well-specified standard NUTS run converges cleanly, because they add computational cost per step and extra tuning choices without a clear benefit for well-behaved posteriors.
Limitations and considerations
- Higher computational cost per iteration than standard HMC, especially with a dense or Riemannian mass matrix, because the metric and its derivatives must be computed.
- More tuning choices (step size, mass matrix type, kinetic energy family) that interact in non-obvious ways.
- Riemannian HMC requires computing the Fisher metric and its derivatives, which may be expensive or numerically unstable for some models.
- When the posterior is genuinely non-identifiable, no robust sampler can rescue the inference; the model must be reparameterised.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Targets the specific failure modes of standard HMC on heavy-tailed or strongly curved posteriors, such as the divergent transitions reported by NUTS, rather than offering a general speed-up.
- Retains gradient information, so proposals can move through the posterior further than random-walk Metropolis moves for continuous parameters.
- Divergent-transition monitoring provides a built-in diagnostic: a run with no divergences after warm-up is supporting evidence, though not proof, that the posterior was explored faithfully.
- Riemannian mass matrices adapt to local curvature, which can reduce the manual rescaling of parameters that a fixed mass matrix requires.
- Modular: a robust kinetic energy or mass-matrix choice can be applied within an HMC or NUTS workflow without changing the likelihood or priors.
Applications
- Hierarchical Bayesian models with weakly identified variance parameters that cause funnel-shaped posteriors.
- Survival and heavy-tailed regression models using Student-t or Cauchy likelihoods.
- Bayesian neural network inference where posterior curvature varies sharply across layers.
- Spatial and geostatistical models with dense covariance structures.
- Pharmacokinetic/pharmacodynamic models with near-degenerate parameter spaces.
- Bayesian stochastic differential equation models with challenging latent-variable geometry.
How it works
How it works
The sampler augments the target parameters q with auxiliary momenta p. The Hamiltonian H(q,p) = U(q) + K(p) is the sum of the negative log-posterior U(q) and the kinetic energy K(p). Standard HMC uses a Gaussian kinetic energy. Some robust variants substitute a heavier-tailed form, such as Student-t or Cauchy, as an alternative proposed in the literature. This changes the momentum distribution, but whether it improves sampling for a given posterior is unverified and must be checked with divergence counts, R-hat and ESS. Heavy tails in the posterior do not by themselves justify a heavy-tailed kinetic energy.
Formula
H(q, p) = U(q) + K(p)
Hamiltonian dynamics are integrated numerically with the leapfrog (Stormer-Verlet) integrator, using step size epsilon and L steps. Each leapfrog step updates the momentum by a half step using the gradient of U, updates the position by a full step, and then updates the momentum by a second half step. In Riemannian variants the position-dependent metric enters the update equations, so the local dynamics adapt to curvature, but the step size and number of steps remain tuning choices. Integration error tends to grow in narrow or strongly curved regions, which is where divergences are most likely to appear.
The mass matrix M (or its Riemannian generalisation) is adapted to the local posterior geometry. A diagonal or full dense mass matrix estimated during warm-up rescales the parameter space. Riemannian HMC uses the Fisher information metric to account for curvature variation, which can reduce sensitivity to the scale of the parameters, at the cost of computing the metric and its derivatives.
After L leapfrog steps, the proposed state is accepted with the Metropolis probability based on the energy change delta H, as in the formula above. The acceptance rule itself is unchanged by a robust kinetic energy; what changes is the trajectory and therefore delta H. Large energy errors, which Stan reports as divergent transitions, indicate that the integrator has not tracked the dynamics in that region, and that region should be investigated before the samples are relied upon.
Formula
\alpha = \min\!\left(1,\, e^{-\Delta H}\right)During warm-up, the step size epsilon is tuned by dual averaging and the mass matrix is estimated by online covariance estimation. Robust variants may also monitor divergent transitions and reduce the step size in response. Convergence is assessed with R-hat and effective sample size, and these should be read together with the divergence count.
Common pitfalls
- Dismissing divergent transitions because they are rare: even a small number can show that the integrator failed in a region of the posterior, which can bias estimates there.
- Using a dense mass matrix with very few warm-up iterations, leading to a poorly estimated covariance and worse performance than the default diagonal matrix.
- Confusing robustness to posterior geometry with robustness to model misspecification; Robust HMC addresses the former, not the latter.
- Skipping posterior predictive checks after sampling; a sampler that explores the posterior well can still faithfully estimate a badly specified model.
- Applying Riemannian HMC to discrete or mixed-type posteriors, where the Fisher metric is undefined.
Frequently asked questions
What is a divergent transition and why does it matter?
A divergent transition occurs when the leapfrog integrator loses energy conservation, typically because the step size is too large relative to the posterior curvature. Divergences indicate that the sampler is not exploring that region correctly, so parameter estimates near divergent regions may be biased. In Stan, divergences are treated as a reason to distrust the results until they are addressed, and zero divergent transitions after warm-up is the usual target before the posterior is interpreted.
How is Robust HMC different from standard NUTS?
NUTS is an adaptive HMC that sets the trajectory length automatically, but it uses a standard Gaussian kinetic energy with a diagonal or dense mass matrix. Robust variants modify the kinetic energy (for example, to a Student-t form) or the mass matrix, aiming to keep sampling reliable for posteriors where the default setup struggles. Neither approach replaces checking the model itself.
Does reparameterisation help before trying Robust HMC?
Yes. Non-centred parameterisations (for example, writing a hierarchical parameter as mu + sigma*z with a raw z) often resolve funnel geometry without requiring a more complex sampler. Robust HMC is most useful when reparameterisation is not straightforward or is insufficient.
How do I know if Robust HMC has converged?
Check that R-hat is below 1.01 for all parameters, that effective sample size is above 100 per chain (or 400 in total), that there are no divergent transitions after warm-up, and that trace plots are stable across chains. These are commonly used heuristics rather than thresholds specific to Robust HMC, and they apply to any HMC variant. For Riemannian HMC, also inspect acceptance rates: dual averaging steers the step size toward a user-set target acceptance rate, so realised acceptance far from that target, or a warm-up that does not reach it, should prompt investigation of the step size and the posterior geometry.
Which software implements Robust HMC?
Stan's NUTS, with step-size adaptation, covers most practical cases and is the most widely documented option here. Custom kinetic energies or metrics generally have to be implemented by the user, in any package that exposes the kinetic energy and mass matrix.
Related methods
Sources
Livingstone, S. & Zanella, G. (2022). The Barker proposal: combining robustness and efficiency in gradient-based MCMC. Journal of the Royal Statistical Society: Series B, 84(2), 496–523.
Open DOI referenceBetancourt, M. (2017). A conceptual introduction to Hamiltonian Monte Carlo. arXiv preprint arXiv:1701.02434.
Open publication reference