TL;DR
DeSparsify is a novel adversarial attack that targets the "availability" of Vision Transformers (ViTs) by exploiting their efficiency-boosting token sparsification mechanisms. By injecting imperceptible perturbations, the attack forces models to process every single token—negating their speed gains and causing significant spikes in energy consumption and memory usage without changing the model's final classification.
What Problem Does This Paper Address?
Vision Transformers are powerful but computationally heavy, with costs that grow quadratically relative to the number of input tokens (image patches). To make them viable for edge devices or real-time use, researchers developed Token Sparsification (TS). These mechanisms (like ATS, AdaViT, and A-ViT) dynamically drop "uninformative" tokens during inference, assuming that most images have redundant background information.
However, this dynamic, "average-case" efficiency creates a security loophole. The authors identify that an adversary can exploit this dynamism to launch a Denial-of-Service (DoS) style attack. Instead of trying to make the model misclassify an image (an integrity attack), DeSparsify aims to maximize resource consumption, potentially draining batteries on mobile devices or overloading cloud servers.
Methods
The authors propose a white-box attack using Projected Gradient Descent (PGD) with a specialized dual-objective loss function: $$L = L_{atk} + \lambda \cdot L_{cls}$$
- $L_{atk}$ (The Attacking Component): This is tailored to the specific TS mechanism. For example, in ATS, it uses KL divergence to push the token significance scores toward a uniform distribution, ensuring no token stands out as "unimportant." In A-ViT, it targets the "halting" neurons to prevent them from stopping computation early.
- $L_{cls}$ (The Stealth Component): This ensures the adversarial image maintains the same classification as the original clean image. This makes the attack stealthy, as simple monitoring of prediction accuracy wouldn't reveal the ongoing resource exhaustion.
The paper evaluates several attack variants:
- Single-image: A custom perturbation for every input.
- Universal: A single perturbation that works across all images or specific classes.
- Universal Patch: A small, visible patch placed in the corner of an image.
Datasets
The attack was evaluated on two standard computer vision benchmarks:
- ImageNet-1K: Used to test the attack on large-scale, complex image data.
- CIFAR-10: Used to demonstrate generalizability to smaller, different image distributions.
The models tested include DeiT (small and tiny versions) and T2T-ViT.
Key Insights and Ideas
- Vulnerability of Simplicity: A-ViT proved to be the most vulnerable mechanism because it relies on a single neuron to decide when to halt token processing. This "single point of failure" is easily bypassed by the attack, leading to 100% token utilization.
- The "Easy Image" Paradox: Images that are normally "easy" for a model to classify (requiring very few tokens) are actually easier to attack. They contain more "adversarial space" where perturbations can be hidden to trick the sparsification logic.
- Hardware Impact is Real: Unlike many adversarial attacks that exist only in the realm of "accuracy percentages," this attack has measurable physical consequences. Against the ATS mechanism, the attack increased GPU energy consumption by 72% and memory usage by 37%.
Key Results
- Worst-Case Performance: In many scenarios, DeSparsify successfully increased the Token Utilization Ratio (TUR) to nearly 100%. For A-ViT, the attack achieved a perfect 100% increase in GFLOPS (Giga Floating-Point Operations per Second), effectively turning a dynamic model into a static, heavy one.
- Stealthiness: The attack maintained high classification accuracy (often within 1-2% of the clean model) while simultaneously maximizing resource drain.
- Transferability: While attacks tailored to one TS mechanism don't always work on others, the authors found that ensemble training (training the attack against multiple mechanisms at once) creates highly robust perturbations that can compromise unknown TS systems.
Limitations and Future Work
- Transferability: The main limitation is that an attack crafted for one specific model backbone (e.g., DeiT-s) has only marginal success when transferred to a completely different backbone (e.g., T2T-ViT) without ensemble training.
- Countermeasures: The authors suggest a simple but effective defense: setting a hard upper bound on the number of tokens allowed per block based on average-case performance. This limits the "worst-case" damage an attacker can do, though it may slightly impact accuracy on naturally complex images.
- Future Directions: The authors plan to investigate if similar availability attacks can be launched against Large Language Models (LLMs) that use dynamic computation techniques.
Summary updated