Abstract
Deep neural networks (DNNs) are vulnerable to adversarial examples with small perturbations. Adversarial defense thus has been an important means which improves the robustness of DNNs by defending against adversarial examples. Existing defense methods focus on some specific types of adversarial examples and may fail to defend well in real-world applications. In practice, we may face many types of attacks where the exact type of adversarial examples in real-world applications can be even unknown. In this paper, motivated by that adversarial examples are more likely to appear near the classification boundary, we study adversarial examples from a new perspective that whether we can defend against adversarial examples by pulling them back to the original clean distribution. We theoretically and empirically verify the existence of defense affine transformations that restore adversarial examples. Relying on this, we learn a defense transformer to counterattack the adversarial examples by parameterizing the affine transformations and exploiting the boundary information of DNNs. Extensive experiments on both toy and real-world datasets demonstrate the effectiveness and generalization of our defense transformer.
Introduction
Deep Neural Networks (DNNs) are notoriously fragile to adversarial attacks—images with tiny, often invisible perturbations that cause models to misclassify them. Most current defense strategies suffer from two primary flaws: they are often specific to one type of attack (e.g., additive noise) and fail against others (e.g., spatial deformations), or they rely on random transformations that may "miss" the clean data distribution.
This research introduces the Defense Transformer, a novel architecture that "counterattacks" adversarial examples. The core insight is that simple geometric changes—such as rotation, scaling, or shifting—can "undo" complex adversarial perturbations by moving the sample back across the decision boundary to the correct side.
Methods
The Defense Transformer is composed of two main stages designed to learn the exact transformation needed to restore an image:
- Feature Representation (U-Net): A U-Net architecture processes the adversarial image to extract high-level features. This stage "pre-conditions" the image, making it easier for the subsequent network to learn accurate transformation parameters.
- Parameterized Transformation (STN): A Spatial Transformer Network (STN) learns an affine transformation matrix $\Theta$. Unlike methods that apply random rotations, this model predicts the specific rotation, translation, and scaling required for restoration.
The defense is trained using a "Counterattack" Objective, minimizing the classification loss of a pre-trained (frozen) classifier on the transformed images. This allows the transformer to learn how to fight back against the attacker by finding the optimal path back to the clean distribution.
Experimental Results
The researchers evaluated the Defense Transformer on CIFAR-10, CIFAR-100, and ImageNet against various attack types, including linear noise (FGSM, PGD) and non-linear spatial deformations (stAdv).
- Superior Robustness: On CIFAR-10, the Defense Transformer achieved ~92.3% accuracy against FGSM attacks, significantly outperforming natural training (~21%) and specialized denoising methods like HGD (~90.2%).
- Handling Spatial Attacks: Against non-linear attacks like
stAdv, the method maintained ~85.6% accuracy, whereas traditional denoising (HGD) plummeted to ~44.7%. - Generalization: The model demonstrated strong transferability, performing well against "unseen" attacks and when adversarial examples were generated using different classifiers than the one used during training.
Conclusion
The Defense Transformer demonstrates that affine transformations can serve as a "universal solvent" for adversarial perturbations. By learning to precisely rotate and scale images, the model effectively pulls adversarial examples back into the clean distribution. While highly effective against black-box attacks, future work is needed to improve robustness against white-box scenarios where the attacker has full knowledge of the defense architecture.
Summary updated