Federated Learning from Pre-Trained Models: A Contrastive Learning Approach

Yue Tan, Guodong Long, Jie Ma, Lu Liu, Tianyi Zhou, Jing Jiang

In the world of machine learning, Federated Learning (FL) is the go-to strategy for training models on decentralized data without compromising privacy. However, as models grow into "foundational" giants like Vision Transformers, the cost of moving millions of parameters back and forth between servers and edge devices has become a massive bottleneck.

A new paper from researchers at the University of Technology Sydney, Google Research, and the Universities of Washington and Maryland proposes a clever pivot: Stop training these giants from scratch. Instead, learn how to combine the ones we already have.

TL;DR

The authors introduce FedPCL (Federated Prototype-wise Contrastive Learning), a framework that uses multiple fixed, pre-trained models as "backbones" and only trains a tiny fusion layer. By sharing class "prototypes" (representative embeddings) instead of massive model weights, they achieve higher accuracy with a fraction of the communication cost.

What Problem Does This Paper Address?

Standard Federated Learning faces two major hurdles:

  1. Resource Constraints: Training large-scale neural networks requires massive computation and high communication bandwidth, which most mobile or IoT devices simply don't have.
  2. Data Heterogeneity (Non-IID): Your "dog" photos might look very different from my "dog" photos (feature shift), or you might have only cats while I have only dogs (label shift). A single global model often fails to work well for everyone.

While "Personalized FL" (PFL) tries to solve the second problem, it often makes the first problem worse by requiring even more complex training loops. The authors ask: Can we leverage the power of existing, off-the-shelf pre-trained models to make FL both lightweight and personalized?

Methods

The researchers propose a shift in architecture. Instead of a single trainable model, each client uses $K$ fixed pre-trained backbones (like ResNet or ViT) as encoders. These backbones are never updated, meaning no expensive backpropagation through deep layers.

FedPCL Architecture

The only learnable part is a small Projection Network that fuses the representations from these backbones into a single embedding. To make this work across different clients, they introduce FedPCL:

  • Prototypes as Information Carriers: Instead of sending model weights to the server, clients send "prototypes"—the average embedding for each class (e.g., the "average cat" vector). These are tiny compared to model parameters.
  • Dual Contrastive Loss: During local training, the projection network is optimized using two types of contrastive signals:
  • Global Term: Pulls a sample's representation toward the global class prototype (shared knowledge).
  • Local Term: Aligns the representation with local prototypes from other clients (cross-client knowledge sharing).
  • Prototype Padding: To handle clients that might be missing certain classes, the server "pads" local prototype sets with global averages, ensuring everyone can learn a complete feature space.

Key Insights and Ideas

  • The Power of "Fixed": By freezing the backbones, the authors eliminate the need for high-end GPUs on client devices. The "learning" happens entirely in the fusion logic.
  • Prototypes > Parameters: Sharing prototypes is not only more efficient (reducing parameters by orders of magnitude) but also provides a layer of privacy, as prototypes are high-level statistics rather than raw data or sensitive gradients.
  • Multi-View Fusion: Using multiple backbones (e.g., one trained on natural images, one on sketches) allows the model to capture a "comprehensive view" of a sample that a single model might miss.
  • Personalization via Contrast: The contrastive approach allows each client to build a unique projection network that is "personalized" to their specific data distribution while still being anchored to global class concepts.

Key Results

The authors evaluated FedPCL on three major benchmarks designed to test "real-world" messiness: Digit-5, Office-10, and DomainNet. The results are a "win-win" for efficiency and performance:

Performance and Communication Costs
  • Massive Communication Savings: As shown in the results above, FedPCL required only 2,560 parameters to be communicated per round, compared to over 395,000 for standard FedAvg—a reduction of over 99%.
  • Superior Accuracy: On challenging datasets, FedPCL significantly outperformed baselines like FedAvg and even specialized PFL methods like FedRep. For instance, on DomainNet, it achieved 55.34% accuracy compared to FedAvg's 46.83%.
  • Scalability: Unlike many FL methods that degrade as more clients join, FedPCL's performance remained stable and even improved as the number of clients scaled from 5 to 80.
  • Architectural Flexibility: The framework successfully fused completely different architectures, such as combining a standard CNN with a Vision Transformer (ViT).

Limitations and Future Work

While the paper is a significant step forward, a few areas remain open:

  • Domain Focus: The study focuses almost exclusively on computer vision. The authors note that applying this to Natural Language Processing (NLP) tasks is a promising next step.
  • Backbone Selection: The performance depends on having "good" pre-trained backbones. How to automatically select the best $K$ backbones for a specific federated task remains an open question.
  • Privacy Nuances: While prototypes are more private than gradients, they aren't immune to all attacks. The authors touched on noise injection (Differential Privacy), but more rigorous privacy guarantees could be explored.

Final Thought: FedPCL suggests that the future of edge AI might not be about training bigger models, but about being smarter with the "foundation" models we already have.

Summary updated

BibTeX
@inproceedings{tan2022federated,
  author = {Yue Tan and Guodong Long and Jie Ma and Lu Liu and Tianyi Zhou and Jing Jiang},
  title = {{Federated Learning from Pre-Trained Models: A Contrastive Learning Approach}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=mhQLcMjWw75},
}
Figure