Beyond Loss Functions: Exploring Data-Centric Approaches with Diffusion Model for Domain Generalization

Sobhan Hemati, Mahdi Beitollahi, Amir Hossein Estiri, Bassel Al Omari, Soufiane Lamghari, Yasser H. Khalil, Xi Chen, Guojun ZhangTMLR 2024

Abstract

There has been a huge effort to tackle the Domain Generalization (DG) problem with a focus on developing new loss functions. Inspired by the image generation capabilities of diffusion models, we pose a pivotal question: Can diffusion models function as data augmentation tools to address DG from a data-centric perspective, rather than relying on complex loss functions? Our findings reveal that trivial cross-domain data augmentation (CDGA) along with vanilla Empirical Risk Minimization (ERM) using readily available diffusion models outperforms state-of-the-art (SOTA) training algorithms. We empirically show that CDGA reduces domain shift, diminishes loss sharpness, and improves robustness against adversarial shifts. These insights advocate for further investigation into the potential of data-centric approaches in DG.

Introduction

Deep learning models are notoriously brittle when encountering data from a "domain" they haven't seen before—a problem known as Domain Generalization (DG). For example, a classifier trained on photos might fail on sketches or cartoons. Traditionally, researchers have addressed this by adding "regularizers" to the loss function (ERM) to force the model to learn domain-invariant features. However, benchmarks like DomainBed have shown that these complex algorithms often struggle to consistently beat simple ERM across diverse datasets. We hypothesize that the path to robust AI lies not in more complex math, but in more imaginative data.

Methodology: Cross Domain Generative Augmentation (CDGA)

We propose a data-centric approach called Cross Domain Generative Augmentation (CDGA). Instead of tweaking the training algorithm, we expand the training set using a pre-trained Latent Diffusion Model (LDM). The core idea is to "interpolate" between domains, creating a smoother data manifold for the model to learn from.

Figure 1: The CDGA process uses a Latent Diffusion Model (LDM) to generate synthetic images that combine the content of one domain with the style of another.

As illustrated in Figure 1, CDGA takes an image from a source domain (e.g., a photo) and uses guidance—such as text prompts ("Painting") or reference images—to generate a synthetic version that retains the original class but adopts the style of a different domain. This effectively fills the empty "no-man's-land" between distinct domains in the feature space.

Empirical Analysis and Insights

Our investigation into why this rudimentary data generation outperforms complicated DG algorithms yielded several key insights:

  • Bridging the Gap: t-SNE visualizations show that synthetic images generated by CDGA act as bridges, making it easier for the model to find a decision boundary that generalizes across domains.
  • Vicinal Risk Minimization (VRM): CDGA creates points between domain pairs, significantly reducing the estimation error that occurs when a model tries to generalize to unseen styles.
  • Sharpness and Robustness: Training with CDGA leads to a "flatter" loss landscape, which is associated with better generalization. It also improves robustness against adversarial attacks.

Results

We evaluated CDGA + ERM on the DomainBed benchmark across four diverse datasets: PACS, OfficeHome, VLCS, and DomainNet.

Figure 2: Performance improvements of ERM + CDGA over standard ERM and other state-of-the-art algorithms across various datasets.

The results are striking. By simply using ERM + CDGA, we achieved a new SOTA, outperforming specialized algorithms like CORAL and Fishr. As shown in Figure 2, on the challenging DomainNet dataset, CDGA + ERM showed an 8.5% improvement over standard ERM, nearly doubling the gains of the previous best method.

Conclusion

This paper suggests that the future of Domain Generalization may be data-centric. By using generative models to "hallucinate" the gaps between our datasets, we can build models that are much better prepared for the multi-domain reality of the real world. While computational costs remain a factor, the consistency and magnitude of the gains advocate for a shift in focus from loss functions to generative data augmentation.

Summary updated

BibTeX
@article{hemati2024beyond,
  author = {Sobhan Hemati and Mahdi Beitollahi and Amir Hossein Estiri and Bassel Al Omari and Soufiane Lamghari and Yasser H. Khalil and Xi Chen and Guojun Zhang},
  title = {{Beyond Loss Functions: Exploring Data-Centric Approaches with Diffusion Model for Domain Generalization}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=WHIwUjbJEh},
}
Figure