On the Unreasonable Effectiveness of Federated Averaging with Heterogeneous Data

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

Abstract: Existing theoretical results predict that the performance of federated averaging (FedAvg) is exacerbated by high data heterogeneity. However, in practice, FedAvg converges pretty well on several naturally heterogeneous datasets. In order to explain this seemingly unreasonable effectiveness of FedAvg that contradicts previous theoretical predictions, this paper introduces the client consensus hypothesis: on certain federated datasets, the average of local models updates on clients starting from the optimum is close to zero. We prove that under this hypothesis, data heterogeneity does not exacerbate the convergence of FedAvg. Moreover, we show that this hypothesis holds for a linear regression problem and some naturally heterogeneous datasets such as FEMNIST and StackOverflow. Therefore, we believe that this hypothesis can better explain the performance of FedAvg in practice.

The Federated Averaging Paradox

In Federated Learning (FL), the standard algorithm is Federated Averaging (FedAvg): clients perform several steps of local training before sending their model updates to a central server for averaging.

Existing theoretical models suggest that FedAvg should struggle as data becomes more heterogeneous across clients. This is due to "client drift," where local updates pull the model toward local minima that are far from the global optimum. However, practitioners have noticed a paradox: on many real-world datasets, FedAvg converges just as well on non-IID (heterogeneous) data as it does on IID (homogeneous) data. Furthermore, advanced algorithms designed specifically to "fix" client drift often fail to outperform basic FedAvg in practice. This paper bridges this gap by introducing the client consensus hypothesis.

The Client Consensus Hypothesis

The authors propose that while individual clients have heterogeneous data, their local updates tend to cancel each other out at the global optimum, effectively neutralizing the negative impact of data heterogeneity. Formally, they define a "pseudo-gradient" (the accumulated local updates) and hypothesize that the average of these pseudo-gradients across all clients, when evaluated at the global optimum, is close to zero.

Conceptual comparison between the traditional view of client drift and the proposed client consensus hypothesis.

This shift in focus from individual client dissimilarity to the collective behavior of the client population is key. Even if individual clients are "drifting" in different directions, these drifts often cancel each other out at the server. If the average update at the optimum is zero, the model can "stay" there once it arrives, preventing the final performance degradation predicted by older theories.

Theoretical and Empirical Results

The authors provide a new convergence analysis for strongly-convex and smooth functions. Unlike previous proofs that rely on "Bounded Gradient Dissimilarity," this new proof shows that if the average drift is zero, FedAvg achieves a linear speedup regardless of how different individual clients are. They also demonstrate that in linear regression settings where clients share the same underlying conditional probability $p(y|x)$ but have different feature distributions $p(x)$, the client consensus hypothesis holds as the number of clients grows.

Empirically, the paper validates these claims using naturally heterogeneous datasets like StackOverflow (next-word prediction) and FEMNIST (image classification). On StackOverflow, the authors showed that FedAvg's performance on the original non-IID data was nearly identical to its performance on a version of the data that had been shuffled to be IID.

FedAvg performance on the StackOverflow dataset, showing that natural heterogeneity (Non-IID) does not significantly degrade accuracy compared to the IID baseline.

In contrast, for artificial datasets where heterogeneity is forced (e.g., CIFAR-100 where each client only has a few classes), the hypothesis fails and drift remains high, explaining why FedAvg performs poorly in those specific, non-natural scenarios.

Conclusion and Future Work

This work suggests that the way we usually simulate "non-IID" data in research is often too extreme and doesn't reflect real-world data, where clients usually share a common underlying logic or "consensus." While the current theoretical proofs focus on strongly-convex functions, extending this to non-convex neural networks remains a challenge for future work. Additionally, developing practical metrics to check if a new dataset satisfies the client consensus hypothesis before training could significantly aid FL practitioners.

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