FedProc: Prototypical Contrastive Federated Learning on Non-IID data

Xutong Mu, Yulong Shen, Ke Cheng, Xueli Geng, Jiaxuan Fu, Tao Zhang, Zhiwei Zhang

TL;DR

This paper introduces FedProc, a novel federated learning framework designed to tackle the challenge of non-IID (non-independent and identically distributed) data across clients. By leveraging "prototypes" (class-wise mean representations) as global knowledge, FedProc guides local model training to align better with the global optimum, significantly improving accuracy on image classification tasks.

What Problem Does This Paper Address?

Federated learning (FL) enables collaborative training of machine learning models across multiple decentralized clients without sharing raw data, thus preserving privacy. However, a major hurdle in real-world FL is the non-IID nature of data distributed across clients. This means each client's local dataset might have a different distribution of classes or features, leading to a "drift" in local model training. This drift causes local objectives to diverge from the global optimum, significantly degrading the performance of the final aggregated model, especially in image classification. Existing methods have attempted to address this through improved aggregation or by stabilizing local training, but they often don't fully utilize the inherent knowledge within the data distributions.

Methods

FedProc introduces a new approach by incorporating "prototypical contrastive learning" into the federated learning paradigm. The core idea is to use global class prototypes as a form of "global knowledge" to correct local training.

Here's a breakdown of the key components:

  • Global Prototypes: The server aggregates class prototypes (mean feature vectors for each class) from all clients. These global prototypes are then broadcast back to the clients.
  • Local Network Architecture: Each client uses a local network composed of a base encoder, a projection head (to map representations), and an output layer for classification.
  • Global Prototypical Contrastive Loss ($l_{gpc}$): This novel loss function encourages local models to pull samples towards the global prototype of their correct class and push them away from prototypes of other classes. This helps create a more consistent embedding space across clients.
  • Hybrid Loss Function: The local training objective is a weighted combination of the global prototypical contrastive loss ($l_{gpc}$) and a standard cross-entropy loss ($l_{ce}$). A coefficient $\alpha$ dynamically adjusts the weights of these two losses throughout training, prioritizing feature learning (with $l_{gpc}$) in early stages and classifier learning (with $l_{ce}$) in later stages.

Datasets

The paper evaluates FedProc on three standard image classification datasets:

  • CIFAR-10: 10 classes
  • CIFAR-100: 100 classes
  • Tiny-ImageNet: 200 classes

Non-IID data distributions were generated using a Dirichlet distribution, a common technique in FL research to simulate heterogeneous data.

Key Insights and Ideas

  • Prototypes as Global Knowledge: The central insight is that class prototypes, when aggregated globally, can serve as a powerful signal to guide local training and mitigate the negative effects of non-IID data. This is a novel perspective compared to methods that focus solely on model parameters or aggregation strategies.
  • Bridging Feature and Classifier Learning: The dynamic weighting of contrastive loss and cross-entropy loss allows FedProc to progressively learn better representations first, and then leverage these representations for accurate classification. This two-stage learning, implicitly handled by the coefficient $\alpha$, is crucial for performance.
  • Visualizing the Impact: T-SNE visualizations clearly demonstrate how FedProc aligns the feature distributions of different clients, making them consistent with the global distribution, unlike baseline methods.

Key Results

  • Superior Accuracy on Non-IID Data: FedProc consistently outperforms state-of-the-art federated learning methods (MOON, FedProx, SCAFFOLD, FedAvg) on CIFAR-10, CIFAR-100, and Tiny-ImageNet datasets.
  • It achieves improvements of 1.6% to 7.9% in top-1 accuracy compared to MOON.
  • On CIFAR-100 with 100 clients, FedProc reaches 70.6% top-1 accuracy, significantly better than the reported 61.8% from existing approaches.
  • Robustness to Data Heterogeneity: FedProc maintains its performance advantage even with highly imbalanced data distributions (low $\beta$ values in Dirichlet distribution).
  • Acceptable Computation Cost: While introducing new loss terms, FedProc's training time per round is comparable to other advanced methods, showing good efficiency.
  • Scalability: FedProc demonstrates excellent scalability with an increasing number of clients (50 and 100), maintaining its accuracy advantage.

Limitations and Future Work

  • Overfitting with High Local Epochs: The paper notes that increasing local epochs beyond a certain point (E=10) can lead to overfitting on skewed data, reducing global model accuracy. This suggests a need for careful tuning of local training parameters.
  • Future Work: The paper implicitly suggests that further exploration of prototype-based contrastive learning in federated settings could lead to even more robust and efficient solutions for diverse FL challenges. The current work focuses on image classification, and extending it to other domains like natural language processing or tabular data could be a valuable future direction.

Summary updated

BibTeX
@article{mu2021fedproc,
  author = {Xutong Mu and Yulong Shen and Ke Cheng and Xueli Geng and Jiaxuan Fu and Tao Zhang and Zhiwei Zhang},
  title = {{FedProc: Prototypical Contrastive Federated Learning on Non-IID data}},
  journal = {Future Generation Computer Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=4Uj5NvzJYz},
}
Figure