TL;DR
FedTPG (Federated Text-driven Prompt Generation) shifts the paradigm of prompt learning for Vision-Language Models (VLMs) from learning static vectors to learning a context-aware prompt generator. By conditioning prompts on task-related text, this method significantly improves the ability of models like CLIP to generalize to unseen classes and entirely new datasets in a privacy-preserving, federated setting.
What Problem Does This Paper Address?
Vision-Language Models like CLIP have revolutionized image classification, but they are massive. In a Federated Learning (FL) environment—where data stays on local devices (clients) to preserve privacy—fine-tuning the entire CLIP model is computationally and communicatively prohibitive.
Researchers previously turned to Prompt Learning (e.g., CoOp), which keeps CLIP frozen and only learns a small set of "soft prompt" vectors (essentially virtual words). While efficient, these static vectors tend to overfit to the specific classes seen during training. In the decentralized FL setting, where different clients have different (non-IID) data distributions, existing methods like FedCoOp learn a single "one-size-fits-all" prompt that fails to adapt to the unique context of each client and generalizes poorly to new, unseen classes.
Methods
The authors propose FedTPG, which replaces fixed prompt vectors with a lightweight Text-driven Prompt Generation module.
Instead of learning a set of vectors $V$, FedTPG learns the parameters $\theta$ of a generator function $f_\theta(T)$, where $T$ represents the embeddings of the class names for a specific task.
Key components include:
- Context-Awareness: The generator uses a cross-attention mechanism. It takes a learnable query vector and attends to the text embeddings of the target classes. This allows the generated prompts to "know" what they are looking for based on the linguistic context of the task.
- Federated Optimization: The generator's parameters are trained collaboratively across multiple clients. Each client performs local training on its specific classes and sends only the generator's weights back to a central server for aggregation (FedAvg).
- Frozen Backbone: Throughout the process, the heavy CLIP image and text encoders remain frozen, ensuring the method remains efficient for edge devices.
Datasets
The authors conducted an extensive evaluation using:
- Nine diverse classification datasets: Caltech101 (objects), OxfordPets (animals), StanfordCars, Flowers102, Food101, FGVCAircraft, SUN397 (scenes), UCF101 (actions), and DTD (textures).
- Generalization Benchmarks: To test robustness against domain shift, they used ImageNet and its variants: ImageNetV2, ImageNet-Sketch, ImageNet-A, and ImageNet-R.
In their experiments, datasets were split into "base" classes (seen during training) and "new" classes (held out for testing generalization).
Key Insights and Ideas
- From "What" to "How": The core "aha moment" is that learning how to generate a prompt from text is more robust than learning the prompt itself. By tying the prompt to the class names, the model learns a mapping that naturally extends to new words it hasn't seen in a training pair.
- Contextual Clustering: Qualitative analysis (Figure 3) reveals that FedTPG's generated prompts for different datasets naturally cluster together based on their semantic context. Static methods like FedCoOp produce a single point that tries to represent everything, leading to a "master of none" problem.
- Synergy of FL and VLMs: The diversity of tasks across different federated clients actually helps the prompt generator. By seeing a wide variety of linguistic contexts during the collaborative training phase, the generator becomes more versatile.
Key Results
FedTPG consistently outperformed baseline methods across multiple dimensions:
- Unseen Class Generalization: On average across nine datasets, FedTPG improved accuracy on "new" (unseen) classes by 4.32% compared to FedCoOp.
- Cross-Dataset Generalization: When trained on ImageNet and tested on nine completely different datasets, FedTPG achieved an average accuracy of 67.25%, outperforming both zero-shot CLIP (67.01%) and FedCoOp (65.43%).
- Robustness: The method proved robust to variations in the number of training "shots" (images per class) and the participation rate of clients in the federated network.
Limitations and Future Work
While FedTPG shows strong results, the paper notes a few areas for further exploration:
- Text Input Complexity: The current model relies primarily on class names. Future work could explore using richer natural language descriptions or task-level metadata to further refine the prompt generation.
- Computational Overhead: Although lightweight, the addition of a cross-attention generator adds a small amount of compute compared to static vectors. Optimizing this for extremely resource-constrained devices remains a potential research path.
- Client Heterogeneity: While the model handles non-IID data well, extreme system heterogeneity (varying hardware capabilities across clients) was not the primary focus of this study.
Summary updated