Model-Contrastive Federated Learning

Qinbin Li, Bingsheng He, Dawn Song

Abstract

Federated Learning (FL) allows multiple parties to collaboratively train a model without sharing raw data, but it often suffers from "local drift" due to non-IID data distributions. This paper introduces MOON (Model-Contrastive Federated Learning), a framework that leverages model-level contrastive learning to align local updates with the global model. By treating the global model as a positive anchor and the previous local model as a negative anchor, MOON improves representation learning and achieves state-of-the-art accuracy and communication efficiency on image classification benchmarks like CIFAR-100 and Tiny-ImageNet.

Introduction

A major challenge in Federated Learning is data heterogeneity. When local data is non-IID (not identically and independently distributed), local model updates tend to drift toward local optima that do not align with the global objective. This "local drift" degrades the performance of the aggregated global model. While existing methods like FedProx and SCAFFOLD address weight or gradient divergence, they often struggle with the complex feature spaces of deep neural networks.

Methodology: The MOON Framework

MOON (Model-Contrastive Federated Learning) introduces a novel approach by applying contrastive learning at the model level rather than the data level.

Overview of the Federated Learning process. MOON focuses on improving step 2, the local model update.

Model-Contrastive Loss

During local training, MOON adds a contrastive loss term ($\ell_{con}$) to the standard cross-entropy loss. For a given input, the local party computes representations using three models:

  1. Current Local Model: The model being optimized in the current round.
  2. Global Model: The latest aggregated model from the server.
  3. Previous Local Model: The model from the party's previous training round.

The contrastive loss encourages the current local model's representations to be close to those of the global model (which has a more generalized view) and far from those of the previous local model (to prevent overfitting to the local skewed distribution).

Experimental Results

MOON was evaluated on CIFAR-10, CIFAR-100, and Tiny-ImageNet using Dirichlet distributions to simulate non-IID data.

Performance and Efficiency

MOON consistently outperformed baselines like FedAvg and FedProx. For instance, on CIFAR-100 with 100 parties, MOON achieved 61.8% top-1 accuracy, a significant improvement over the 55% achieved by the next best method. Furthermore, MOON demonstrated a 3.7x speedup in communication rounds on CIFAR-10 compared to FedAvg.

Representation Analysis

The effectiveness of MOON is visually evident in the quality of learned representations.

t-SNE visualization comparing representations from MOON (a, b) and FedAvg (c, d). MOON produces much clearer class separation.

As shown in the t-SNE plots, MOON maintains much tighter and more distinct class clusters in both the global and local models compared to FedAvg, directly demonstrating its ability to mitigate local drift.

Conclusion

MOON introduces a powerful yet simple regularization technique for federated learning. By focusing on the representation space, it effectively handles data heterogeneity, leading to more robust global models and significantly faster convergence.

Summary of "MOON: Model-Contrastive Federated Learning" (CVPR 2021).

Summary updated

BibTeX
@inproceedings{li2021model,
  author = {Qinbin Li and Bingsheng He and Dawn Song},
  title = {{Model-Contrastive Federated Learning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr46437.2021.01057},
}
Figure