TL;DR
Vision Transformers (ViTs) are powerful but their explanations (attention maps) are fragile and easily manipulated by small input changes. This paper introduces "Faithful ViTs" (FViTs) by combining randomized smoothing and diffusion-based denoising to create explanations that are both stable and robust, ensuring they accurately reflect the model's reasoning.
What Problem Does This Paper Address?
Vision Transformers (ViTs) have become state-of-the-art in many computer vision tasks, partly due to their inherent "self-explaining" nature via attention mechanisms. These attention maps are supposed to reveal which parts of an image are most important for a given prediction. However, a critical issue is explanation faithfulness, meaning the explanation should accurately reflect the model's true reasoning process. For ViTs, this faithfulness is compromised by stability issues: small, imperceptible perturbations to the input image can drastically alter the attention maps, leading to misleading interpretations and potentially incorrect predictions. This fragility makes it difficult to trust ViT explanations, especially in safety-critical applications. The paper aims to address this by developing ViTs that provide provably faithful and robust explanations.
Methods
The core contribution is a method called Denoised Diffusion Smoothing (DDS), which transforms standard ViTs into Faithful ViTs (FViTs). DDS combines two key components:
- Randomized Smoothing: This standard technique involves adding Gaussian noise to the input image and averaging predictions over many noisy samples. While typically used to improve prediction robustness, the authors show it also enhances attention stability.
- Diffusion-based Denoising: A denoising diffusion probabilistic model is used to denoise the perturbed input. This process helps to recover important features while mitigating the noise introduced by randomized smoothing.
The authors theoretically prove that applying DDS to a ViT results in an FViT, which satisfies two properties:
- Stable Top-k Attention Indices: The most important attention weights (top-k indices) remain largely unchanged under input perturbations.
- Robust Prediction Distribution: The model's prediction remains stable even when the input is perturbed.
They also show that Gaussian noise is near-optimal for this process in both L2 and L-infinity norm cases.
Datasets
The paper evaluates their method on several standard datasets:
- ImageNet (ILSVRC-2012): Used for classification tasks.
- ImageNet-segmentation subset: Used for segmentation tasks.
- COCO: Used for segmentation tasks.
- Cityscape: Used for segmentation tasks.
Key Insights and Ideas
- Attention maps are fragile: Even small input perturbations can drastically change where a ViT "looks," undermining trust in its explanations.
- Randomized smoothing for explanations: While known for improving prediction robustness, this paper demonstrates its effectiveness in stabilizing attention maps.
- Diffusion models as denoisers for faithfulness: Combining diffusion denoising with randomized smoothing is key to achieving both stable attention and robust predictions.
- Gaussian noise is near-optimal: The paper provides theoretical backing that Gaussian noise is a highly effective choice for this smoothing process.
- Faithfulness requires more than just stable attention: While stable attention is crucial, the prediction itself must also be robust to perturbations.
Key Results
- Improved Faithfulness: FViTs consistently outperform baseline methods in terms of faithfulness scores (SFaith) under various adversarial attacks. For example, under an L-infinity threat model with a radius of 8/255, FViT achieves a score of 4.22, significantly higher than other methods.
- Robustness: FViTs demonstrate superior robustness against adversarial perturbations, maintaining higher classification accuracy and segmentation metrics (pixel accuracy, mIoU, mAP) compared to baselines. For instance, on ImageNet with a 10/255 attack radius, FViT achieves 80.85% accuracy, while Vanilla VTA drops to 0%.
- Model Agnostic: The proposed DDS method works with different ViT architectures (ViT, DeiT, Swin), showing its general applicability.
- Clean Utility: The method can even slightly improve clean utility (classification accuracy without attacks) when a small smoothing radius is used.
Limitations and Future Work
- Computational Cost: While the denoising is relatively fast (around 0.32 seconds per image), the overall DDS process adds computational overhead compared to standard ViTs.
- Parameter Tuning: The effectiveness of the method depends on choosing an appropriate standard deviation (δ) for the Gaussian noise. Too large a δ can lead to images being overwhelmed by noise, reducing classification confidence.
- Free-form Adversarial Attacks: The paper focuses on norm-bounded adversarial attacks. Defending against more complex attacks like in-painting and physical adversarial objects is considered out of scope and a direction for future work.
- Generalizability to other models: While shown to be effective for ViTs, further research could explore its applicability to other model architectures.
Summary updated