Papers › The No-U-Turn Sampler: Adaptively Setting Path Lengths in Hamiltonian Monte Carlo

The No-U-Turn Sampler: Adaptively Setting Path Lengths in Hamiltonian Monte Carlo

18 Nov 2011arXiv:1111.4246archive 2025-07-28

Matthew D. Hoffman, Andrew Gelman

Hamiltonian Monte Carlo (HMC) is a Markov chain Monte Carlo (MCMC) algorithm that avoids the random walk behavior and sensitivity to correlated parameters that plague many MCMC methods by taking a series of steps informed by first-order gradient information. These features allow it to converge to high-dimensional target distributions much more quickly than simpler methods such as random walk Metropolis or Gibbs sampling. However, HMC's performance is highly sensitive to two user-specified parameters: a step size {\epsilon} and a desired number of steps L. In particular, if L is too small then the algorithm exhibits undesirable random walk behavior, while if L is too large the algorithm wastes computation. We introduce the No-U-Turn Sampler (NUTS), an extension to HMC that eliminates the need to set a number of steps L. NUTS uses a recursive algorithm to build a set of likely candidate points that spans a wide swath of the target distribution, stopping automatically when it starts to double back and retrace its steps. Empirically, NUTS perform at least as efficiently as and sometimes more efficiently than a well tuned standard HMC method, without requiring user intervention or costly tuning runs. We also derive a method for adapting the step size parameter {\epsilon} on the fly based on primal-dual averaging. NUTS can thus be used with no hand-tuning at all. NUTS is also suitable for applications such as BUGS-style automatic inference engines that require efficient "turnkey" sampling algorithms.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1111.4246")

Code

Syntology Ran 6 of 9 code samples harvested from 2 repositories linked to this paper; 3 have no recorded run. Of those that ran: 1 ran · honoured contract; 1 ran · violated contract; 2 ran · our draft was wrong; 2 ran · fixture could not drive it.

By repository: community (archive-listed): 9 samples from 2 repositories, 6 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

4ment/phylostan mentioned on GitHubGPL-3.0 report
ColCarroll/minimc mentioned on GitHubMIT report
JohannesBuchner/PinNUTS mentioned on GitHub report
Matematija/continuous-vmc mentioned on GitHubjaxApache-2.0 report
al-jshen/d2b mentioned on GitHubMIT report
al-jshen/gmestan-examples mentioned on GitHubMIT report
lukuiR/Stan mentioned on GitHub report
mfouesneau/NUTS mentioned on GitHub report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

9 samples harvested; 6 ran; 1 honoured the contract we drafted; 3 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
1ran · violated contract
2ran · our draft was wrong
2ran · fixture could not drive it
3unverified

Licence: 0 of the 9 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

find_reasonable_epsilon mfouesneau/NUTS/nuts/nuts.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 20075d35f2319a01 · report
grad_logLikelihood mfouesneau/NUTS/examples/imf_examples.py community (archive-listed) ran · fixture could not drive it fingerprinted MIT (permissive) · 537a746770a10e4a · report
leapfrog mfouesneau/NUTS/nuts/nuts.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 7475a1db9181c908 · report
logLikelihood mfouesneau/NUTS/examples/imf_examples.py community (archive-listed) ran · fixture could not drive it fingerprinted MIT (permissive) · 18842e42f9d6dd71 · report
random_PowerLaw mfouesneau/NUTS/examples/imf_examples.py community (archive-listed) ran · honoured contract fingerprinted MIT (permissive) · cb1a1453761fca1d · report
stop_criterion mfouesneau/NUTS/nuts/nuts.py community (archive-listed) ran · violated contract fingerprinted MIT (permissive) · e6fec7e2a2392138 · report
build_tree JohannesBuchner/PinNUTS/pinnuts/pinnuts.py community (archive-listed) unverified MIT (permissive) · 4d864798cca4b23b · report
pinnuts JohannesBuchner/PinNUTS/pinnuts/pinnuts.py community (archive-listed) unverified MIT (permissive) · 4f8a7d049558a7a8 · report
tree_sample JohannesBuchner/PinNUTS/pinnuts/pinnuts.py community (archive-listed) unverified MIT (permissive) · 86a695959d00fddb · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections