Introduction
Vision Transformers (ViTs) have demonstrated state-of-the-art performance across various computer vision tasks. However, like their convolutional counterparts, they remain susceptible to adversarial attacks—carefully crafted, imperceptible perturbations that lead to incorrect classifications. While traditional research focuses on adversarial training to enhance robustness, this study explores a "forensic" approach: identifying the unique signatures left by adversarial inputs during the inference process.
Forensic Quantifications
The researchers propose four distinct metrics to monitor the internal and external behavior of ViTs during inference:
- Frequency Ratio (FR): Analyzes the input image's energy distribution using Discrete Cosine Transform (DCT). Adversarial noise typically alters the balance between high and low-frequency components.
- Posterior Entropy (PH): Measures the uncertainty in the model's final probability distribution. Attacks often induce higher entropy as the model becomes "confused" between classes.
- Attention Distance (AD): Tracks the physical distance between image patches connected by the transformer's attention mechanism. Attacks can force the model to attend to irrelevant, distant regions.
- CKA Similarity (SCKA): Uses Centered Kernel Alignment to compare internal layer representations between clean and potentially attacked samples, detecting disruptions in internal logic.
Detection Performance
Experimental results on ImageNet-1K reveal that the most effective "alarms" for detecting attacks are the input and output signals.
As shown in Figure 2, attacks like FGSM significantly shift the Frequency Ratio distribution, making them relatively easy to distinguish from clean samples. Similarly, the Posterior Entropy (Figure 3) provides a clear signal of adversarial interference, particularly for models like T2T-ViT-t which exhibit more varied entropy profiles under attack.
The Challenge of Stealth Attacks
While rougher attacks like FGSM and PGD leave detectable traces, highly optimized attacks such as C&W (Carlini & Wagner) present a significant challenge. For C&W attacks, the Bhattacharyya Coefficient (a measure of distribution overlap) remained near 1.00 across almost all metrics, indicating that the attack is forensically invisible to these specific quantifications. This suggests that attackers with sufficient computational budget can bypass both the classifier and the forensic monitors.
Conclusion and Future Directions
The study highlights that while internal latent features (like Attention Distance) are excellent for explaining how an attack disrupts a model, they are less effective as primary detection triggers due to high overlap with clean data distributions. Future work aims to move beyond single-metric thresholds toward multi-dimensional forensic profiles that combine frequency, attention, and entropy data to catch even the most sophisticated stealth attacks. Additionally, identifying "volatile heads" in early transformer blocks may lead to more targeted hardening strategies.
Summary updated