Dual Prompt Tuning for Domain-Aware Federated Learning

Guoyizhe Wei, Feng Wang, Anshul Shah, Rama Chellappa · Submission to ICLR 2024 · Rejected

TL;DR

Standard federated learning struggles when clients share the same target classes but collect data across wildly different visual domains (e.g., photos vs. sketches vs. paintings). Federated Dual Prompt Tuning (Fed-DPT) addresses this domain shift by freezing a pre-trained CLIP model and tuning both domain-specific text prompts and shared visual prompts. By communicating only tiny prompt vectors rather than whole backbones, Fed-DPT achieves state-of-the-art domain adaptation performance with minimal communication overhead.

What Problem Does This Paper Address?

In standard Federated Learning (FL), clients collaboratively train a model without sharing raw data. Most research benchmarks simulate data heterogeneity by creating label imbalances (e.g., Client A gets dogs, Client B gets cats). In reality, however, clients often share target classes but face significant feature-level domain shift (e.g., hospital cameras vs. mobile phones, real-world photos vs. quickdraw sketches).

Full fine-tuning of large models in this decentralized context is problematic:

  1. It is communication-heavy.
  2. It suffers from poor convergence under severe heterogeneity.
  3. For vision-language foundation models like CLIP, full fine-tuning often breaks zero-shot alignment and domain generalization.

Methods

Fed-DPT keeps both the CLIP image encoder ($F_V$) and text encoder ($F_T$) completely frozen, training only lightweight prompt vectors:

  • Domain-Specific Text Prompts: For $n$ domains/clients, there are $n$ distinct text prompt sequences ($P_T^1, \dots, P_T^n$). Each client $i$ optimizes only its own prompt $P_T^i$ via gradients. Other prompts ($P_T^j, j \neq i$) are received from remote clients and updated locally via an exponential moving average (momentum update) to avoid sudden parameter shocks.
  • Domain-Correlating Visual Prompts: The vision transformer is prepended with $n$ learnable prompt tokens ($[v]_1, \dots, [v]_n$). In the last self-attention block, the attention weights $w_i$ between the [cls] token and prompt tokens are extracted to measure how strongly an input image correlates with each domain $i$.
  • Attention-Weighted Prediction: The final text representation is a weighted combination of all domain text features: $$f_T = \sum_{i=1}^n w_i f_T^i$$
  • Objective Function: Optimization uses a normalized $\ell_2$ (cosine similarity) loss between visual feature $f_V$ and $f_T$, which converges faster and performs better than standard cross-entropy in this setup.
  • Server Aggregation: The server aggregates text prompts by concatenation (broadcasting the full set back to all clients) and visual prompts by standard federated averaging (FedAvg).
   [ Client i Input Image ]                     [ Class Names ]
             │                                         │
    (ViT Image Encoder)                       (CLIP Text Encoder)
   ┌───────────────────┐                     ┌───────────────────┐
   │ [cls] + n Prompts │                     │   n Text Prompts  │
   └─────────┬─────────┘                     └─────────┬─────────┘
             │                                         │
      Extract Image feat f_V                   n domain feats {f_T^k}
     & Domain Weights (w_1..w_n)                       │
             │                                         ▼
             │                              Weighted Sum: f_T = Σ w_k f_T^k
             │                                         │
             └────────► Compute L2 Loss ◄──────────────┘
                       between f_V and f_T

Datasets

The authors evaluated Fed-DPT across three standard domain adaptation benchmarks (no new datasets were introduced):

  1. DomainNet: ~600,000 images across 345 categories in 6 diverse domains (clipart, infograph, painting, quickdraw, real, sketch).
  2. OfficeHome: ~15,500 images across 65 classes in 4 domains (art, clipart, product, real-world).
  3. PACS: ~10,000 images across 7 classes in 4 domains (photo, art painting, cartoon, sketch).

Key Insights and Ideas

  • Decoupling domain identity from client averaging: Averaging text prompts across domains destroys domain specialization. Instead, clients train their own local text prompts, share them globally, and let the visual self-attention mechanism figure out how much each domain prompt should contribute to a given image.
  • Momentum updates prevent representation collapse: When external text prompts are refreshed after a federated round, immediately replacing local copies degrades performance (accuracy drops by 2.2% without momentum). Smoothing updates via exponential moving average ($\alpha = 0.99$) maintains stability.
  • Parameter efficiency beats full fine-tuning under heterogeneity: Conventional models (ResNet-50, ViT-Base) trained with FedAvg or FedProx degrade or stall on extreme distribution shifts like DomainNet-Quickdraw. By tuning only 16.9k prompt parameters, Fed-DPT avoids catastrophic forgetting of CLIP’s foundational representations while cutting communication overhead by orders of magnitude.

Key Results

  • DomainNet: Fed-DPT achieved 68.4% average accuracy across six domains, outperforming zero-shot CLIP (53.6%), FedAvg (55.2%), and domain-agnostic prompt baselines like PromptFL (63.2%) and FedCLIP (60.3%).
  • Extreme Domain Resilience: On the challenging "quickdraw" domain, zero-shot CLIP scored only 13.5% and single-domain tuning achieved 18.8%. Fed-DPT jumped to 41.6%.
  • OfficeHome & PACS: Fed-DPT attained 82.9% on OfficeHome (vs. 78.6% zero-shot and 81.0% PromptFL) and 97.2% on PACS (vs. 95.8% zero-shot and 96.7% PromptFL).
  • Few-Shot Robustness: Under a strict 1-shot setup on DomainNet, Fed-DPT reached 55.4% accuracy, outperforming all other fine-tuning and prompt-tuning baselines.
  • Combined Label & Domain Heterogeneity: When splitting DomainNet into 30 non-i.i.d. clients using Dirichlet sampling, Fed-DPT dropped by only 1.5% accuracy, compared to drops of 3.6% for FedAvg and 2.9% for FedProx.

Limitations and Future Work

  • Domain count dependency: The number of visual prompt tokens and text prompt sets directly scales with the number of predefined domains $n$. Extending this to open-world setups where domain boundaries are unlabelled, continuous, or unknown remains unaddressed.
  • ViT requirement: The visual prompt routing mechanism relies on self-attention key/query tokens between the [cls] token and prompt tokens, making it primarily suited for transformer-based vision backbones rather than CNNs.

Summary updated

BibTeX
@misc{wei2023dual,
  author = {Guoyizhe Wei and Feng Wang and Anshul Shah and Rama Chellappa},
  title = {{Dual Prompt Tuning for Domain-Aware Federated Learning}},
  year = {2023},
  eprint = {2310.03103},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.03103},
}
Figure