Principled Federated Domain Adaptation: Gradient Projection and Auto-Weighting

Enyi Jiang, Yibo Jacky Zhang, Sanmi Koyejo

TL;DR

This paper introduces a principled framework for Federated Domain Adaptation (FDA) to help clients with very little data benefit from others despite significant distribution shifts. By introducing a novel aggregation rule called FedGP and a theoretical auto-weighting scheme, the authors provide a way to filter out harmful source signals and optimally balance source and target information.

What Problem Does This Paper Address?

Standard Federated Learning (FL) assumes that all clients have enough data to contribute meaningful updates. However, in real-world scenarios like healthcare, a small local hospital (the "target") might have very little data and a distribution that differs significantly from larger hospitals (the "sources"). This creates two simultaneous hurdles: domain shift and data scarcity.

Existing techniques like Federated Averaging (FedAvg) or simple fine-tuning often fail here. FedAvg gets pulled away by the biased source data, while fine-tuning fails because the target's tiny dataset leads to rapid overfitting. The authors seek a "good" aggregation rule that allows a server to combine source and target updates in a way that truly minimizes the target's loss.

Methods

The authors approach the problem through both a new theoretical lens and a practical algorithm:

  1. The Delta Error Framework: They define a new metric, $\Delta^2_{Aggr}$, which measures the distance between the server's aggregated gradient and the true (but unknown) population gradient of the target domain. This framework allows them to decompose the error into components related to target variance (data scarcity) and source-target distance (domain shift).
  2. FedGP (Federated Gradient Projection): This is a novel aggregation rule. Instead of simple averaging, FedGP uses the target client's gradient as a "compass." It projects source gradients onto the target gradient's direction and filters out any source updates that point in a contradictory direction (negative projection). FedGP filters out negative source gradients (red) and combines the target gradient with positive projections of source gradients (green).

  3. Auto-Weighting: The theory provides a closed-form solution for the optimal weight ($\beta$) to assign to each source. This weight is calculated dynamically during training based on unbiased estimators of target domain variance and source-target domain distance.

Figure 1: FedGP filters out the negative source gradients (colored in red) and convexly combines gT and its projec- tions to to direction of the remaining source gradients (green ones).

Datasets

The authors evaluated their methods on a diverse set of benchmarks:

  • Semi-synthetic: Fashion-MNIST and CIFAR-10, where they manually injected Gaussian noise and label shifts to control the degree of domain divergence.
  • Real-world:
    • ColoredMNIST: A variant of MNIST with spurious color correlations.
  • VLCS: A classic domain adaptation benchmark (Vocal, LabelMe, Caltech, Sun).
  • TerraIncognita: Wildlife monitoring photos from different camera trap locations.
  • DomainNet: A large-scale dataset featuring different styles (e.g., sketches, photos, clipart).
  • Healthcare: Fed-Heart (from the FLamby benchmark), representing a realistic cross-silo FL setting.

Key Insights and Ideas

  • Noisy signals are still useful: Perhaps surprisingly, even when target data is extremely scarce and its gradient is noisy, that noise is still a valuable signal. It can effectively "gate" source gradients to prevent the model from drifting away from the target distribution.
  • Projection is the "Secret Sauce": The authors demonstrate that performing the projection operation before the convex combination of gradients is crucial. This allows the server to extract only the "beneficial" components of the source data.
  • Robustness to Hyperparameters: One of the most practical findings is that FedGP is remarkably robust to the choice of the weighting parameter $\beta$. While simple averaging (FedDA) is highly sensitive and requires careful tuning, FedGP performs well even with a default $\beta = 0.5$.
  • Disentangling Challenges: The "Delta error" metric successfully disentangles the impact of domain shift from the impact of data scarcity, providing a roadmap for future researchers to design better aggregation rules.

Key Results

FedGP and its auto-weighted version consistently outperformed state-of-the-art personalized FL (like Ditto and FedRep) and Unsupervised Federated Domain Adaptation (UFDA) methods.

  • Accuracy Gains: On the ColoredMNIST dataset, FedGP achieved an average accuracy of ~82.4%, compared to just ~49.0% for a "Source Only" approach and ~48.7% for standard FedAvg.
  • Impact of Projection: Ablation studies (Figure 4) show that gradient projection alone can provide a massive performance gain—up to 15% in high-shift scenarios—compared to simple convex combinations.
  • Shift Sensitivity: As shown in Figure 2, while standard methods degrade severely as domain shift increases, the proposed auto-weighted methods remain much more stable. Impact of changing domain shifts on target accuracy. Proposed methods (FedGP_Auto, FedDA_Auto) show significantly better stability than baselines.
Figure 2: The impact of changing domain shifts with noisy features or label shifts.

Limitations and Future Work

  • Communication and Computation: The auto-weighting scheme requires the target client to send $B$ intermediate batch updates to the server to estimate variance. This increases communication overhead and server-side computation.
  • Single Target Focus: The current work focuses on optimizing for a single target client. The authors note that extending this to a setting where multiple clients act as simultaneous targets is a promising direction for future research.
  • Scalability: While effective in cross-silo settings (few clients, like hospitals), the extra communication might become a bottleneck in cross-device settings with thousands of clients.

Summary updated

Abstract

Federated Domain Adaptation (FDA) describes the federated learning (FL) setting where source clients and a server work collaboratively to improve the performance of a target client where limited data is available. The domain shift between the source and target domains, coupled with limited data of the target client, makes FDA a challenging problem, e.g., common techniques such as federated averaging and fine-tuning fail due to domain shift and data scarcity. To theoretically understand the problem, we introduce new metrics that characterize the FDA setting and a theoretical framework with novel theorems for analyzing the performance of server aggregation rules. Further, we propose a novel lightweight aggregation rule, Federated Gradient Projection ($\texttt{FedGP}$), which significantly improves the target performance with domain shift and data scarcity. Moreover, our theory suggests an $\textit{auto-weighting scheme}$ that finds the optimal combinations of the source and target gradients. This scheme improves both $\texttt{FedGP}$ and a simpler heuristic aggregation rule. Extensive experiments verify the theoretical insights and illustrate the effectiveness of the proposed methods in practice.
BibTeX
@inproceedings{jiang2024principled,
  author = {Enyi Jiang and Yibo Jacky Zhang and Sanmi Koyejo},
  title = {{Principled Federated Domain Adaptation: Gradient Projection and Auto-Weighting}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=6J3ehSUrMU},
}
Figure