Abstract Markov chain Monte Carlo (MCMC) methods are foundational to Bayesian statistics but are often computationally prohibitive for large-scale datasets. This paper presents a "systems perspective" on accelerating Gibbs sampling by leveraging the massive parallelism of Graphics Processing Units (GPUs). By exploiting the conditional independence of latent variables in exchangeable models, the authors demonstrate how to implement MCMC in a fully data-parallel manner. Using a Horseshoe Probit regression model as a case study, the implementation achieves up to a 35x speedup over high-end multi-core workstations, enabling the processing of datasets with millions of observations and thousands of predictors in minutes.
Introduction
Bayesian inference provides a powerful framework for quantifying uncertainty, yet its reliance on MCMC algorithms like Gibbs sampling often leads to significant computational bottlenecks. Traditionally, MCMC is viewed as an inherently sequential process where each state depends on the previous one. As datasets scale to millions of observations ($N$) and thousands of predictors ($p$), standard CPU-based implementations become impractical. While distributed computing offers one path forward, the synchronization overhead between nodes often limits efficiency. This study investigates the use of a single GPU to achieve massive parallelism through a fundamentally different algorithmic approach.
Methodology
The core innovation lies in identifying parallelism within exchangeable models that utilize latent variable representations.
Parallelism via Data Augmentation
In many Bayesian models, conditioning on global parameters ($\theta$) renders the latent variables ($z_i$) for each observation independent. This allows for the simultaneous update of all $N$ variables across thousands of GPU threads, transforming a sequential bottleneck into a data-parallel task.
The Horseshoe Probit Model
The authors apply this principle to the Horseshoe Probit model, which is favored for high-dimensional regression due to its ability to shrink irrelevant coefficients while preserving significant effects. The implementation leverages NVIDIA’s CUDA platform, utilizing optimized libraries such as cuBLAS and cuSOLVER for linear algebra, alongside custom kernels for sampling from truncated normal distributions and specialized rejection samplers. A key technical contribution is the management of "warp divergence," ensuring threads stay synchronized during execution to maintain high hardware utilization.
Experimental Evaluation
The approach was evaluated on two fronts:
- Synthetic Data: Datasets with $N$ ranging from 10,000 to 1,000,000 and $p$ from 100 to 10,000 were used to benchmark scaling against laptops and 16-core workstations.
- Real-World Medical Data: A dataset of 1,295,848 hospital episodes with 141 clinical predictors was used to predict rare unplanned ICU transfers.
Results
The GPU implementation consistently outperformed traditional CPU-based setups, with efficiency gains increasing alongside problem size. Larger datasets provide more work to "hide" the latency of memory access, allowing the GPU to reach hardware saturation.
As shown in the performance benchmarks, for a synthetic dataset with $N=1,000,000$ and $p=1,000$, a high-end 16-core workstation required 71 minutes, whereas the GPU completed the task in just 2 minutes and 17 seconds. On smaller scales ($N=10,000, p=1,000$), a standard laptop took 95 minutes compared to the GPU's 41 seconds. In the real-world medical application, 10,000 iterations were completed in under 3 minutes, successfully identifying key clinical predictors through the Horseshoe prior's effective sparsity.
Discussion and Conclusion
While the speedups are transformative, the study identifies several ongoing challenges. Hardware constraints, specifically GPU VRAM, limited the execution of the largest models (e.g., $N=1M, p=10k$). Furthermore, the complexity of writing low-level CUDA code remains a significant barrier for practitioners. Future work may involve "streaming" data through the GPU or leveraging high-level frameworks like PyTorch to automate kernel generation. Despite these hurdles, this research demonstrates that rethinking MCMC from a systems perspective can unlock the scale necessary for modern big-data Bayesian analysis.
Summary updated