Improving Out-of-Distribution Robustness of Classifiers via Generative Interpolation

Haoyue Bai, Ceyuan Yang, Yinghao Xu, S.-h. Gary Chan, Bolei ZhouarXiv 2023

Abstract

Deep neural networks achieve superior performance for learning from independent and identically distributed (i.i.d.) data. However, their performance deteriorates significantly when handling out-of-distribution (OoD) data, where the training and test are drawn from different distributions. In this paper, we explore utilizing the generative models as a data augmentation source for improving out-of-distribution robustness of neural classifiers. Specifically, we develop a simple yet effective method called Generative Interpolation to fuse generative models trained from multiple domains for synthesizing diverse OoD samples. Training a generative model directly on the source domains tends to suffer from mode collapse and sometimes amplifies the data bias. Instead, we first train a StyleGAN model on one source domain and then fine-tune it on the other domains, resulting in many correlated generators where their model parameters have the same initialization thus are aligned. We then linearly interpolate the model parameters of the generators to spawn new sets of generators. Such interpolated generators are used as an extra data augmentation source to train the classifiers. The interpolation coefficients can flexibly control the augmentation direction and strength. In addition, a style-mixing mechanism is applied to further improve the diversity of the generated OoD samples. Our experiments show that the proposed method explicitly increases the diversity of training domains and achieves consistent improvements over baselines across datasets and multiple different distribution shifts.

Introduction

Deep learning models are notoriously fragile when faced with data outside their training distribution. For instance, a classifier trained on high-resolution photos of animals might fail to recognize the same animals in sketches or paintings. This challenge, known as Out-of-Distribution (OoD) generalization, stems from models latching onto spurious correlations—like background or color—rather than essential semantic features like shape.

Standard mitigation strategies often involve data augmentation. A popular technique is Mixup, which linearly blends two images at the pixel level. However, as shown in the comparison below, mixing pixels often results in unnatural "ghost" images that do not represent realistic distribution shifts. This paper introduces Generative Interpolation (GIn), which moves the interpolation from pixel space to the model parameter space of generative models to create coherent, diverse synthetic training data.

Comparison between pixel-level Mixup and the proposed Generative Interpolation (GIn) method.

Methodology

The GIn framework operates in three primary stages to ensure the generated data is both visually realistic and semantically diverse:

  1. Alignment via Fine-tuning: To ensure that interpolating weights produces meaningful results, the authors first train a StyleGAN2 model on a primary source domain (e.g., Photos). This model is then fine-tuned on secondary domains (e.g., Art, Cartoon). Because these generators share the same weight initialization, their parameters become "aligned," allowing for smooth transitions between domains.
  2. Generative Interpolation (GIn): New "interpolated" generators are created by taking a convex combination of the model weights: $\theta_{interp} = \alpha_1\theta_1 + \alpha_2\theta_2 + \dots$. This process synthesizes images from "in-between" domains that were never explicitly present in the training set.
  3. Style-Mixing: To further enhance diversity, the authors utilize StyleGAN’s architecture to swap "styles" (such as background or texture) between generated images while preserving the core object shape.

By training classifiers on a combination of real-world data and this continuous spectrum of synthetic OoD samples, the model learns to ignore domain-specific noise and focus on robust features.

Experimental Results

The authors evaluated GIn across several benchmarks, including Colored MNIST, PACS (Photo, Art, Cartoon, Sketch), and iLab-2M (toy vehicles with varying viewpoints).

Qualitative Diversity

As illustrated in the figure below, GIn successfully generates a wide variety of samples by manipulating specific attributes. It can decouple shape from color, texture, and background, effectively "filling the gaps" in the data distribution. For example, in Colored MNIST, GIn can generate a "red 5" even if the training set only contained "green 5s," forcing the classifier to learn that the digit's shape is the defining feature.

Diverse synthetic samples generated by GIn across different attributes like color, texture, style, and background.

Quantitative Performance

GIn consistently outperformed state-of-the-art OoD algorithms:

  • Colored MNIST: GIn achieved 68.04% accuracy, significantly higher than standard Empirical Risk Minimization (ERM) at 55.93%.
  • PACS: Using a ResNet-18 backbone, GIn reached an average accuracy of 83.24%, surpassing both the ERM baseline (79.05%) and standard Mixup (80.09%).

Conclusion

Generative Interpolation provides a powerful mechanism for improving OoD robustness by creating a "synthetic playground" of diverse training samples. By interpolating in the parameter space of aligned GANs, the method produces more realistic and semantically meaningful augmentations than traditional pixel-level mixing. While the approach is computationally more intensive than simple augmentations and depends on the quality of the underlying generative model, it represents a significant step toward building more robust and generalizable neural networks.

Summary updated

BibTeX
@misc{bai2023improving,
  author = {Haoyue Bai and Ceyuan Yang and Yinghao Xu and S.-H. Gary Chan and Bolei Zhou},
  title = {{Improving Out-of-Distribution Robustness of Classifiers via Generative Interpolation}},
  year = {2023},
  eprint = {2307.12219},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.12219},
}
Figure