TL;DR
ViT-CX is a new explanation method for Vision Transformers (ViTs) that moves away from noisy attention weights to focus on the causal impact of semantic patch embeddings. By addressing ViT-specific quirks like causal overdetermination and mask artifacts, it produces saliency maps that are significantly more faithful to the model and intuitive for human users.
What Problem Does This Paper Address?
As Vision Transformers (ViTs) become the standard for computer vision, understanding why they make specific predictions is crucial. Most current eXplainable AI (XAI) methods for ViTs rely on attention weights—specifically how much the [CLS] token "attends" to various image patches.
However, the authors argue that attention weights are a poor proxy for importance. They represent the relationship between tokens, not necessarily the semantic content of the patches themselves. Furthermore, simply porting successful CNN-based methods like Score-CAM to ViTs fails because ViTs behave differently. They are highly robust to missing data (causal overdetermination) and have a strong ability to recognize shapes even when pixels are masked, which can lead to "artifact bias" where the model makes a prediction based on the shape of the mask rather than the image content.
Methods
ViT-CX operates in two main phases: Mask Generation and Mask Aggregation.
- Mask Generation: Instead of looking at attention, ViT-CX extracts patch embeddings from a transformer block and reshapes them into a 3D tensor. Frontal slices of this tensor are upsampled to create "feature maps." Because ViT feature maps are highly redundant (unlike CNNs), the authors use agglomerative clustering to merge similar masks, reducing the number of masks from hundreds down to about 70 on average. This drastically improves computational efficiency.
- Mask Aggregation: To create the final saliency map, the masks are applied to the input image, and the model's output score is recorded. To solve the "artifact bias," the authors add random Gaussian noise to the masked-out areas. This prevents the ViT from using the silhouette of the mask to identify the object.
- PCB Correction: Finally, they apply a Pixel Coverage Bias (PCB) correction. In models with high "causal overdetermination" (where many different small patches can trigger a correct prediction), standard methods tend to highlight pixels simply because they appear in more masks. ViT-CX divides the saliency value by the frequency of pixel coverage to ensure the map reflects true causal impact.
Datasets
The researchers evaluated ViT-CX using:
- ImageNet (ILSVRC2012): Specifically, a subset of 5,000 randomly selected images from the validation set.
- Models: They tested across three major ViT architectures: the vanilla ViT-B/16, the distilled DeiT-B, and the hierarchical Swin-B.
Key Insights and Ideas
- Semantic Content > Attention: The core "aha moment" is that patch embeddings contain richer, more stable information for explanations than the volatile attention weights used by previous methods.
- The Redundancy of ViTs: The paper shows that ViT feature maps are much more similar to one another than CNN feature maps (see Figure 4). This discovery allows for clustering, making mask-based explanation—usually a slow process—much faster.
- ViTs are "Shape-Heady": Because ViTs have a strong global context, they can recognize an object just by its masked-out silhouette. If you don't add noise to your masks, your "explanation" might just be measuring the model's ability to recognize a hole in the image (Figure 5).
- Causal Overdetermination: ViTs are remarkably robust. In about 21% of ImageNet cases, the model maintains a confidence score > 0.9 even when significant portions of the image are masked. Without PCB correction, this robustness "smears" the saliency map, making it look like the coverage frequency map rather than a targeted explanation.
Key Results
ViT-CX outperformed all baselines (including CGW, TAM, and Score-CAM) across several metrics:
- Faithfulness: It achieved the lowest Deletion AUC (meaning it identifies the most critical pixels first) and the highest Insertion AUC. In some tests, its Deletion AUC was 10% lower than the next best method.
- Interpretability: In the Pointing Game (which checks if the highest saliency point falls within the object's bounding box), ViT-CX reached accuracies of 86-92%, significantly higher than attention-based methods.
- Efficiency: By using clustering, ViT-CX explains an image in ~1.15 seconds, compared to over 77 seconds for methods using thousands of random masks.
Limitations and Future Work
- Speed: While much faster than previous mask-based methods, it is still slower than simple gradient-based methods (like Grad-CAM), which can run in milliseconds.
- Scope: The current work focuses on image classification. The authors suggest that future work should extend these causal concepts to more complex tasks like object detection and semantic segmentation.
- Hyperparameters: The method relies on a distance threshold for clustering and a noise level for debiasing, which might require tuning for different model architectures.
Summary updated