---
title: Randomized Hamiltonian Monte Carlo (RHMC)
url: https://www.emergentmind.com/topics/randomized-hamiltonian-monte-carlo-rhmc
type: topic
---

# Randomized Hamiltonian Monte Carlo (RHMC)

Randomized Hamiltonian Monte Carlo (RHMC) is a family of Hamiltonian Markov chain Monte Carlo methods in which deterministic Hamiltonian motion is interrupted at random times, typically with momentum refreshment at Poisson event times or, in discrete-time formulations, with randomized integration durations. In its canonical form, RHMC targets the Boltzmann–Gibbs extension
\[
\mu(dq,dp)=C_0^{-1}(2\pi)^{-D/2} e^{-H(q,p)}\,dq\,dp,
\qquad
H(q,p)=\frac{|p|^2}{2}+\Phi(q),
\]
whose \(q\)-marginal is the desired target distribution. The central motivation is to replace the fragile choice of a deterministic trajectory length in standard HMC by a randomized timing mechanism that suppresses resonance, regularizes sampling efficiency as a function of the duration parameter, and yields a natural piecewise deterministic Markov process (PDMP) description [1511.09382].

## 1. Canonical definition and algorithmic structure

In the canonical Euclidean formulation, the target distribution is
\[
\Pi(dq)=C_0^{-1} e^{-\Phi(q)}\,dq,
\]
and RHMC augments \(q\in\mathbb R^D\) with momentum \(p\in\mathbb R^D\), using Hamilton’s equations
\[
\dot q = p,\qquad \dot p = -\nabla \Phi(q).
\]
The basic modification relative to standard HMC is that the durations of Hamiltonian evolution are randomized rather than fixed. In the original RHMC construction, the durations between momentum refreshments are i.i.d. exponential random variables,
\[
\delta t \sim \mathrm{Exp}(1/\lambda),
\]
with mean \(\lambda\). Between jump times, the process follows exact Hamiltonian flow; at each jump time, the momentum is randomized through the Horowitz refresh map
\[
\Gamma(q,p)=\bigl(q,\cos(\phi)\,p+\sin(\phi)\,\xi\bigr),\qquad \xi\sim\mathcal N(0,I_D),
\]
where \(\phi=\pi/2\) gives full refreshment and smaller \(\phi\) gives partial refreshment [1511.09382].

This idealized RHMC is naturally a PDMP. Its infinitesimal generator is
\[
L f(q,p) = \lambda^{-1}\,\mathbb E\!\left[f(\Gamma(q,p))-f(q,p)\right] + p^T\nabla_q f(q,p)-\nabla \Phi(q)^T \nabla_p f(q,p),
\]
which decomposes into Hamiltonian transport and a Poisson jump operator [1511.09382]. A closely related continuous-time formulation writes the process as Hamiltonian dynamics interrupted by the jump SDE
\[
d\begin{bmatrix}X_{t}\\ V_{t} \end{bmatrix}= \begin{bmatrix} V_{t}\\ -\nabla \Phi(X_{t}) \end{bmatrix}d t+ \begin{bmatrix} 0_d\\ \big(\alpha V_{t-}+\sqrt{1-\alpha^2}\xi_{N_{t-}}-V_{t-}\big)\,dN_{t} \end{bmatrix},
\]
where \(N_t\) is a homogeneous Poisson process of rate \(\lambda\), \(\alpha\in[0,1)\), and \(\xi_k\sim\mathcal N_d(0_d,I_d)\) [2202.13230].

A broader class, Generalized Randomized Hamiltonian Monte Carlo (GRHMC), allows state-dependent event rates
\[
\lambda(\mathbf z)=\lambda(\mathbf q,\mathbf p)>0
\]
and jump kernels that preserve the event-rate-weighted momentum law
\[
v_{\mathbf q}(\mathbf p) = \frac{\lambda(\mathbf q,\mathbf p)\,\mathcal N(\mathbf p\mid \mathbf 0_d,\mathbf M)} {C(\mathbf q)}.
\]
Classical RHMC is recovered as the special case of constant-rate refreshment [2005.01285].

## 2. PDMP interpretation, invariance, and relation to HMC

RHMC differs from standard HMC in both timing and stochastic structure. Standard HMC usually chooses a deterministic integration time, applies numerical integration, and then uses a Metropolis correction. RHMC, by contrast, is continuous-time in its ideal form, with deterministic Hamiltonian motion between random Poisson event times and no accept/reject step in the exact-flow model. Randomness enters through event times and momentum updates rather than through repeated deterministic path lengths [1808.04299].

The invariant distribution is the canonical Gibbs law
\[
\pi(x,v)=\bar\pi(x)\psi(v)\propto \exp\{-U(x)-|v|^2/2\},
\]
or, in the Euclidean mass-matrix notation of GRHMC,
\[
\rho(\mathbf q,\mathbf p)=\pi(\mathbf q)\,\mathcal N(\mathbf p\mid \mathbf 0_d,\mathbf M)\propto e^{-\mathcal H(\mathbf q,\mathbf p)}.
\]
For constant-rate RHMC, the invariant measure follows from two facts: Hamiltonian flow preserves energy and volume, and the refreshment kernel preserves the Gaussian momentum marginal. In the GRHMC extension with state-dependent event rates, the invariance mechanism is modified but remains explicit: the jump kernel must preserve the tilted momentum density \(v_{\mathbf q}\), which compensates exactly for the state-dependent event bias [2005.01285].

The PDMP perspective is not merely formal. It places RHMC alongside Bouncy Particle Sampler and Zig-Zag, but with a different deterministic component: RHMC follows nonlinear Hamiltonian ODEs between jumps, whereas BPS uses linear motion and state-dependent reflections. A notable consequence is that RHMC can be obtained as a high-dimensional weak limit of the first coordinate of BPS. Under strong convexity and smoothness assumptions,
\[
mI \preceq \nabla^2 U_n(x) \preceq MI,
\]
the first location-velocity component of BPS converges weakly to a one-dimensional RHMC process with generator
\[
\mathcal{A}f(x,v)=\partial_x f(x,v)\,v - \partial_v f(x,v)\,W'(x) +\lambda\big[Q_\alpha f(x,v)-f(x,v)\big]
\]
as the ambient dimension tends to infinity [1808.04299].

This suggests a broader interpretation of RHMC as a canonical Hamiltonian PDMP: exact Hamiltonian transport provides conservative phase-space motion, while random refreshments induce the irreversibility and dissipation needed for sampling.

## 3. Geometric ergodicity, contraction, and dimension-free theory

The original RHMC paper proves geometric ergodicity in the exact-integration or small-step-size regime. The key tool is the Lyapunov function
\[
V(z)=H(z)+c_1\langle q,p\rangle + c_2 \frac{|q|^2}{2},
\qquad
c_1=\frac{\lambda^{-1}}{4}\sin^2(\phi), \qquad c_2=\lambda^{-1} c_1 (1-\cos\phi),
\]
for which
\[
LV(z)\le -\gamma V(z)+K
\]
under coercivity assumptions on \(\Phi\). Combined with a minorization argument, this yields a Harris-type theorem:
\[
\|\Pi_{t,z}-\mu\|_{\mathrm{TV}} \le C\,V(z)\,e^{-rt}.
\]
The paper emphasizes that these assumptions are essentially the same as those used for geometric ergodicity of underdamped Langevin dynamics [1511.09382].

A later RHMC analysis establishes explicit dimension-free convergence-rate bounds under strong log-concavity and bounded Hessians,
\[
mI_d \preceq \nabla^2U(x)\preceq MI_d.
\]
Using synchronous coupling, the difference process satisfies
\[
X'(t)=V(t),\qquad V'(t)=-\mathcal H(t)X(t),
\]
with \(mI\preceq \mathcal H(t)\preceq MI\), and contraction is proved in a weighted quadratic metric
\[
d_A^2(z_1,z_2) = a\|x_2-x_1\|^2 + 2b\langle x_2-x_1,v_2-v_1\rangle + c\|v_2-v_1\|^2.
\]
For a suitable refreshment rate
\[
\lambda=\frac{1}{1-\alpha^2}\left(2\sqrt{M+m}-\frac{(1-\alpha)m}{\sqrt{M+m}}\right),
\]
the generator satisfies
\[
L_{1,2} d_A^2(Z_1(t),Z_2(t))\le -\mu\, d_A^2(Z_1(t),Z_2(t)),
\]
which yields exponential contraction in \(W_2\) and corresponding \(L^2\) semigroup bounds, with constants independent of the ambient dimension [1808.04299].

Another continuous-time RHMC result sharpens contraction bounds for strongly log-concave targets in a form directly comparable to kinetic Langevin diffusion. Under
\[
m I_d\preceq \nabla^2\Phi(x)\preceq M I_d,
\]
and with refreshment intensity
\[
\lambda=\frac{2\sqrt{M+m}}{1-\alpha^2},
\]
the transition kernel \(P^t\) satisfies
\[
W_2((\nu P^t)_X,\Pi)\le Ce^{-r t}W_2(\nu_X,\Pi),\qquad
\|P^t f\|\le C'e^{-r t}\|f\|,
\]
with rate
\[
r=\frac{(1+\alpha)m}{2\sqrt{M+m}}.
\]
The same work proves that, under the scaling
\[
\lambda=\frac{2\gamma}{1-\alpha^2},
\]
RHMC converges at generator level to kinetic Langevin diffusion as \(\alpha\to1\), which identifies Langevin as a limiting high-persistence, high-frequency-refreshment regime of RHMC [2202.13230].

## 4. Randomized durations, resonance suppression, and Gaussian or quadratic models

The clearest analytic contrast between RHMC and fixed-duration HMC arises for Gaussian or quadratic targets. For the Gaussian target
\[
\Phi(q_1,\dots,q_D)=\sum_{i=1}^D \frac{q_i^2}{2\sigma_i^2},
\]
the original RHMC paper shows that, at refresh times,
\[
q_i(t_{n+1}) = \cos\!\left(\frac{\delta t_n}{\sigma_i}\right) q_i(t_n) + \sigma_i\sin\!\left(\frac{\delta t_n}{\sigma_i}\right)\xi_{i,n},
\]
with \(\xi_{i,n}\overset{\text{iid}}{\sim}\mathcal N(0,1)\) and \(\delta t_n\overset{\text{iid}}{\sim}\mathrm{Exp}(1/\lambda)\). The integrated autocorrelation time for the mean of coordinate \(i\) is then
\[
IAC_i^{RHMC} = 1+2\frac{\sigma_i^2}{\lambda^2},
\]
whereas fixed-duration HMC gives
\[
IAC_i^{HMC} = \frac{1+\cos(\lambda/\sigma_i)}{1-\cos(\lambda/\sigma_i)}.
\]
The RHMC expression is smooth and monotone in \(\lambda\); the fixed-duration expression is oscillatory and singular at resonant values [1511.09382].

This same resonance mechanism is central to nonasymptotic Gaussian-sampling theory for randomized integration lengths. For a Gaussian target
\[
\pi(x)\propto \exp\!\left(-\frac12 x^\top Bx\right),\qquad B=\operatorname{diag}(\omega_1^2,\dots,\omega_d^2),
\]
exact HMC in mode \(i\) evolves as
\[
x_i(t)=x_i(0)\cos(\omega_i t)+\frac{1}{\omega_i}\sin(\omega_i t)\,v_i(0).
\]
If \(t\) is fixed, some modes may satisfy \(|\cos(\omega_i t)|\approx 1\), producing periodic or near-periodic behavior. If \(t\) is randomized from
\[
T=\{k\delta \mid k\in \mathbb{N},\; k\delta<10\pi/\sqrt{\alpha}\},
\qquad
0<\delta \le \frac{\pi}{20\sqrt{\beta}},
\]
then for every \(\omega\in[\sqrt{\alpha},\sqrt{\beta}]\),
\[
\Pr_{t\sim U(T)}\big[|\cos(\omega t)|\le 0.9\big]\ge \frac12,
\]
and the product of mode-wise memory coefficients decays exponentially:
\[
\Pr\!\left[\left|\prod_{k=1}^K \cos(\omega t_k)\right|\ge 0.9^{K/4}\right] \le e^{-K/8}.
\]
The resulting leapfrog HMC with randomized integration times and Metropolis correction attains
\[
\widetilde O\!\left(\sqrt{\kappa}\,d^{1/4}\log(1/\varepsilon)\right)
\]
gradient evaluations to sample a \(d\)-dimensional Gaussian to total variation error \(\varepsilon\), improving on the \(\widetilde\Omega(\kappa d^{1/2})\) lower bound for HMC with fixed integration times [2209.12771].

A complementary quadratic analysis interprets the same phenomenon in terms of dissipation. For ideal HMC with randomized integration times
\[
T_k\sim \mathrm{Exp}(1/\lambda),
\]
one has
\[
\mathbb E[\cos^2(\sqrt{\sigma}T)] = \frac12+\frac{1}{2+8\lambda^2\sigma}
= 1-\frac{2\lambda^2\sigma}{1+4\lambda^2\sigma}.
\]
Choosing
\[
\lambda=\frac{1}{2\sqrt\mu}
\]
for quadratic targets with eigenvalues \(\mu\le \sigma_i\le L\) yields an expected total integration time
\[
\mathcal O\!\left(\frac1{\sqrt\mu}\log(1/\epsilon)\right),
\]
which improves by a \(\sqrt\kappa\) factor over classical constant-time, fully refreshed HMC. The same study argues that randomized integration time and partial refreshment should be viewed as two ways of controlling the effective dissipation level \(\lambda^{-1}(1-\eta^2)\) [2209.07438].

## 5. Numerical methods, generalized event mechanisms, and geometric extensions

Exact Hamiltonian flow is rarely available outside special models, so practical RHMC implementations require numerical integration. One route is to approximate the continuous-time GRHMC process directly by adaptive ODE solvers. In Numerical GRHMC (NGRHMC), the Hamiltonian equations
\[
\ddot{\mathbf q}(\tau) = \mathbf M^{-1}\nabla_{\mathbf q}\log\tilde\pi(\mathbf q(\tau))
\]
are integrated with an explicit embedded sixth-order RKN pair, RKN6(4)6FD, together with adaptive error control
\[
\max_i \frac{ \left|\hat s_i(\tau+\varepsilon)-\tilde s_i(\tau+\varepsilon)\right| }{ tol_a + tol_r\left|\hat s_i(\tau+\varepsilon)\right| } <1,
\]
for recommended tolerances \(tol_a=tol_r=10^{-3}\). Event times are located by integrating the hazard
\[
\Lambda(v;\mathbf z)=\int_0^v \lambda(\Xi_s(\mathbf z))\,ds
\]
along the numerical trajectory until it hits an \(\mathrm{Exp}(1)\) draw. The resulting process is approximate rather than exactly target-preserving, because there is no Metropolis correction, but the reported numerical bias is negligible relative to Monte Carlo error at these tolerances [2005.01285].

GRHMC also extends naturally to state-dependent event rates. A central example chooses
\[
\lambda(\mathbf q,\mathbf p) = \frac1\beta\sqrt{\mathbf p^\top \mathbf M^{-1}\mathbf p},
\]
for which the integrated hazard equals the Mahalanobis arc length of the position trajectory. This specification makes event times correspond to exponentially distributed arc lengths rather than exponentially distributed elapsed times [2005.01285].

RHMC ideas have also been extended to piecewise smooth targets. For continuous densities with discontinuous gradients, the proposed numerical rule is to truncate each ODE step at a boundary crossing, switch to the new region-specific gradient, and continue integrating, thereby preserving the order of the adaptive Runge–Kutta solver. For piecewise smooth densities, GRHMC is augmented with reflection/refraction momentum updates at boundaries, including a randomized reflection rule
\[
\bar{\mathbf p}' = \mathbf x - (\bar{\mathbf p}+\mathbf x)^T\hat{\mathbf n}(\bar{\mathbf q})\,\hat{\mathbf n}(\bar{\mathbf q}),
\qquad \mathbf x\sim \mathcal N(\mathbf 0_d,\mathbf I_d),
\]
which preserves the required boundary momentum law [2504.18210].

A geometric analogue, Randomized Time Riemannian Manifold Hamiltonian Monte Carlo (RT-RMHMC), carries the same randomized-duration mechanism to manifolds and constrained submanifolds. On a Riemannian manifold \((\mathcal M,g)\), the lifted target is
\[
\mu(dz)=\frac{1}{Z_{T\mathcal M}} e^{-H(x,v)}\, \lambda_{T\mathcal M}(dz),
\]
with Hamiltonian
\[
H(x,v) = U_{\mathcal H}(x)+\frac12 v^T G(x)^{-1} v.
\]
The generator is
\[
\mathcal L f(z)=X_H(f(z))+\lambda(Qf(z)-f(z)),
\]
where \(Q\) fully refreshes tangent velocities from the metric Gaussian. For embedded manifolds, the practical method uses constrained RATTLE integration, a random total trajectory time \(T\sim \exp(\lambda)\), and Metropolis acceptance
\[
\alpha\big((x,v),(x^*,v^*)\big)
= \min\left\{1,\exp\big(H(x,v)-H(x^*,v^*)\big)\right\}.
\]
The paper proves invariance in continuous time and ergodicity for the discretized constrained chain under stated assumptions [2206.04554].

## 6. Terminology, adjacent meanings of “RHMC,” and related methods

The acronym “RHMC” is not unique. In current literature, it may denote Randomized Hamiltonian Monte Carlo, Riemannian Hamiltonian Monte Carlo, or Relativistic Hamiltonian Monte Carlo, depending on context.

In computational statistics, “RHMC” frequently means Riemannian Hamiltonian Monte Carlo, i.e. HMC with a position-dependent metric
\[
H_R(\theta,p)=U(\theta)+\frac12\log|M(\theta)|+\frac12 p^\top M(\theta)^{-1}p.
\]
A recent line of work uses this acronym to denote Hessian-informed Riemannian methods and studies how to reduce diagonal-metric fixed-point costs from \(O(d^2)\) to \(O(d)\) on coordinate-friendly targets. This usage is conceptually distinct from randomized-duration RHMC, even though both belong to the broader Hamiltonian MCMC family [2606.05935].

Another distinct usage is Relativistic Hamiltonian Monte Carlo, which replaces the quadratic kinetic energy by
\[
K(p)=mc^2\left(\frac{p^\top p}{m^2c^2}+1\right)^{1/2},
\]
so that the induced velocity
\[
\dot{\theta} =\frac{p}{m\sqrt{1+\frac{p^\top p}{m^2c^2}}}
\]
is bounded by \(c\). This “RHMC” is not randomized-duration HMC; its relevance is indirect, through the broader theme that modifying Hamiltonian structure can improve robustness [1609.04388].

Within the randomized-duration family itself, RHMC is closely connected to GHMC and MALT. One comparison paper treats RHMC as a robust alternative to standard HMC on anisotropic targets, using the exact Gaussian formula
\[
X^n(i)=\cos\left(\frac{\tau_n}{\sigma_i}\right)X^{n-1}(i)+\sigma_i\sin\left(\frac{\tau_n}{\sigma_i}\right)\xi^n(i),
\qquad \tau_n \sim \mathrm{Exp}(\lambda),
\]
and derives lag-\(n\) correlations
\[
{\rm Corr}(X^{n}(i),X^0(i))=(r_i(T))^n,
\qquad
r_i(T)= \frac{\sigma_i^2}{\sigma_i^2+T^2}.
\]
That work emphasizes both the robustness of RHMC to anisotropy and a limitation for even functions, since
\[
s_i(T)=\frac{\sigma_i^2+2T^{2}}{\sigma_i^2+4T^{2}}
\]
controls square-function correlations and does not vanish as \(T\to\infty\) [2202.13230].

Taken together, these results establish Randomized Hamiltonian Monte Carlo as a distinct Hamiltonian-PDMP methodology defined by randomized flight times, typically exponential, with momentum refreshment at event times. Its most stable theoretical advantages arise in settings where deterministic path lengths create resonance or periodicity, and its modern extensions show that the same timing principle can be carried to state-dependent event mechanisms, manifold constraints, and piecewise smooth targets [1511.09382].

Source: https://www.emergentmind.com/topics/randomized-hamiltonian-monte-carlo-rhmc