Adversarial attacks have been studied extensively in the context of CNNs, but Vision Transformers (ViTs) present a fundamentally different threat surface. In this post, I want to walk through why patch-based attacks are particularly challenging for ViTs and what makes them hard to defend against.
What Is an Adversarial Patch?
Unlike pixel-level perturbations that add imperceptible noise across an image, an adversarial patch is a small, highly visible region — often a sticker-sized square — that is crafted to cause misclassification when placed anywhere in the scene. The appeal for real-world attackers is obvious: print the patch, stick it on a stop sign, and fool an autonomous driving system.
Why ViTs Are Different
CNNs process images through convolutional kernels with local receptive fields. ViTs, on the other hand, divide images into patches and model global dependencies via self-attention. This global attention mechanism means a single adversarial patch can influence the representation of the entire image — the attention mechanism actively helps the attack propagate.
The same property that makes ViTs so powerful — global context modeling — is exactly what adversarial patch attacks exploit.
In our work on STRAP-ViT, we found that naive defenses like input smoothing that work reasonably well for CNNs fail to account for this cross-patch information flow, and can even amplify the effect of adversarial patches in certain configurations.
Our Approach
STRAP-ViT addresses this by segregating tokens and applying randomized transformations in a model-agnostic way. The key insight is that by disrupting the spatial regularity that patches rely on — without needing to identify which tokens are adversarial — we can significantly reduce attack success rates while maintaining clean accuracy.
More details in the paper, which will appear at DAC 2026.