On the Unreasonable Effectiveness of Federated Averaging with Heterogeneous Data

Jianyu Wang, Rudrajit Das, Gauri Joshi, Satyen Kale, Zheng Xu, Tong Zhang

Abstract

Existing theory predicts that data heterogeneity will degrade the performance of the Federated Averaging (FedAvg) algorithm in federated learning. However, in practice, the simple FedAvg algorithm converges very well. This paper explains the seemingly unreasonable effectiveness of FedAvg that contradicts the previous theoretical predictions. We find that the key assumption of bounded gradient dissimilarity in previous theoretical analyses is too pessimistic to characterize data heterogeneity in practical applications. For a simple quadratic problem, we demonstrate there exist regimes where large gradient dissimilarity does not have any negative impact on the convergence of FedAvg. Motivated by this observation, we propose a new quantity, average drift at optimum, to measure the effects of data heterogeneity, and explicitly use it to present a new theoretical analysis of FedAvg. We show that the average drift at optimum is nearly zero across many real-world federated training tasks, whereas the gradient dissimilarity can be large. Our new analysis suggests FedAvg can have identical convergence rates in homogeneous and heterogeneous data settings, leading to a better understanding of its empirical success.

Introduction: The Theory-Practice Gap

Federated Averaging (FedAvg) is the "workhorse" of federated learning (FL), where data is distributed across many clients like mobile phones or IoT devices. In FedAvg, clients perform several local training steps before sending updates to a central server for averaging.

Despite its widespread use, a significant gap exists between theory and practice. Standard theoretical analyses rely on a metric called gradient dissimilarity to quantify data variation between clients. These analyses pessimistically predict that high heterogeneity should cause FedAvg to converge much more slowly (often $O(1/T^2)$). In reality, FedAvg performs remarkably well even on highly non-IID datasets. This research investigates why traditional theory fails and proposes a more accurate way to measure the impact of data heterogeneity.

Methodology: Average Drift at Optimum

The authors propose shifting the focus from global gradient differences to behavior near the global solution.

  1. Average Drift at Optimum ($\rho$): This new measure captures the average change in a local model after multiple descent steps starting specifically from the global optimal point.
  2. Pseudo-Gradient Framework: By treating a sequence of local updates as a single "pseudo-gradient" step, the authors apply standard optimization tools to analyze global model progress.
  3. New Theoretical Analysis: The paper provides convergence proofs for strongly convex and quadratic loss functions, explicitly using $\rho$ to characterize heterogeneity rather than the overly broad gradient dissimilarity.

Empirical Validation

The theory was validated using both synthetic models and real-world benchmarks, including FEMNIST (image classification) and StackOverflow (large-scale NLP). These datasets represent realistic "in-the-wild" heterogeneity where traditional metrics often fail.

Key Results

Empirical measurements confirm that the "average drift at optimum" remains near zero even as the number of local steps ($H$) increases. In contrast, the traditional theoretical bounds based on gradient dissimilarity grow significantly, proving they are poor predictors of actual performance.

Average drift at optimum vs. theoretical upper bound on FEMNIST.
Average drift at optimum vs. theoretical upper bound on StackOverflow.

The analysis shows that for deterministic settings, FedAvg achieves a linear convergence rate $O(\exp(-T))$, significantly faster than the $O(1/T^2)$ predicted by older theories. Furthermore, in practical regimes, FedAvg can outperform mini-batch SGD because local updates help mitigate "ill-conditioning" in the optimization landscape.

Insights: Why FedAvg Succeeds

The core insight is that previous metrics were too "noisy," capturing differences that don't actually conflict with the global goal. Clients can have wildly different data distributions but still "agree" on the direction of the global optimum. This often happens because clients share an underlying logic—such as language rules or physical laws—even if their specific inputs differ. When the average drift at optimum is zero, FedAvg converges at the same rate regardless of data homogeneity, explaining why complex algorithms designed to "fix" heterogeneity often fail to beat simple FedAvg in practice.

Limitations and Future Work

While this work provides a robust explanation for FedAvg's success, it primarily relies on strong convexity or quadratic assumptions. Modern deep learning involves non-convex neural networks. While $\rho$ is shown to be small empirically, providing a general theoretical bound for it across all model types remains an open challenge. Future research should aim to extend this "drift at optimum" analysis to general convex and non-convex functions to fully encompass modern deep learning architectures.

Summary updated

BibTeX
@article{wang2024unreasonable,
  author = {Jianyu Wang and Rudrajit Das and Gauri Joshi and Satyen Kale and Zheng Xu and Tong Zhang},
  title = {{On the Unreasonable Effectiveness of Federated Averaging with Heterogeneous Data}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=zF76Ga4EPs},
}
Figure