Benchmarking Algorithms for Federated Domain Generalization

Ruqi Bai, Saurabh Bagchi, David I. Inouye

Introduction

This paper introduces a comprehensive benchmark for Federated Domain Generalization (FedDG), a challenging setting where models must generalize to unseen domains while training on decentralized, heterogeneous data. The authors propose a novel data partitioning method to simulate realistic client distributions and find that while specialized FedDG algorithms exist, they often struggle to outperform simple baselines like FedAvg when scaled to many clients or applied to complex, real-world datasets.

The Challenge: Federated Domain Generalization

In the machine learning world, we usually deal with two distinct types of "messy" data distributions:

  1. Federated Learning (FL): Data is decentralized across different devices (clients). It is often "non-IID," meaning the data distribution on one person’s device looks nothing like another’s.
  2. Domain Generalization (DG): The model is trained on a few environments (e.g., sunny photos) but must work reliably on a completely new, unseen environment (e.g., snowy photos).

Federated Domain Generalization (FedDG) combines both challenges. The goal is to train a model collaboratively across many private clients so that the final global model generalizes to a totally new domain it never saw during training.

Taxonomy of train-test heterogeneity in federated settings.

Previous research in this niche has been limited. Most studies used tiny datasets or made the unrealistic assumption that the number of clients equals the number of domains (e.g., 4 domains = 4 clients). In reality, federated networks might have thousands of clients but only a handful of distinct underlying "domains" (such as different hospital systems or camera types).

Methodology: Heterogeneous Partitioning

To rigorously test FedDG, the authors introduce a new Heterogeneous Partitioning method. This algorithm allows researchers to distribute any dataset across an arbitrary number of clients ($C$) while controlling the level of "domain-based client heterogeneity" using a parameter $\lambda$:

  • $\lambda = 1$ (Homogeneous): Every client gets a representative mix of all training domains.
  • $\lambda = 0$ (Complete Heterogeneity): Each client only sees data from a single domain.

By sweeping $\lambda$, researchers can test how sensitive an algorithm is to the "purity" of a client's local data. Using this framework, the authors evaluated 14 different methods categorized into Centralized DG adapted to FL (e.g., IRM, Mixup), Standard FL methods (e.g., FedProx, Scaffold), and Specialized FedDG methods (e.g., FedDG, FedSR).

Datasets Evaluated

The benchmark spans 7 diverse datasets to move beyond simple "toy" problems:

  • Image: PACS (standard DG), FEMNIST (handwritten digits), IWildCam (wildlife camera traps), CelebA (face attributes), and Camelyon17 (medical imaging).
  • Text: CivilComments (toxicity detection) and Py150 (code completion).

Notably, IWildCam and Py150 represent "realistic" challenges with hundreds or thousands of domains, making them significantly harder than classic datasets like PACS.

Key Insights and Results

Benchmark results on PACS and IWildCam datasets comparing centralized and federated approaches across varying heterogeneity.
  • The Scale Trap: Many FedDG algorithms that perform well with 5 or 10 clients fall apart when scaled to 100 clients. As the number of clients increases, performance plunges. On PACS, accuracy dropped from ~90% to as low as 10% for some methods as $C$ shifted from 1 to 200.
  • FedAvg is a "Boss" Baseline: Surprisingly, simple FedAvg with an Empirical Risk Minimization (ERM) objective remains a very strong baseline. Many complex DG-specific algorithms failed to beat it consistently across all datasets.
  • Performance Gaps on Real-World Data: There is a massive gap between "pseudo-realistic" datasets like PACS and "realistic" ones like IWildCam. On the IWildCam dataset (243 domains), the best-performing method only achieved ~30% accuracy in the federated setting, compared to ~35% in the centralized setting.
  • Heterogeneity Matters: As $\lambda$ decreases (data becomes more heterogeneous), performance drops across the board. For example, on CelebA, FedAvg accuracy dropped from 61% ($\lambda=1$) to 45% ($\lambda=0$).
  • Implicit Regularization: In a fascinating twist, the authors found that more communication isn't always better. Optimal DG performance often occurs after a relatively small number of communication rounds, suggesting that the "noise" of federated updates might act as a form of regularization that aids generalization.

Limitations and Future Work

While specialized methods like FedDG show promise under extreme heterogeneity on simpler datasets, they often require sharing data statistics (like image amplitude information) that might violate strict privacy protocols. Furthermore, methods utilizing GANs (like FedADG) are computationally expensive, taking up to 10-50x longer per communication round than FedAvg. Finally, on text datasets like CivilComments, many specialized FL methods actually hindered convergence compared to simple FedAvg.

The authors have released their benchmark code, providing a standardized environment for the community to test and develop future Federated Domain Generalization approaches.

Summary updated

BibTeX
@inproceedings{bai2024benchmarking,
  author = {Ruqi Bai and Saurabh Bagchi and David I. Inouye},
  title = {{Benchmarking Algorithms for Federated Domain Generalization}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=wprSv7ichW},
}
Figure