pFedSim: Similarity-Aware Model Aggregation Towards Personalized Federated Learning

Jiahao Tan, Yipeng Zhou, Gang Liu, Jessie Hui Wang, Shui YuarXiv 2023 · DOI

Introduction

Federated Learning (FL) has emerged as a powerful paradigm for training machine learning models across decentralized clients while preserving data privacy. However, a significant challenge remains: statistical heterogeneity, or "non-IID" data. When clients possess vastly different data distributions—for instance, one client having only images of animals while another has vehicles—a single global model often fails to generalize effectively for everyone.

Personalized Federated Learning (pFL) addresses this by tailoring models to individual clients. Current approaches typically rely on either similarity-based aggregation (grouping clients with similar data) or model decoupling (sharing a feature extractor while keeping a local classifier). However, similarity-based methods often risk privacy leakage by requiring metadata sharing, while simple decoupling may miss opportunities to leverage shared knowledge between similar clients.

The pFedSim Approach

pFedSim (Personalized Federated Learning based on Model Similarity) bridges these two strategies. It utilizes a two-phase training process that combines model decoupling with a novel similarity-aware aggregation mechanism.

Model Decoupling and the Similarity Metric

pFedSim treats the neural network as a combination of a feature extractor ($\omega$) and a classifier ($\phi$). The core innovation lies in how client similarity is determined. Through an empirical study using Centered Kernel Alignment (CKA), the authors demonstrated that the weights of the final classifier layer serve as the most reliable "fingerprint" for a client's local data distribution.

CKA similarity matrices across network layers. As depth increases, the classifier layer (Layer 4) shows the most distinct representation of local data distributions.

As shown in the figure above, the similarity between models becomes increasingly indicative of data distribution as we move deeper into the network. By using the classifier weights as a proxy for data similarity, pFedSim avoids the need for clients to share sensitive metadata or raw data statistics.

Two-Phase Execution

The training process is divided into two distinct stages:

  1. Generalization Phase: Standard FedAvg is employed for initial rounds to "warm up" the feature extractor, ensuring it learns fundamental patterns common across all data.
  2. Personalization Phase: The server computes a similarity matrix based on the uploaded classifiers. For each client, the server aggregates a personalized feature extractor by weighting the models of "like-minded" peers. The classifier itself remains local to maintain fine-grained personalization.

Key Insights: Classifiers as Proxies

The "aha moment" of pFedSim is the realization that the final fully connected layer effectively captures the decision boundaries relevant to a client's specific task. By comparing these weights, the server can quantify how much two clients overlap in their learning objectives.

Visualization of decision boundary ownership and similarity between two clients. The similarity score (0.53) reflects the shared knowledge between clients i and j.

This approach ensures privacy by using model weights as the sole source of similarity information, preventing the "metadata leakage" prevalent in other similarity-based pFL algorithms. It achieves a "best of both worlds" scenario: clients benefit from a "neighborhood" of knowledge without the communication overhead of sending multiple models or the privacy risks of sharing data distributions.

Experimental Results

The researchers evaluated pFedSim across five benchmarks (CIFAR-10, CINIC-10, EMNIST, Tiny-ImageNet, and DomainNet) with varying degrees of heterogeneity. Key findings include:

  • Superior Accuracy: pFedSim consistently outperformed state-of-the-art baselines like FedRep and FedFomo, with an average accuracy improvement of 2.96%.
  • Robustness to Heterogeneity: In highly non-IID settings ($\alpha=0.1$), pFedSim's advantage became even more pronounced. On Tiny-ImageNet, it achieved 64.91% accuracy, compared to just 27.66% for standard FedAvg.
  • Efficiency: pFedSim maintains the low communication and computation overhead of standard FedAvg ($O(\nu_m)$), making it highly scalable compared to methods requiring auxiliary generators or multi-model transmissions.

Conclusion and Future Work

pFedSim offers a robust and privacy-preserving solution for personalized federated learning. By leveraging the classifier as a proxy for data similarity, it enables effective collaboration between similar clients.

Future research may address the architecture dependence of the method, as it currently relies on a clear separation between the feature extractor and a linear classifier. Additionally, optimizing server-side storage for personalized models will be crucial for scaling the system to millions of clients.

Summary updated

BibTeX
@misc{tan2023pfedsim,
  author = {Jiahao Tan and Yipeng Zhou and Gang Liu and Jessie Hui Wang and Shui Yu},
  title = {{pFedSim: Similarity-Aware Model Aggregation Towards Personalized Federated Learning}},
  year = {2023},
  eprint = {2305.15706},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.15706},
}
Figure