Towards Practical Certifiable Patch Defense with Vision Transformer

Zhaoyu Chen, Bo Li, Jianghe Xu, Shuang Wu, Shouhong Ding, Wenqiang Zhang

Introduction

Deep neural networks are increasingly deployed in critical systems, yet they remain vulnerable to adversarial perturbations. Among these, "patch attacks"—where an attacker places a small, localized adversarial sticker on a physical object—pose a significant threat to real-world computer vision systems. While empirical defenses offer some protection, they often fail against adaptive attackers.

Certifiable defenses, such as Derandomized Smoothing (DS), provide a mathematical guarantee of robustness within a specific perturbation bound. However, traditional DS methods have historically suffered from a "utility gap," characterized by significant drops in clean accuracy and prohibitive computational costs. This paper introduces Efficient Certifiable ViT (ECViT), a novel framework that leverages the architectural strengths of Vision Transformers (ViT) to bridge the gap between security guarantees and practical performance.

Methodology

ECViT departs from the standard Convolutional Neural Network (CNN) backbone used in previous certifiable defenses, opting instead for a Transformer-based architecture. The method introduces two primary innovations to address the limitations of existing smoothing techniques:

1. Progressive Smoothed Image Modeling (PSIM)

In Derandomized Smoothing, the classifier is trained on small "bands" or slices of an image. Learning to classify an entire object from a single thin slice is a difficult task that often leads to poor feature representation. To address this, the authors propose Progressive Smoothed Image Modeling (PSIM).

Inspired by masked language modeling (like BERT), PSIM treats the defense training as a reconstruction task. The model learns to reconstruct original image tokens from limited smoothed bands. This multi-stage training process forces the base classifier to capture discriminative local context while maintaining a global semantic understanding of the object, even when only a fraction of the image is visible.

2. Isolated Band Unit Self-attention

A major bottleneck in applying ViTs to Derandomized Smoothing is the computational cost of self-attention. Standard ViTs utilize global self-attention, where every token attends to every other token. In the context of DS, where only a specific band of pixels is relevant during a single inference pass, global attention is highly inefficient.

ECViT introduces Isolated Band Unit Self-attention, which restricts the attention mechanism to the active band. By ignoring the "smoothed" (blanked out) portions of the image, the model can process bands in parallel. This architectural change significantly reduces the FLOPs required for inference without sacrificing the model's ability to model dependencies within the relevant data.

Experimental Evaluation

The authors evaluated ECViT on two primary benchmarks: CIFAR-10 and ImageNet (ILSVRC2012). The latter is particularly significant as it demonstrates the scalability of the defense to high-resolution, multi-class real-world scenarios.

Key Results

ECViT demonstrates a substantial improvement over previous state-of-the-art (SOTA) certifiable defenses:

  • Certified Robustness: On ImageNet, under a 2% area patch attack, ECViT achieved a certified accuracy of 41.70%. This nearly doubles the previous SOTA of 26.00%, representing a major leap in guaranteed security.
  • Clean Accuracy: The model maintains a clean accuracy of 78.58% on ImageNet. This performance is remarkably close to standard undefended models like ResNet-101, effectively narrowing the utility gap.
  • Inference Efficiency: Thanks to the Isolated Band Unit structure, ECViT achieves a 4x to 8x speedup in inference time compared to standard ViT implementations within the DS framework, making it more viable for real-time applications.

Discussion and Insights

The success of ECViT highlights several key insights regarding the intersection of architecture and robustness:

  • Architectural Synergy: Vision Transformers are inherently better suited for certifiable patch defense than CNNs. Their ability to model long-range dependencies through self-attention allows them to effectively "stitch together" information from isolated image bands.
  • Reconstruction as a Proxy for Robustness: By framing the training process as a reconstruction task, the model develops a more granular understanding of local features, which is essential when the majority of the image is obscured during the defense process.

Limitations and Future Work

While ECViT represents a significant advancement, the authors note that the current certification is optimized for square patches. Real-world adversarial patches may take irregular or rectangular shapes. Additionally, while the inference speed is greatly improved, there remains a computational overhead relative to standard, non-defended models. Future research may focus on extending these guarantees to object detection tasks and exploring robustness against non-square perturbations.

Summary updated

BibTeX
@inproceedings{chen2022towards,
  author = {Zhaoyu Chen and Bo Li and Jianghe Xu and Shuang Wu and Shouhong Ding and Wenqiang Zhang},
  title = {{Towards Practical Certifiable Patch Defense with Vision Transformer}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
}
Figure