Direct-Effect Risk Minimization

Yuhui Li, Zejia Wu, Chao Zhang, Hongyang ZhangOpenReview 2022

TL;DR

This paper tackles the challenge of domain generalization, where machine learning models fail when encountering data with different attribute correlations than they were trained on. They introduce a novel "Direct-Effect Risk Minimization" (DRM) approach that leverages causal inference to disentangle stable causal relationships from spurious correlations, significantly improving model robustness and performance on out-of-distribution datasets.

What Problem Does This Paper Address?

Machine learning models often rely on the assumption that training and testing data come from the same distribution (i.i.d.). However, in real-world scenarios, this assumption frequently breaks. A common issue is "correlation shift," where the statistical relationships between features and labels change across domains. For example, a model trained to identify dogs might learn that dogs are often associated with parks. If tested on images of dogs in beaches, its performance could drop because the spurious correlation (dogs-parks) is no longer present. This paper aims to build models that are resilient to such correlation shifts, ensuring reliable performance even when the underlying data distributions change.

Methods

The core of the proposed method, Direct-Effect Risk Minimization (DRM), is a two-stage approach inspired by causal inference:

  • Stage 1: Recovering Indirect Effects: The first stage focuses on identifying and isolating "indirect effects." These are the spurious correlations that vary across domains. The authors achieve this by training an "extractor" network that learns a representation ($Z$) of the data ($X$). This representation, along with the class label ($Y$), is then used to predict the domain label ($E$) via a discriminator. By forcing the extractor to learn a representation that can predict the domain, it effectively captures the spurious correlations that are domain-specific.
  • Stage 2: Eliminating Indirect Effects (Training & Validation Balancing): In the second stage, the goal is to remove these identified indirect effects.
  • Training Balancing (TB): The authors create "balanced batches" by pairing samples that have similar indirect-effect representations ($Z$) but different class labels ($Y$). This encourages the model to learn from the stable causal relationships rather than the spurious ones.
  • Validation Balancing (VB): A similar balancing strategy is applied to the validation set. This is crucial because standard validation sets can also suffer from correlation shifts, leading to misleading model selection. By balancing the validation set, the authors ensure that model selection is based on true generalization capabilities, not on spurious correlations present in the validation data.

This approach is designed to be compatible with existing domain generalization methods, aiming to improve their performance.

Datasets

The paper evaluates DRM on several datasets known for correlation shifts:

  • Colored MNIST (CMNIST): Spurious correlations are introduced by artificially coloring digits (e.g., red for label 1, green for label 0).
  • 3DShapes: Uses attributes like "floor hue" and "orientation" to create spurious correlations.
  • DSprites: Employs "Position X" and "Position Y" for spurious correlations.
  • CelebA-HB and CelebA-NS: These are real-world datasets where correlation shifts arise from non-random sampling (selection bias), using attributes like "Wearing Hat" vs. "No Beard" or "Wearing Necktie" vs. "Smiling."

The experiments also include results on diversity-shifted datasets from the DomainBed benchmark (e.g., PACS, VLCS, OfficeHome, TerraIncognita) to show that DRM does not negatively impact performance on other types of domain shifts.

Key Insights and Ideas

  • Causal Inference for Robustness: The paper makes a strong case for using causal inference concepts (direct vs. indirect effects) as a principled way to understand and address correlation shifts in domain generalization.
  • Disentangling Stable vs. Spurious Features: The two-stage approach effectively disentangles domain-specific spurious features from stable, causal features, which is key to achieving generalization.
  • The Problem with Standard Validation: A critical insight is that standard validation sets can be misleading in domain generalization due to their own potential correlation shifts. The proposed validation balancing (VB) directly tackles this issue.
  • Compatibility with Existing Methods: DRM is presented as a framework that can be combined with other domain generalization techniques, offering a way to boost their performance.

Key Results

  • Significant Performance Gains: DRM achieves substantial improvements on correlation-shifted datasets. For instance, on Colored MNIST, it shows an absolute improvement of up to 15% over state-of-the-art methods. On the most difficult "-90%" environment of CMNIST, DRM achieves 69.7% accuracy, a ~60% improvement over other algorithms.
  • Effective Balancing: Ablation studies (Table 2) demonstrate that both training balancing (TB) and validation balancing (VB) contribute significantly to the performance gains, with their combination yielding the best results.
  • Robustness on Diversity Shift: DRM does not harm performance on diversity-shifted datasets, showing its versatility.
  • Visual Evidence: Attention maps and t-SNE visualizations of the learned representations confirm that DRM focuses on stable features ("No Beard," "Smiling") rather than spurious ones ("Wearing Hat," "Wearing Necktie").

Limitations and Future Work

  • Observability of Indirect Effects: The method relies on recovering the indirect-effect representation ($Z$). While effective, the paper acknowledges that in some complex scenarios, identifying and isolating these effects might be challenging.
  • Foundation Models: The paper notes that while large-scale foundation models excel at diversity shifts, they show limited improvement on correlation shifts. DRM aims to bridge this gap, suggesting future work could explore integrating DRM with foundation models for enhanced correlation shift generalization.
  • Hyperparameter Tuning: While the paper follows DomainBed's protocol for hyperparameter search, the effectiveness of DRM might still depend on careful tuning, especially when combined with other algorithms.

Summary updated

BibTeX
@misc{li2022direct,
  author = {Yuhui Li and Zejia Wu and Chao Zhang and Hongyang Zhang},
  title = {{Direct-Effect Risk Minimization}},
  year = {2022},
  url = {https://openreview.net/forum?id=fkmO7EFaNT},
  howpublished = {OpenReview},
}
Figure