Abstract: Recent research has made the surprising finding that state-of-the-art deep learning models sometimes fail to generalize to small variations of the input. Adversarial training has been shown to be an effective approach to overcome this problem. However, its application has been limited to enforcing invariance to analytically defined transformations like lp-norm bounded perturbations. Such perturbations do not necessarily cover plausible real-world variations that preserve the semantics of the input (such as a change in lighting conditions). In this paper, we propose a novel approach to express and formalize robustness to these kinds of real-world transformations of the input. The two key ideas underlying our formulation are (1) leveraging disentangled representations of the input to define different factors of variations, and (2) generating new input images by adversarially composing the representations of different images. We use a StyleGAN model to demonstrate the efficacy of this framework. Specifically, we leverage the disentangled latent representations computed by a StyleGAN model to generate perturbations of an image that are similar to real-world variations (like adding make-up, or changing the skin-tone of a person) and train models to be invariant to these perturbations. Extensive experiments show that our method improves generalization and reduces the effect of spurious correlations (reducing the error rate of a "smile" detector by 21% for example).
Introduction: The Challenge of Semantic Robustness
Deep learning models are notoriously brittle. While they achieve superhuman performance on standard benchmarks, they often fail when faced with small variations in input. Traditionally, researchers have addressed this using adversarial training, which involves training models on images perturbed by small amounts of noise, usually defined by $L_p$-norms. However, there is a significant gap: pixel-level noise does not resemble real-world variations.
A self-driving car, for instance, does not fail because of a specific pattern of static; it fails because the lighting changed or the sun is at a different angle. These are semantic variations—changes that alter the appearance of an image without changing its underlying meaning (e.g., a "smiling" face remains smiling regardless of the person's skin tone or the ambient lighting). Standard models often latch onto these "spurious correlations," leading to biased or fragile predictions in practical applications.
Methodology: Adversarial Mixing (AdvMix)
To bridge this gap, we propose Adversarial Mixing (AdvMix), a framework that leverages the power of generative models—specifically StyleGAN—to create realistic, semantically meaningful perturbations. The method relies on two primary innovations:
- Disentangled Representations: StyleGAN separates an image's latent representation into different "styles" corresponding to different levels of detail. We identify a subset of these latents that are "label-independent" (e.g., fine details like lighting, color, or makeup) and others that are "label-dependent" (e.g., the core structure of a face or the shape of a mouth).
- Adversarial Mixing: To train a robust model, AdvMix performs an inner-maximization (similar to standard adversarial training) but within the latent space. Instead of adding random noise, it searches for the specific "style" from a pool of other images that, when mixed with the original image's "content," is most likely to induce a classification error.
By training the model to remain consistent even when these semantic attributes are adversarially swapped, the model learns to ignore the "noise" of lighting or skin tone and focus on the invariant features of the label.
Experimental Results and Bias Mitigation
We evaluated AdvMix on two primary datasets: Color-MNIST, a synthetic dataset where colors are correlated with labels to create shortcuts, and CelebA, a large-scale dataset of celebrity faces.
On the CelebA dataset, AdvMix reduced the error rate of a "smile" detector by 21% compared to nominal training. Crucially, AdvMix consistently outperformed standard data augmentation techniques like mixup, Cutout, and CutMix. While those methods often destroy image semantics (e.g., placing a hole in a face), AdvMix preserves the core identity while varying the style.
Furthermore, AdvMix addresses the common trade-off between robustness and accuracy. In traditional adversarial training, making a model robust to noise often makes it less accurate on clean images. We found that for semantic variations, this trade-off is minimal; robustness to real-world variations actually improves general accuracy by forcing the model to ignore spurious cues.
Conclusion and Future Directions
The primary limitation of AdvMix is its reliance on a high-quality pre-trained generative model. The framework is only as effective as the GAN's ability to disentangle representations. If the GAN's "style" latents accidentally include "content" information, the training process could become confused. Additionally, encoding real images back into the GAN's latent space is currently computationally expensive. Future work will focus on faster encoders and extending this framework to more complex natural scenes where high-quality GANs are harder to train.
Summary updated