Abstract
Federated Prototype Learning (FedPL) has emerged as an effective strategy for handling data heterogeneity in Federated Learning (FL). In FedPL, clients collaboratively construct a set of global feature centers (prototypes), and let local features align with these prototypes to mitigate the effects of data heterogeneity. The performance of FedPL highly depends on the quality of prototypes. Existing methods assume that larger inter-class distances among prototypes yield better performance, and thus design different methods to increase these distances. However, we observe that while these methods increase prototype distances to enhance class discrimination, they inevitably disrupt essential semantic relationships among classes, which are crucial for model generalization. This raises an important question: how to construct prototypes that inherently preserve semantic relationships among classes? Directly learning these relationships from limited and heterogeneous client data can be problematic in FL. Recently, the success of pre-trained language models (PLMs) demonstrates their ability to capture semantic relationships from vast textual corpora. Motivated by this, we propose FedTSP, a novel method that leverages PLMs to construct semantically enriched prototypes from the textual modality, enabling more effective collaboration in heterogeneous data settings. We first use a large language model (LLM) to generate fine-grained textual descriptions for each class, which are then processed by a PLM on the server to form textual prototypes. To address the modality gap between client image models and the PLM, we introduce trainable prompts, allowing prototypes to adapt better to client tasks. Extensive experiments demonstrate that FedTSP mitigates data heterogeneity while significantly accelerating convergence.
Introduction
Federated Learning (FL) enables multiple clients—such as mobile devices or medical institutions—to collaboratively train models without sharing raw data. A primary challenge in this domain is data heterogeneity (non-IID data), where local data distributions vary significantly across clients. For instance, one client may possess only images of animals, while another focuses on vehicles.
To address this, Federated Prototype Learning (FedPL) has been widely adopted. In FedPL, the server maintains "prototypes" (feature centers) for each class. However, current methods often suffer from a "distance obsession," attempting to maximize the distance between class prototypes to improve discriminability. This approach inadvertently destroys natural semantic relationships. Forcing a "dog" prototype to be as distant from a "cat" as it is from a "ship" causes the model to lose shared features (e.g., fur, ears) that are vital for generalization.
Methodology: FedTSP
We propose FedTSP (Textual Semantics-Powered Prototypes), a framework that leverages the textual modality to inject "semantic common sense" into the training process. Instead of relying on biased client data to form prototypes, FedTSP uses textual descriptions as stable anchors.
The FedTSP workflow consists of four key steps:
- LLM-based Prompt Generation: On the server, an LLM (e.g., ChatGPT) generates detailed descriptions for each class (e.g., "a furry mammal with floppy ears" for a dog).
- Textual Prototype Construction: A Pre-trained Language Model (PLM) encodes these descriptions into high-dimensional vectors, serving as global prototypes.
- Trainable Prompts: To bridge the "modality gap" between textual prototypes and visual features, we introduce trainable prompts within the PLM to adapt prototypes to the specific visual tasks of the clients.
- Contrastive Alignment: Clients align their local image features with these textual prototypes using a contrastive loss, preserving the semantic hierarchy learned from text.
Experimental Setup and Results
We evaluated FedTSP on standard benchmarks—CIFAR-10, CIFAR-100, and Tiny ImageNet—using a Dirichlet distribution to simulate varying levels of data heterogeneity.
Key Performance Metrics
- Accuracy Boost: FedTSP outperformed state-of-the-art (SOTA) methods like FedProto and FedTGP by up to 4.20% on CIFAR-100.
- Rapid Convergence: FedTSP achieves high accuracy significantly faster than competitors, often reaching in 50 rounds what others achieve in over 200, thereby reducing communication overhead.
- Robustness: The framework remains stable across varying client counts (up to 200) and handles model heterogeneity, where clients utilize different neural architectures (e.g., ResNet vs. simple CNNs).
Discussion: The Importance of Semantic Relationships
A core insight of this work is that preserving semantic relationships is essential for robust generalization. When a model understands that a dog is more similar to a cat than a truck, its errors become "smarter" (e.g., misclassifying a dog as a cat), leading to higher Top-5 accuracy.
As shown in the similarity matrices above, SOTA methods like AlignFed create a uniform, meaningless spread between classes. In contrast, FedTSP preserves the inherent clusters found in natural language, providing a stable "knowledge anchor" that fragmented image data cannot provide.
Conclusion and Future Work
FedTSP demonstrates that textual semantics can effectively guide visual representation in heterogeneous federated environments. While the server-side LLM and PLM introduce some computational overhead, the gains in convergence speed and accuracy are substantial. Future research will explore "active" prompting to evolve descriptions based on client-side visual challenges and extending this text-guided approach to more complex tasks like object detection and segmentation.
Summary updated