Nested $\hat R$: Assessing the convergence of Markov chain Monte Carlo when running many short chains

Charles C. Margossian, Matthew D. Hoffman, Pavel Sountsov, Lionel Riou-Durand, Aki Vehtari, Andrew Gelman · DOI

Abstract

Recent developments in parallel Markov chain Monte Carlo (MCMC) algorithms allow us to run thousands of chains almost as quickly as a single chain, using hardware accelerators such as GPUs. While each chain still needs to forget its initial point during a warmup phase, the subsequent sampling phase can be shorter than in classical settings, where we run only a few chains. To determine if the resulting short chains are reliable, we need to assess how close the Markov chains are to their stationary distribution after warmup. The potential scale reduction factor $\widehat R$ is a popular convergence diagnostic but unfortunately can require a long sampling phase to work well. We present a nested design to overcome this challenge and a generalization called nested $\widehat R$. This new diagnostic works under conditions similar to $\widehat R$ and completes the workflow for GPU-friendly samplers. In addition, the proposed nesting provides theoretical insights into the utility of $\widehat R$, in both classical and short-chains regimes.

Introduction: The Many-Short-Chains Paradigm

Modern Bayesian inference has been transformed by GPU-accelerated samplers, which allow for the parallel execution of thousands of MCMC chains. This shift from a few long chains to many short chains presents a significant diagnostic challenge. Traditional convergence metrics, most notably the potential scale reduction factor ($\hat{R}$), are designed for the long-chain regime. In the many-short-chains setting, $\hat{R}$ often fails to distinguish between a lack of convergence (bias from initial conditions) and a lack of mixing (insufficient exploration by individual chains). Consequently, practitioners may over-sample, wasting computational resources, or worse, accept biased results.

Methods: Superchains and Nested Design

To address this, we introduce a nested design that isolates the influence of starting positions. Instead of treating all chains as independent, we group them into $K$ "superchains." Within each superchain, all subchains are initialized at the exact same starting point.

The resulting diagnostic, Nested $\hat{R}$ ($\hat{R}_\nu$), compares the variance between superchains (which originate from different initializations) to the variance within superchains (which originate from the same point). This nesting allows the "persistent variance" of the target distribution to be averaged out within the superchains, leaving the "nonstationary variance"—the signal of initial bias—as the primary metric for convergence.

Key Insights: Error Decomposition

The theoretical strength of $\hat{R}_\nu$ lies in its ability to decompose the total squared error of an MCMC estimate. As illustrated in the following diagram, the error consists of squared bias, nonstationary variance, and persistent variance.

Decomposition of squared error into bias and variance components, highlighting the elements monitored by the nested diagnostic.

By using dependent clusters (superchains), we can effectively "kill" the persistent variance that typically masks the convergence signal in short chains. We prove that nonstationary variance decays at the same exponential rate as the squared bias, making $\hat{R}_\nu$ a mathematically rigorous proxy for the decay of initial bias. Notably, this diagnostic remains functional even when $N=1$ (a single sample per chain), a scenario where traditional $\hat{R}$ is undefined.

Empirical Results

We evaluated $\hat{R}_\nu$ across various challenging target distributions, including the Rosenbrock "banana" and high-dimensional hierarchical models. In the Rosenbrock example, $\hat{R}_\nu$ correctly identified convergence in 512 chains within a few iterations, whereas traditional $\hat{R}$ remained misleadingly high.

Performance comparison: The left panel shows squared error for mean estimates, while the right panel demonstrates how $\hat{R}_\nu$ provides a more accurate convergence signal than standard $\hat{R}$ in the many-chains regime.

Our results demonstrate that $\hat{R}_\nu$ allows for a clear separation between "convergence" (reaching the target distribution) and "mixing" (traversing the entire space). A sampler can be converged if the collective ensemble of chains covers the target, even if individual chains have not yet mixed.

Conclusion and Future Directions

Nested $\hat{R}$ completes the workflow for modern, GPU-friendly samplers by providing a reliable stopping criterion for the many-short-chains regime. Future work includes developing adaptive warmup strategies that use $\hat{R}_\nu$ to automatically terminate the warmup phase, as well as extending the diagnostic to a robust multivariate framework. By leveraging dependency through nesting, we can finally harness the full power of massively parallel MCMC without sacrificing diagnostic rigor.

Summary updated

Abstract

Recent developments in parallel Markov chain Monte Carlo (MCMC) algorithms allow us to run thousands of chains almost as quickly as a single chain, using hardware accelerators such as GPUs. While each chain still needs to forget its initial point during a warmup phase, the subsequent sampling phase can be shorter than in classical settings, where we run only a few chains. To determine if the resulting short chains are reliable, we need to assess how close the Markov chains are to their stationary distribution after warmup. The potential scale reduction factor $\widehat R$ is a popular convergence diagnostic but unfortunately can require a long sampling phase to work well. We present a nested design to overcome this challenge and a generalization called nested $\widehat R$. This new diagnostic works under conditions similar to $\widehat R$ and completes the workflow for GPU-friendly samplers. In addition, the proposed nesting provides theoretical insights into the utility of $\widehat R$, in both classical and short-chains regimes.
BibTeX
@inproceedings{margossian2024nested,
  author = {Charles C. Margossian and Matthew D. Hoffman and Pavel Sountsov and Lionel Riou-Durand and Aki Vehtari and Andrew Gelman},
  title = {{Nested $\textbackslash\{\}hat R$: Assessing the convergence of Markov chain Monte Carlo when running many short chains}},
  booktitle = {Bayesian},
  year = {2024},
  doi = {10.1214/24-ba1453},
}
Figure