Achieving Robustness in the Wild via Adversarial Mixing with Disentangled Representations

Sven Gowal, Chongli Qin, Po-Sen Huang, Taylan Cemgil, Krishnamurthy Dvijotham, Timothy Mann, Pushmeet Kohli

TL;DR

Adversarial Mixing (AdvMix) leverages the disentangled latent space of generative models like StyleGAN to create realistic, semantic adversarial examples. By training models to be invariant to these "worst-case" semantic variations—such as changes in lighting, makeup, or skin tone—researchers can significantly improve generalization and reduce the impact of spurious correlations in real-world data.

What Problem Does This Paper Address?

State-of-the-art deep learning models are notoriously brittle. While they achieve high accuracy on standard benchmarks, they often fail when faced with "distribution shifts"—small, real-world variations that don't change the meaning of an image but confuse the network.

Traditional adversarial training attempts to fix this by adding small amounts of $\ell_p$-norm bounded noise (essentially random pixel static) during training. However, this doesn't capture "in the wild" variations like a change in lighting, a different camera angle, or a person putting on makeup. Furthermore, models often latch onto spurious correlations (e.g., a "smile" detector that only works for certain skin tones because of biases in the training set). The authors aim to move beyond pixel-level noise toward semantic robustness.

Methods

The core contribution is a framework called Adversarial Mixing with Disentangled Representations (AdvMix). It relies on two main pillars:

  1. Disentangled Latent Spaces: The authors assume the input data can be represented in a latent space $Z$ that is split into two parts: $Z_{||}$ (factors relevant to the label, like facial expression) and $Z_{\perp}$ (factors irrelevant to the label, like lighting or background color).
  2. Adversarial Composition: Instead of random data augmentation, AdvMix performs an "inner maximization" step. For a given image, it searches for the specific label-irrelevant variation ($z_{\perp}$) that most successfully tricks the current model. The model is then trained to correctly classify this "worst-case" semantic variant.

To implement this, the authors use StyleGAN. They exploit StyleGAN’s "style mixing" property, where coarse latent layers control high-level features (pose, face shape) and fine latent layers control low-level features (color, texture). By keeping coarse latents fixed and adversarially perturbing the fine latents, they generate realistic images that preserve the original semantics but challenge the classifier.

Illustration of the adversarial maximization process in the latent space.

Datasets

  • Color-MNIST: A synthetic version of the MNIST digit dataset where colors are purposefully correlated with labels in the training set to introduce bias, but randomized in the test set.
  • CelebA: A large-scale dataset of celebrity face images annotated with 40 attributes (e.g., "smiling," "wearing hat"). The authors specifically targeted the "smiling" attribute and three other anonymized attributes to test robustness against real-world semantic shifts.

Key Insights and Ideas

  • Staying "On-Manifold": Traditional augmentations like mixup or Cutout often produce images that look like corrupted nonsense to humans. AdvMix ensures that augmented data stays on the "natural image manifold," making the training signal more meaningful for real-world tasks.
  • Robustness vs. Accuracy: A common belief in machine learning is that robustness comes at the cost of accuracy. The authors show that when considering semantic variations rather than pixel noise, this trade-off isn't always necessary; AdvMix often improves both.
  • Data-Driven Environments: AdvMix can be seen as a way to automatically discover different "environments" for Invariant Risk Minimization (IRM). Instead of needing humans to label different lighting conditions or backgrounds, the generative model provides the playground for the adversary to find them.
Comparison on a toy example: AdvMix generates points consistent with the data distribution, whereas mixup generates unlikely "off-manifold" points.

Key Results

  • Spurious Correlation Reduction: On the biased Color-MNIST task, AdvMix achieved significantly higher accuracy on unbiased test data compared to standard training and other augmentation methods.
  • CelebA Performance: For the "smile" detector, AdvMix reduced the error rate by 21% compared to nominal training.
  • Consistency: As shown in Figure 1, models trained with AdvMix remain consistent across variations (like adding makeup), whereas classically trained models flip their predictions.
AdvMix maintains consistent classification ("Smiling") even when semantic attributes like makeup are changed, unlike classical training.

Limitations and Future Work

  • Generative Model Dependency: The success of AdvMix is strictly tied to the quality and disentanglement of the underlying generative model (e.g., StyleGAN). If the GAN cannot represent certain variations, the model cannot become robust to them.
  • Computational Cost: Mapping real-world images back into the StyleGAN latent space (encoding) requires an expensive optimization process, which could be a bottleneck for very large datasets.
  • Defining Independence: The method requires a-priori knowledge of which latent factors should be label-independent. Future work could explore ways to learn these dependencies automatically.

Summary updated

BibTeX
@inproceedings{gowal2020achieving,
  author = {Sven Gowal and Chongli Qin and Po-Sen Huang and Taylan Cemgil and Krishnamurthy Dvijotham and Timothy Mann and Pushmeet Kohli},
  title = {{Achieving Robustness in the Wild via Adversarial Mixing with Disentangled Representations}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  doi = {10.1109/cvpr42600.2020.00129},
}
Figure