Topology-aware Generalization of Decentralized SGD

Tongtian Zhu, Fengxiang He, Lan Zhang, Zhengyang Niu, Mingli Song, Dacheng Tao · OpenReview

Abstract

This paper studies the algorithmic stability and generalizability of decentralized stochastic gradient descent (D-SGD). We prove that the consensus model learned by D-SGD is $\mathcal{O}{(m/N-1/m-\lambda^2)}$-stable in expectation, where $N$ is the total sample size of the whole system, $m$ is the worker number, and $\lambda$ is the spectral gap that measures the connectivity of the communication topology. These results then deliver an $\mathcal{O}{((1-(n\lambda^2)^{\alpha/2}-(n^2/m)^{\alpha/2})/N)}$ in-average generalization bound, characterizing the gap between the training performance and the test performance. Our bound is non-vacuous even when the spectral gap $\lambda$ is closed to $1$, in contrast to vacuous as suggested by the existing literature on the projected version of D-SGD. Our theory indicates that the generalizability of D-SGD has a positive correlation with the spectral gap. Experiments of VGG-11 and ResNet-18 on CIFAR-10 and Tiny-ImageNet justify our theory. To the best of our knowledge, this is the first work on the topology-aware generalization of vanilla D-SGD.

Introduction

In Decentralized SGD (D-SGD), multiple "workers" (such as edge devices or servers) train a model simultaneously. Unlike centralized approaches, workers only communicate with their immediate neighbors in a network topology. While D-SGD is prized for its privacy and scalability, its generalizability—how well the final model performs on unseen data—has remained poorly understood.

Previous research primarily focused on convergence rates, often ignoring how the network's "shape" (topology) affects the quality of the learned state. Furthermore, existing theoretical bounds were often "vacuous," providing little useful information for sparse networks or large worker counts. This paper bridges this gap by investigating how communication topology directly impacts D-SGD's generalizability.

Methodology

The authors analyze D-SGD through the lens of algorithmic stability. An algorithm is considered stable if its output does not change significantly when a single data point in the training set is swapped. High stability typically correlates with strong generalization performance.

Distributed On-average Stability

A new stability metric was developed specifically for decentralized systems to account for model sensitivity across multiple workers. Unlike many existing works that assume perfectly smooth loss functions, this study employs a weaker H"{o}lder continuous condition. This ensures the theory remains applicable to real-world deep learning models using non-smooth components like ReLU activations.

Communication Topologies

The connectivity of the network is quantified using the spectral gap ($1-\lambda$) of the communication matrix. The study evaluates several standard topologies to observe how connectivity influences generalization.

Common communication topologies evaluated in the study, including Fully-connected, Ring, Star, Grid, and Exponential graphs.

The theory was validated using standard computer vision benchmarks, including CIFAR-10, CIFAR-100, and Tiny-ImageNet, utilizing VGG-11 and ResNet-18 architectures across worker counts of 32 and 64.

Theoretical Insights

  • Connectivity as a Generalization Driver: The spectral gap is the primary lever for generalization. A larger spectral gap (indicating a better-connected network) leads to higher stability and lower generalization error.
  • The Worker Count Trade-off: In topologies like rings or grids, increasing the number of workers can paradoxically hurt generalization. As the network grows, it becomes "longer" or "sparser," hindering information flow across the system.
  • Importance of Early Consensus: The mathematical framework explains why forcing models to agree (consensus control) during the initial training phase is critical. Controlling consensus distance early on is more effective at improving algorithmic stability than doing so later.
  • Information Aggregation: Denser topologies allow workers to "indirectly" access more data from neighbors at each step, effectively increasing the diversity of information seen by each node.

Key Results

The research establishes a clear hierarchy in generalization performance based on topology: Fully-connected $\approx$ Exponential < Grid < Ring (where lower values indicate better generalization).

The authors proved that the consensus model is $O(m/N + 1/m + \lambda^2)$-stable. Experimental results on CIFAR-10 with 64 workers confirmed this, showing that the "Ring" topology resulted in significantly higher validation loss compared to "Fully-connected" or "Exponential" topologies. This validates the claim that poor connectivity leads to a larger generalization gap.

Discussion and Future Work

While this work provides a foundational understanding of topology-aware generalization, several avenues for future research remain:

  • Non-IID Data: This study assumes data is Independent and Identically Distributed (IID) across workers. In real-world decentralized scenarios like Federated Learning, data is often highly non-IID, which may alter these dynamics.
  • Implicit Bias: The authors suggest that decentralized communication noise might push models toward "flatter" minima. Exploring this implicit bias is a promising direction.
  • Optimization-Generalization Trade-off: While fully-connected networks generalize best, they may be less stable in very early training stages due to rapid convergence. Balancing this trade-off is an open area for investigation.

Summary updated

BibTeX
@misc{zhu2022topology,
  author = {Tongtian Zhu and Fengxiang He and Lan Zhang and Zhengyang Niu and Mingli Song and Dacheng Tao},
  title = {{Topology-aware Generalization of Decentralized SGD}},
  year = {2022},
  eprint = {2206.12680},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.12680},
}
Figure