TL;DR
This paper introduces FedTPG, a novel federated learning approach for adapting large vision-language models like CLIP. FedTPG learns a text-driven prompt generator that creates context-aware prompts, significantly improving generalization to unseen classes and datasets compared to existing federated methods.
What Problem Does This Paper Address?
Vision-language models (VLMs) like CLIP have demonstrated impressive capabilities, but adapting them to specific downstream tasks often requires extensive fine-tuning, which is computationally expensive. Federated Learning (FL) offers a decentralized approach to train models while preserving data privacy, making it attractive for VLM adaptation. However, existing prompt learning methods in FL, such as FedCoOp, struggle to generalize to unseen classes or entirely new datasets. This limitation arises because they learn fixed, unified prompt vectors that are optimized for seen tasks and don't adapt well to new contexts. The core challenge is to enable VLMs to generalize effectively in a federated setting, even when faced with novel classes or entirely new domains, without incurring prohibitive computational costs.
Methods
The paper proposes Federated Text-driven Prompt Generation (FedTPG). Instead of learning fixed prompt vectors, FedTPG introduces a prompt generation network that is conditioned on task-specific text descriptions. This network takes natural language descriptions of classes (e.g., "a photo of a [class]") and transforms them into context-aware prompt vectors.
Key aspects of the method include:
- Text-driven Prompt Generation: A lightweight cross-attention module takes text embeddings of class names and generates prompt vectors. This allows the prompts to be dynamically adapted based on the input text, making them context-aware.
- Federated Learning Integration: The prompt generation network is trained collaboratively across multiple remote clients using a federated learning framework. Each client trains the generator on its local data, and the server aggregates the updated parameters. This approach is scalable and efficient.
- Generalization Focus: By conditioning prompts on text, FedTPG aims to capture richer semantic information that can generalize better to unseen classes and even unseen datasets, unlike methods that learn static prompt vectors.
Datasets
The paper uses a variety of datasets for evaluation:
- Nine diverse image classification datasets: Caltech101, Flowers102, FGVCAircraft, UCF101, OxfordPets, Food101, DTD, StanfordCars, and SUN397. These are used for evaluating generalization to unseen classes and datasets.
- Four variants of ImageNet: ImageNetV2, ImageNet-Sketch, ImageNet-A, and ImageNet-R. These are used to evaluate domain-shifted generalization.
No new benchmarks were introduced; the focus was on evaluating generalization on existing datasets.
Key Insights and Ideas
- Context is King for Generalization: The core insight is that fixed, learned prompt vectors limit generalization. By making prompts "text-driven" and context-aware, the model can adapt to new scenarios much more effectively.
- Federated Learning for Scalable Prompt Generation: Applying prompt generation within an FL framework allows for collaborative learning of a unified, generalized prompt generator without requiring massive centralized datasets or computational resources.
- Beyond Seen Classes: Existing federated prompt learning methods excel on seen classes but falter on unseen ones. FedTPG's text-driven approach directly tackles this limitation, showing significant improvements in unseen class performance.
- Cross-Dataset Transferability: The prompt generator, trained on a diverse set of tasks, learns to produce prompt vectors that are not only useful for the training tasks but also transfer well to entirely new, unseen datasets, demonstrating a strong form of domain generalization.
Key Results
- Superior Generalization: FedTPG consistently outperforms existing federated prompt learning methods (FedCoOp, FedKgCoOp) on unseen classes and unseen datasets.
- On average, FedTPG achieved 4.32% better generalization on unseen classes and 1.82% better generalization on unseen datasets compared to baselines.
- High Harmonic Mean: FedTPG achieved the highest harmonic mean (HM) of local, base, and new class accuracies across multiple experimental setups, indicating balanced performance.
- Robustness: The method shows robustness to the number of classes per client, the number of shots (training examples), and the participation rate of clients in the federated network.
- Qualitative Visualization: Visualizations of prompt vectors show that FedTPG generates context-specific prompts that cluster based on dataset context, unlike FedCoOp which produces less flexible unified prompts.
Limitations and Future Work
- Computational Cost of Text Embeddings: While FedTPG is more efficient than full VLM fine-tuning, generating text embeddings for class names still incurs some computational overhead.
- Dependence on Text Descriptions: The quality and informativeness of the text descriptions for classes directly impact the performance of the prompt generator.
- Future Work: The paper suggests exploring more sophisticated prompt generation mechanisms and investigating the application of FedTPG to other vision-language tasks beyond image classification. The authors also hint at the potential for further improvements by leveraging more advanced text encoders or cross-attention architectures.
Summary updated