Localized Adversarial Domain Generalization

Wei Zhu, Le Lu, Jing Xiao, Mei Han, Jiebo Luo, Adam P. Harrison

TL;DR

Localized Adversarial Domain Generalization (LADG) improves model robustness to unseen data by ensuring that different domains are mixed at a fine-grained, local level in the feature space. By combining a localized domain discriminator based on label propagation with a coding-rate loss to prevent feature space collapse, LADG achieves state-of-the-art performance on several real-world distribution shift benchmarks.

What Problem Does This Paper Address?

Deep learning models are notoriously brittle when faced with "domain shift"—changes in data distribution between training and testing (e.g., a model trained on hospital photos failing on satellite imagery). Domain Generalization (DG) aims to build models that can handle these unseen shifts.

A popular approach is Adversarial Domain Generalization (ADG), where a "featurizer" tries to learn representations that fool a "discriminator" into being unable to tell which domain a sample came from. However, the authors identify two critical flaws in standard ADG:

  1. Incomplete Alignment: Standard discriminators look at the "global" distribution. Even if the global averages match, features often still form "local clusters" by domain, meaning they aren't truly mixed.
  2. Feature Space Collapse: In the heat of the adversarial battle, the featurizer often takes a "cheat" path: it squashes all features into a tiny, low-dimensional point. This makes domains indistinguishable but destroys the model's ability to actually perform its primary task (like classification), leading to severe overfitting.
Figure 1. Localized discriminator can align two domains in a more fine-grained way.

Methods

LADG introduces two main components to fix these issues:

  • Localized Domain Discriminator: Instead of a single global classifier, LADG uses label propagation. It builds a similarity graph of features in a mini-batch. If a sample's domain can be easily predicted by looking at its nearest neighbors, the domains are not well-mixed. The featurizer is then trained to maximize the uncertainty of this local prediction, forcing a "fine-grained" mixing of domains.
  • Space Compactness Maintenance: To stop the featurizer from collapsing the feature space, the authors introduce a coding-rate loss ($L_{cr}$). Based on information theory, this loss measures the "volume" or number of bits needed to represent the features. By penalizing a sharp drop in this volume, LADG ensures the feature space remains diverse and informative while still being domain-invariant.

Datasets

The authors evaluated LADG on the Wilds benchmark, which consists of diverse, real-world datasets representing different types of distribution shifts:

  • iWildCam: Species classification across different camera trap locations.
  • Camelyon17: Tumor identification across different hospitals.
  • PovertyMap: Predicting wealth from satellite images across different countries.
  • FMoW: Land use classification over different years and regions.
  • CivilComments: Toxicity detection across different demographic groups.
  • Amazon: Sentiment analysis across different reviewers.

They also used the PACS dataset (Photos, Art, Cartoons, Sketches) for visualization and analysis.

Key Insights and Ideas

  • ERM is "Roughly" Aligned: Surprisingly, simple Empirical Risk Minimization (ERM) already aligns domains to some extent because it clusters by class. The real discrepancy lies in the local neighborhoods where domains remain separated.
  • Adversarial Training is a Double-Edged Sword: While it helps remove domain-specific information, it naturally pushes the model toward feature collapse. Without explicit maintenance of feature diversity (like the coding-rate loss), ADG can be counterproductive.
  • Local vs. Global: Figure 2 illustrates this beautifully. While standard methods (DANN, CDANN) show some mixing, LADG produces a much more uniform blend of domains within each class cluster.
Figure 2. Visualization of learned representation on PACS dataset. * denotes testing domain. Different shape(color) represents different class(domain).

Key Results

LADG demonstrated superior and more consistent performance compared to leading competitors like CORAL, IRM, and DANN:

  • State-of-the-Art: It achieved the best results on 3 out of 6 Wilds datasets (iWildCam, Camelyon17, PovertyMap) and the second-best on FMoW.
  • Significant Gains: On the Camelyon17 (medical) dataset, LADG improved accuracy from the ERM baseline of 70.3% to 76.5%, significantly outperforming standard DANN (65.6%).
  • Stability: As shown in Figure 3, while other ADG methods see their feature space compactness (measured by coding rate $R(H)$) plummet during training, LADG maintains a stable, healthy feature space.
Figure 3. LADG alleviates feature space collapse compared to DANN and CDANN.

Limitations and Future Work

  • Linear Predictors: The current experiments focus on models with a linear final layer. The authors expect their findings to hold for non-linear predictors but haven't experimentally verified this yet.
  • Domain Weighting: LADG treats all domains as equally important. In practice, some "outlier" domains might need more attention (oversampling) to improve worst-case performance.
  • Scalability: Improving performance when the number of domains is extremely large (thousands) remains an open challenge for the field.

Summary updated

BibTeX
@misc{zhu2022localized,
  author = {Wei Zhu and Le Lu and Jing Xiao and Mei Han and Jiebo Luo and Adam P. Harrison},
  title = {{Localized Adversarial Domain Generalization}},
  year = {2022},
  eprint = {2205.04114},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.04114},
}
Figure