[Paper Review] PatchCensor: Patch Robustness Certification for Transformers via Exhaustive Testing
PatchCensor proposes a test-time certification method for Vision Transformers that achieves provable robustness against adversarial patches by exhaustively testing multiple attention mask mutations. It guarantees correct predictions by ensuring at least one inference excludes the perturbed patch, achieving 67.1% certified accuracy on ImageNet for 2%-pixel adversarial patches with clean accuracy matching vanilla ViT.
Vision Transformer (ViT) is known to be highly nonlinear like other classical neural networks and could be easily fooled by both natural and adversarial patch perturbations. This limitation could pose a threat to the deployment of ViT in the real industrial environment, especially in safety-critical scenarios. In this work, we propose PatchCensor, aiming to certify the patch robustness of ViT by applying exhaustive testing. We try to provide a provable guarantee by considering the worst patch attack scenarios. Unlike empirical defenses against adversarial patches that may be adaptively breached, certified robust approaches can provide a certified accuracy against arbitrary attacks under certain conditions. However, existing robustness certifications are mostly based on robust training, which often requires substantial training efforts and the sacrifice of model performance on normal samples. To bridge the gap, PatchCensor seeks to improve the robustness of the whole system by detecting abnormal inputs instead of training a robust model and asking it to give reliable results for every input, which may inevitably compromise accuracy. Specifically, each input is tested by voting over multiple inferences with different mutated attention masks, where at least one inference is guaranteed to exclude the abnormal patch. This can be seen as complete-coverage testing, which could provide a statistical guarantee on inference at the test time. Our comprehensive evaluation demonstrates that PatchCensor is able to achieve high certified accuracy (e.g. 67.1% on ImageNet for 2%-pixel adversarial patches), significantly outperforming state-of-the-art techniques while achieving similar clean accuracy (81.8% on ImageNet). Meanwhile, our technique also supports flexible configurations to handle different adversarial patch sizes (up to 25%) by simply changing the masking strategy.
Motivation & Objective
- To address the vulnerability of Vision Transformers to adversarial patch attacks in safety-critical applications.
- To provide a provable, test-time certification of robustness without retraining the model.
- To enable high certified accuracy while preserving the original model's clean accuracy.
- To support flexible configurations for varying adversarial patch sizes through adaptive masking strategies.
Proposed method
- PatchCensor performs exhaustive testing by generating multiple mutated attention masks during inference.
- Each input is evaluated via voting across multiple inferences, with at least one guaranteed to exclude the adversarial patch.
- The method leverages the structural properties of Vision Transformers to ensure complete-coverage testing of attention heads.
- It uses a masking strategy that systematically excludes different patches to detect and mitigate their influence.
- Certification is achieved through statistical guarantees derived from the completeness of the mutation set.
- The approach is agnostic to input modality and can be extended to NLP tasks via feature-level masking.
Experimental results
Research questions
- RQ1Can a test-time defense provide provable robustness against adversarial patches in Vision Transformers?
- RQ2How can certified accuracy be maximized without degrading clean accuracy?
- RQ3Can the method be flexibly adapted to different adversarial patch sizes?
- RQ4Is the defense effective across diverse benchmarks including ImageNet and GTSRB?
- RQ5Can the masking strategy be generalized to other modalities like text in NLP?
Key findings
- PatchCensor achieves 67.1% certified accuracy on ImageNet for 2%-pixel adversarial patches, significantly outperforming state-of-the-art methods.
- The method maintains a clean accuracy of 81.8% on ImageNet, matching that of the vanilla ViT model.
- It supports flexible configuration for different adversarial patch sizes through adjustable masking strategies.
- Evaluation on CIFAR-10, GTSRB, Food-101, and PartImageNet confirms robustness across diverse datasets and real-world scenarios.
- The approach demonstrates practicality and scalability, with low computational overhead due to test-time only operation.
- The method is extensible to NLP tasks, as the masking operates at the abstract feature level independent of input modality.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.