Federated stochastic gradient Langevin dynamics

Khaoula el Mekkaoui, Diego Mesquita, Paul Blomstedt, Samuel Kaski

Abstract

Standard stochastic gradient MCMC methods often fail in federated, non-IID (heterogeneous) settings because local gradients pull the model toward local biases, causing the Markov chain to diverge. This paper introduces Federated Stochastic Gradient Langevin Dynamics (FSGLD), which employs "conducive gradients"—simple, one-time local likelihood approximations—to correct these biases. This approach ensures convergence to the true global posterior with minimal communication overhead.

Introduction

Bayesian inference via Markov Chain Monte Carlo (MCMC) is considered the gold standard for uncertainty quantification, but its computational cost is often prohibitive for large-scale applications. Stochastic Gradient Langevin Dynamics (SGLD) scales MCMC by using mini-batch gradient estimates. However, in Federated Learning environments, data is siloed across devices and typically non-IID. In such settings, standard Distributed SGLD (DSGLD) suffers from high variance and divergence. When clients perform multiple local updates to save bandwidth, the Markov chain drifts toward local modes, sampling from a mixture of local posteriors rather than the true global posterior.

Methodology: Conducive Gradients

FSGLD addresses the divergence problem by introducing the conducive gradient. This method augments the local stochastic gradient with a correction term that nudges the update back toward the global center.

The process involves three steps:

  1. Surrogates: Each client $s$ computes a simple approximation $q_s(\theta)$ of its local likelihood.
  2. Global Approximation: These surrogates are sent to a central server once to form a global surrogate $q(\theta) = \prod q_s(\theta)$.
  3. The Correction: During training, a client uses the conducive gradient $g_s(\theta) = \nabla \log q(\theta) - \frac{1}{f_s} \nabla \log q_s(\theta)$.

Because these surrogates (typically from the exponential family) are computed only once at the start, the computational and communication overhead is negligible.

Visual comparison of sampling behavior: as the number of local updates (K) increases, DSGLD drifts toward local modes, whereas FSGLD remains centered on the global posterior.

Experimental Evaluation

The authors evaluated FSGLD across three distinct scenarios:

  • Synthetic Data: Gaussian mean estimation to visualize how chains diverge or converge.
  • Isolet (Spoken Letter Recognition): A Bayesian Metric Learning task with 10 non-IID shards where classes do not overlap between clients.
  • SUSY: A high-energy physics dataset for Bayesian Neural Networks, featuring 30 shards with extreme label imbalance.

Key Results and Insights

FSGLD demonstrates robustness where traditional methods fail. In the Gaussian mean estimation task, FSGLD remained centered on the true global mean regardless of communication delays, while DSGLD drifted toward local clusters as the number of local updates increased.

On the Isolet dataset, FSGLD achieved significantly higher average log-likelihoods on both training and test data compared to DSGLD, while exhibiting much lower standard deviation across runs.

Average log-likelihood on training (a) and test (b) sets for the Isolet dataset. FSGLD shows faster convergence and higher final likelihood than DSGLD.

In the non-IID SUSY experiment, FSGLD significantly outperformed DSGLD, achieving a test log-likelihood of -0.67 compared to -1.11 for DSGLD. In IID settings, both methods performed similarly, confirming that FSGLD is specifically designed to handle the challenges of data heterogeneity.

Conclusion

FSGLD provides a communication-efficient framework for federated Bayesian inference. By using static global approximations to guide local updates, it prevents the divergence common in non-IID settings. Future research may explore more expressive surrogates for complex, multi-modal posterior landscapes or dynamic updates to surrogates as the Markov chain explores the parameter space.

Summary updated

BibTeX
@inproceedings{mekkaoui2021federated,
  author = {Khaoula el Mekkaoui and Diego Mesquita and Paul Blomstedt and Samuel Kaski},
  title = {{Federated stochastic gradient Langevin dynamics}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2021},
  url = {https://openreview.net/forum?id=sr5zBmJQedK},
}
Figure