When Vision Transformers (ViTs) emerged as powerful alternatives to Convolutional Neural Networks (CNNs) for computer vision, early evaluations brought exciting news: ViTs appeared significantly more robust to adversarial attacks. If you took an adversarial image designed to trick a ResNet, a ViT would often classify it correctly.
However, recent research reveals that this apparent resilience is largely an illusion. The perceived robustness of ViTs is not an intrinsic defense mechanism, but rather a byproduct of a cross-architecture transferability gap. As explained by Wang et al. in Improving the Transferability of Adversarial Examples by Feature Augmentation, regularizing attacks with internal feature noise heavily degrades this perceived defense, proving that the models remain fundamentally vulnerable. The issue is not that Transformers cannot be fooled, but that the tools traditionally used to fool networks were built for a completely different architectural paradigm.
The Geometry of the Transferability Gap
To understand why attacks fail to transfer across architectures, we must look at how these models process spatial information.
CNNs rely on local, continuous convolutions. An adversarial attack optimized for a CNN creates high-frequency, spatially distributed noise patterns that exploit these local receptive fields. ViTs, by contrast, operate on discrete patches and global self-attention.
When an image enters a ViT, it is chopped into a grid of isolated tokens. As Ming et al. demonstrate in Transferable Structural Sparse Adversarial Attack Via Exact Group Sparsity Training, this patch-based tokenization physically disrupts the continuous structural noise patterns that make CNN attacks effective. Similarly, Li et al. observe in AIM: Additional Image Guided Generation of Transferable Adversarial Attacks that perturbations optimized for local spatial features struggle to penetrate global attention mechanisms.
This structural mismatch creates a fascinating asymmetric transferability. In The Efficacy of Transformer-based Adversarial Attacks in Security Domains, Li et al. discover that attacks generated by attention-based models easily cross over to fool CNNs (high transmissibility), but CNN-generated attacks fail to return the favor (low receivability). Because ViT features capture broader, more global representations, an attack that breaks a ViT often encapsulates the more localized vulnerabilities of a CNN, whereas the reverse is rarely true.
Hijacking Self-Attention
What happens when an attack is designed specifically for the mechanics of a Transformer? The answer is that ViTs can become even more fragile than CNNs.
Instead of spreading low-amplitude noise across an entire image, a transformer-specific attack targets the self-attention mechanism directly. In Patch-Fool: Are Vision Transformers Always Robust Against Adversarial Perturbations?, Fu et al. introduce an attack that concentrates perturbations onto a single influential image patch. By corrupting just one patch, the attack hijacks the global attention matrix, causing the model to misclassify the entire image.
When evaluations shift away from CNN-centric noise toward patch-aligned structures—such as the framework proposed in Query-Efficient Hard-Label Black-Box Attack against Vision Transformers—the true vulnerabilities of attention-based processing are exposed, challenging the assumption that architectural differences grant inherent security.
The Defense Mismatch
Just as attacks fail to transfer across the architectural divide, traditional adversarial defenses fail to cross over as well. For years, the deep learning community developed defenses tailored to the inductive biases of convolutions. Many of these techniques rely on manipulating channel-wise statistics or smoothing convolutional filters.
As noted by Fan et al. in Towards Robust Object Detection Invariant to Real-World Domain Shifts, these methods cannot be directly applied to attention maps without disrupting a model's capacity to learn global dependencies.
Furthermore, the internal dynamics of how these models fail during training are completely different. Lin et al. show in Layer-Aware Analysis of Catastrophic Overfitting: Revealing the Pseudo-Robust Shortcut Dependency that the structural components facilitating adversarial shortcuts and catastrophic overfitting are highly architecture-dependent. A defense that prevents a CNN from learning a "pseudo-robust shortcut" does not stop a Transformer from failing via its own unique structural vulnerabilities.
Ultimately, achieving true security requires moving away from a one-size-fits-all approach to robustness. Security evaluations and defenses must be co-designed with the specific mathematical operations—whether local convolutions or global self-attention—that define the architecture.
Key Foundational Work
Parametric Noise Injection: Trainable Randomness to Improve Deep Neural Network Robustness Against Adversarial Attack. (2019) — contributed 1 concept elements to this direction.
Adversarial Dropout for Supervised and Semi-Supervised Learning (2018) — contributed 1 concept elements to this direction.