Abstract
Patch attack, which introduces a perceptible but localized change to the input image, has gained significant momentum in recent years. In this paper, we present a unified framework to analyze certified patch defense tasks, including both certified detection and certified recovery, leveraging the recently emerged Vision Transformers (ViTs). In addition to the existing patch defense setting where only one patch is considered, we provide the very first study on developing certified detection against the dual patch attack, in which the attacker is allowed to adversarially manipulate pixels in two different regions. By building upon the latest progress in self-supervised ViTs with masked image modeling (i.e., masked autoencoder (MAE)), our method achieves state-of-the-art performance in both certified detection and certified recovery of adversarial patches. Regarding certified detection, we improve the performance by up to ~16% on ImageNet without training on a single adversarial patch, and for the first time, can also tackle the more challenging dual patch setting. Our method largely closes the gap between detection-based certified robustness and clean image accuracy. Regarding certified recovery, our approach improves certified accuracy by ~2% on ImageNet across all attack sizes, attaining the new state-of-the-art performance.
Introduction
Deep neural networks are notoriously fragile when faced with adversarial attacks. While many attacks involve imperceptible noise, patch attacks are more "real-world": an attacker places a visible, localized patch (like a sticker) on an object to fool the classifier. Defending against these is difficult because empirical defenses often fail when an attacker becomes aware of the defense mechanism. This has led to the development of certified defenses—methods that provide a mathematical guarantee that a model will remain robust under specific attack conditions.
Certified defense usually falls into two categories:
- Certified Detection: Proving whether an image has been tampered with.
- Certified Recovery: Correctly classifying the image even if a patch is present.
Existing certified methods often struggle to scale to large datasets like ImageNet, are computationally slow, or only account for a single adversarial patch.
Methodology: The ViP Framework
The authors introduce ViP, which treats detection and recovery as two sides of the same coin within a unified ViT-based framework.
The ViT and MAE Advantage
Unlike Convolutional Neural Networks (CNNs), Vision Transformers naturally "patchify" images into tokens. This makes them ideal for defenses based on masking or dropping specific parts of an image. The framework uses Masked Autoencoders (MAE) as a backbone. Since MAE is pre-trained to reconstruct images from missing patches, it is inherently better at maintaining high accuracy even when large portions of the input tokens are dropped during the defense process.
Masking Strategies
- For Detection: The system slides a mask across the image. If the predictions across all masked versions are perfectly consistent, the image is certified as "clean" or the attack is deemed "harmless."
- For Recovery: They use "derandomized smoothing." They mask large portions of the image and use a majority vote from the remaining tokens. If the gap between the top two predicted classes is wide enough, the prediction is certified.
Generalized Windows for Dual-Patch Attacks
To handle the "dual-patch" setting (where an attacker uses two separate patches), the authors propose a "generalized window" that treats the image topology as a torus (where the left/right and top/bottom edges are connected). This ensures that a single large mask can always "cover" the influence of two disparate patches.
Key Results and Insights
The primary benchmark used is ImageNet (224x224). Scaling certified patch defense to ImageNet is a significant milestone, as many previous methods were only computationally feasible on smaller datasets like CIFAR-10.
- Detection Breakthrough: On ImageNet, ViP improved certified detection rates by up to ~16% over previous state-of-the-art methods (like PatchVeto) without needing any adversarial training.
- Certified Recovery: ViP improved certified accuracy by roughly 2% across all patch sizes on ImageNet.
- Dual-Patch Success: The paper provides the first practical results for dual-patch detection on a large-scale dataset, showing that MAE-based models are significantly more resilient than standard ViTs or CNNs in this challenging setting.
- Efficiency: By dropping tokens rather than just masking them (which CNNs must do), ViTs can achieve linear complexity. This reduced certification time for a single image from 0.92 seconds to 0.11 seconds.
Conclusion
ViP demonstrates that self-supervised pre-training (specifically MAE) is a massive boon for certified robustness. Because MAE learns to understand images with missing parts, it remains robust when the defense mechanism masks out tokens. By adjusting the size of the mask and the decision logic, the same ViT can perform both detection and recovery tasks efficiently. While challenges remain in scaling to larger patches in multi-patch scenarios, ViP represents a significant step toward closing the gap between certified robustness and clean image accuracy.
Summary updated