Personalized Federated Learning using Hypernetworks

Aviv Shamsian, Aviv Navon, Ethan Fetaya, Gal Chechik

Introduction

Standard Federated Learning (FL) aims to train a single global model across decentralized devices without compromising data privacy. However, this approach often struggles with data heterogeneity, where different clients possess data from vastly different distributions. Personalized Federated Learning (PFL) addresses this by tailoring models to individual users. Yet, existing PFL methods face significant hurdles: high communication costs, poor generalization to new clients, and the requirement for uniform model architectures across diverse hardware.

To overcome these challenges, the authors introduce pFedHN (Personalized Federated HyperNetwork), a framework that leverages a central hypernetwork to generate personalized model weights for each client.

The pFedHN Framework

The core innovation of pFedHN is the decoupling of the "teacher" (a central hypernetwork) from the "student" (the client-side target network).

Architecture and Workflow

In the pFedHN setup, a central hypernetwork $h$, parameterized by $\phi$, resides on the server. For each client $i$, the server maintains a small, trainable embedding vector $v_i$. The hypernetwork takes this embedding as input and outputs the weights $\theta_i = h(v_i; \phi)$ for that specific client's model.

Figure 1: Overview of the pFedHN architecture showing the central hypernetwork generating personalized weights for multiple clients.

The training loop proceeds as follows:

  1. Weight Generation: The server generates personalized weights $\theta_i$ for a selected client $i$ using the hypernetwork.
  2. Local Update: The client receives $\theta_i$, performs a few steps of local training on its private data, and computes the weight update $\Delta\theta_i$.
  3. Global Optimization: The client sends $\Delta\theta_i$ back to the server. The server then uses the chain rule to update the hypernetwork parameters $\phi$ and the client embedding $v_i$, effectively training the hypernetwork to predict optimal weights for that client's data distribution.

Key Advantages

  • Communication Efficiency: Only the target network's weights (or updates) are transmitted. The complex hypernetwork remains on the server, allowing for sophisticated models without increasing user data costs.
  • Resource Awareness: A single hypernetwork can be trained to generate models of varying sizes, allowing the system to support a heterogeneous fleet of devices ranging from powerful servers to low-power IoT sensors.
  • Zero-Shot Generalization: New clients can be integrated without retraining the hypernetwork by simply optimizing a new embedding vector $v_{new}$ to "locate" them on the learned weight manifold.

Experimental Evaluation

The authors evaluated pFedHN against state-of-the-art baselines, including pFedMe and Per-FedAvg, across several challenging datasets:

  • CIFAR-10 & CIFAR-100: Heterogeneously partitioned image classification tasks.
  • Omniglot: A high-diversity dataset of handwritten characters from 50 different alphabets, testing the system's ability to handle wildly varying tasks.

Results and Insights

pFedHN consistently outperformed competitors. On CIFAR-10 with 100 clients, it achieved approximately 88% accuracy, surpassing the next best method by 3%. Its performance was even more pronounced on the diverse Omniglot dataset, where a version with a personalized classifier head (pFedHN-PC) reached ~82% accuracy compared to ~73% for baselines.

Beyond accuracy, the hypernetwork essentially learns a continuous "manifold" of model weights. Visualizing the learned client embeddings using t-SNE reveals that the model naturally performs semantic clustering.

Figure 5: t-SNE visualization of learned client embeddings, demonstrating that pFedHN naturally clusters clients with similar data distributions.

As shown in the visualization, clients with similar data distributions (e.g., those assigned similar "Coarse Classes" in CIFAR-100) are grouped together in the embedding space. This confirms that the hypernetwork is learning meaningful relationships between different tasks and data distributions.

Conclusion

pFedHN represents a significant step forward in Personalized Federated Learning. By utilizing hypernetworks, it achieves high levels of personalization and superior accuracy while maintaining communication efficiency and supporting device diversity. Its ability to learn a weight manifold that semantically clusters clients provides both robust performance and a clear path for generalizing to novel users in dynamic federated environments.

Summary updated

BibTeX
@inproceedings{shamsian2021personalized,
  author = {Aviv Shamsian and Aviv Navon and Ethan Fetaya and Gal Chechik},
  title = {{Personalized Federated Learning using Hypernetworks}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=j5Tcr4hhBVF},
}
Figure