Abstract
Decentralized learning allows a network of agents to collaboratively train models without centralizing data, preserving privacy and reducing communication overhead. While decentralized optimization is well-studied, decentralized Bayesian inference—particularly using high-fidelity samplers like Hamiltonian Monte Carlo (HMC)—remains challenging due to the global data requirements of the Metropolis-Hastings adjustment. This paper introduces a decentralized HMC algorithm that employs gradient tracking and a Taylor-series approximation of the Metropolis step. We demonstrate that this approach allows agents to sample from a global posterior with constant step sizes, providing superior uncertainty quantification compared to stochastic gradient variants.
Introduction
In the era of edge computing and privacy-sensitive data, decentralized machine learning has become a critical area of research. Most existing decentralized methods focus on point estimation through optimization. However, Bayesian inference is often preferred for its ability to provide principled uncertainty estimates, which are vital in safety-critical applications.
Hamiltonian Monte Carlo (HMC) is considered the gold standard for Bayesian sampling in high-dimensional spaces. Unlike Langevin dynamics, HMC uses Hamiltonian dynamics to propose distant samples, which are then accepted or rejected via a Metropolis step to correct for integration errors. In a decentralized setting, calculating this acceptance probability is problematic because it requires evaluating the likelihood over the entire global dataset, which is distributed across the network. Consequently, previous decentralized samplers have largely relied on "unadjusted" stochastic gradient methods (like SGLD or SGHMC), which suffer from asymptotic bias unless the step size is diminished to zero.
Methodology
The proposed algorithm bridges the gap between decentralized communication and the global requirements of the Metropolis adjustment through two primary innovations.
Gradient and Hessian Tracking
To ensure that each agent's local trajectory reflects the global posterior, the algorithm incorporates gradient tracking. Agents maintain a local estimate of the global gradient and Hessian by communicating with their immediate neighbors. This consensus-based approach allows agents to move according to the global landscape rather than being biased by their local data subsets.
Taylor-Approximated Metropolis Adjustment
The core challenge of decentralized HMC is the Metropolis-Hastings (MH) step. The MH ratio depends on the global Hamiltonian, which is the sum of local potential energies. To avoid global data sharing, the authors propose a second-order Taylor expansion of the Hamiltonian. By utilizing the tracked global gradients and Hessian-vector products, agents can compute a local approximation of the MH ratio that remains highly accurate.
The integration of the Hamiltonian dynamics follows a discrete-time update rule. A simplified version of the update step is shown in Algorithm 2.
By combining these tracked estimates with the Taylor-approximated MH step, the algorithm enables HMC with a constant step size, leading to faster convergence and more accurate posterior exploration than diminishing step-size alternatives.
Experiments and Results
The effectiveness of the decentralized HMC algorithm was evaluated across several benchmarks, ranging from synthetic toy problems to complex neural networks.
Synthetic Gaussian Mixture Model
Using a 2D Gaussian Mixture Model, the authors visualized the impact of the Metropolis adjustment. Without the adjustment, decentralized samplers tended to "leak" into low-probability regions due to integration bias. The proposed method successfully constrained the samples to the true posterior modes, demonstrating the necessity of the MH step for high-fidelity sampling.
Linear and Logistic Regression
On the Boston Housing (linear regression) and MNIST (logistic regression) datasets, the decentralized HMC algorithm significantly outperformed the Decentralized Unadjusted Langevin Algorithm (ULA). The results showed that the proposed method closely matched the performance of a centralized HMC sampler, which has access to the full dataset.
Bayesian Neural Networks (BNNs)
The algorithm's robustness was further tested on a non-convex BNN task using MNIST. In a challenging "non-IID" setup, one agent was provided only with digits 0-4, while another saw only digits 5-9. Despite this extreme data heterogeneity, the agents successfully reached a consensus and learned a joint model capable of classifying all ten digits accurately.
Discussion and Limitations
While the proposed method offers a significant advancement, it is not without limitations. The theoretical error bound between the decentralized approximation and the exact centralized HMC grows with the number of iterations, similar to the accumulation of error in numerical ODE solvers. Maintaining strict accuracy over very long chains may still require a slowly decreasing step size. Furthermore, while the algorithm shows strong empirical convergence, establishing formal ergodicity—the guarantee that the chain converges exactly to the target distribution—remains an open theoretical challenge.
Conclusion
This work presents the first decentralized version of Metropolis-adjusted HMC. By leveraging gradient tracking and Taylor approximations, the algorithm enables high-quality Bayesian inference across distributed networks without compromising data privacy. The results demonstrate that "true" HMC sampling is feasible in decentralized environments, opening new avenues for robust and uncertain-aware edge intelligence.
Summary updated