NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Asynchronous Gibbs Sampling

Alexander Terenin, Daniel Simpson, David Draper · DOI

Abstract

Gibbs sampling is a Markov Chain Monte Carlo (MCMC) method often used in Bayesian learning. MCMC methods can be difficult to deploy on parallel and distributed systems due to their inherently sequential nature. We study asynchronous Gibbs sampling, which achieves parallelism by simply ignoring sequential requirements. This method has been shown to produce good empirical results for some hierarchical models, and is popular in the topic modeling community, but was also shown to diverge for other targets. We introduce a theoretical framework for analyzing asynchronous Gibbs sampling and other extensions of MCMC that do not possess the Markov property. We prove that asynchronous Gibbs can be modified so that it converges under appropriate regularity conditions -- we call this the exact asynchronous Gibbs algorithm. We study asynchronous Gibbs on a set of examples by comparing the exact and approximate algorithms, including two where it works well, and one where it fails dramatically. We conclude with a set of heuristics to describe settings where the algorithm can be effectively used.

Introduction

In Bayesian inference, Markov Chain Monte Carlo (MCMC) is the standard for sampling from complex posterior distributions. However, MCMC faces a significant "scaling wall" because it is fundamentally sequential: the next state of a chain typically requires the exact current state. In distributed compute clusters, this requirement creates a massive bottleneck.

Practitioners often attempt to parallelize by allowing workers to update different variables simultaneously without synchronization. This "asynchronous" approach causes workers to use "stale" data—values updated by others that haven't yet propagated due to network latency. While this "Approximate Asynchronous Gibbs" is used in fields like topic modeling, it lacks theoretical safety and can diverge on certain models.

Methodology

This research bridges the gap between fast, risky asynchronous updates and slow, safe sequential sampling through two primary contributions:

  1. Exact Asynchronous Gibbs: The authors introduce a Metropolis-Hastings (MH) correction step. When a worker receives an update, it calculates an MH ratio based on the "stale" state the sender possessed at the time of the update. This ensures the algorithm converges to the correct target distribution despite communication delays.
  2. Theoretical Framework: Using "marginally coupled Markov operators," the authors provide a framework to analyze non-Markovian stochastic processes, proving convergence in total variation for the Exact algorithm.

The system was implemented using the Actor Model (via the Akka framework in Scala), which naturally handles asynchronous message passing between distributed workers.

Experimental Evaluation

The algorithms were evaluated on three distinct scenarios:

  • Gaussian Process Regression: A spatial model with $n = 71,500$ data points.
  • Mixed-effects Regression: A hierarchical model applied to a dataset of 1,000,000 eBay users.
  • Synthetic "Near-Singular" Gaussian: An 8-dimensional Gaussian with high component correlation, used as a stress test.

Results

The asynchronous implementation demonstrated significant scalability. On the eBay dataset, the asynchronous version with 20 workers reduced runtime from 12 hours to just 1 hour for 1,000 iterations.

Runtime comparison between sequential-scan and asynchronous Gibbs sampling on the eBay dataset.

The study also highlighted the critical role of the MH correction. In the "near-singular" stress test, the Approximate algorithm produced unstable results and incorrect sample covariance, while the Exact version maintained stability despite the high correlation.

Trace plots comparing Approximate and Exact algorithms across different target distributions.

Discussion and Heuristics

A key insight is that for many hierarchical models, the MH acceptance ratio in the Exact algorithm is frequently near 1.0. This explains the empirical success of uncorrected asynchronous Gibbs in specific domains. However, high internal dependence (correlation) remains a major failure mode; using stale information in such cases is akin to navigating a narrow ridge with high latency.

The authors propose heuristics for using uncorrected asynchronous Gibbs:

  1. The target density should not have excessive internal dependence.
  2. The number of variables should significantly exceed the number of workers.
  3. All variables should be updated via Gibbs steps.

Conclusion

Asynchronous Gibbs sampling, when augmented with a Metropolis-Hastings correction, provides a theoretically sound and highly scalable method for distributed Bayesian inference. While the "Exact" version ensures convergence, the "Approximate" version remains a viable, faster alternative for models with low internal dependence.

Summary updated

BibTeX
@inproceedings{terenin2020asynchronous,
  author = {Alexander Terenin and Daniel Simpson and David Draper},
  title = {{Asynchronous Gibbs Sampling}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2020},
}
Figure