Introduction
The success of Transformers in Natural Language Processing (NLP) is largely attributed to the interpretability of Multi-Head Self-Attention (MSA). In NLP, tokens represent discrete semantic units, allowing researchers to observe heads learning specific grammatical or relational rules. However, in Computer Vision (CV), the input consists of redundant, low-level pixels. This lack of inherent semantic structure in raw image patches has created an interpretability gap, making it difficult to provide human-readable explanations for Vision Transformer (ViT) attention patterns. This paper addresses this gap by introducing a framework that maps pixels to mid-level semantic features using classical computer vision techniques.
Methodology: SIFT as a Semantic Bridge
To bridge the semantic divide, the authors propose using Scale-Invariant Feature Transform (SIFT) keypoints as "semantic anchors." SIFT keypoints are invariant to rotation and scaling and naturally cluster on semantically rich regions of an image, such as object boundaries and textures.
By categorizing image patches into "Keypoint patches" (containing SIFT points) and "Non-keypoint patches," the researchers could perform a Weighted Patch Interrelation Analysis. They tracked the attention flow between these categories across the 24 layers of a ViT-Large model, using information entropy to measure the focus of individual attention heads.
The Three-Stage Inference Process
The analysis revealed that ViT inference is not a monolithic process but follows a logical three-stage progression:
- Global Information Retrieval (Early Layers): Attention is broad and unfocused. The model integrates global context from across the entire image to prepare for more granular analysis.
- Key Information Capture (Middle Layers): Attention becomes highly localized. Keypoint patches begin attending strongly to other keypoint patches, effectively "capturing" the core features of the primary object.
- Semantic Interrelation Coach (Late Layers): Attention broadens slightly. The model reallocates focus to non-keypoint (background) patches, likely to refine the boundaries between the object and its surroundings.
Applications: Guided Masking and "Mask as Prompt"
The semantic insights gained from SIFT analysis were applied to improve model training and performance. The authors introduced "Guided Masking," a curriculum learning strategy for pre-training. Instead of the random masking used in standard Masked Autoencoders (MAE), they used semantic scores to gradually increase the difficulty of the reconstruction task—starting with easy background masks and moving toward harder keypoint masks.
Furthermore, the study explored the "Mask as Prompt" phenomenon. By masking the least semantically important patches (background noise) during inference, the researchers observed a notable increase in classification accuracy (e.g., from 81.34% to 82.73%). This suggests that background patches often act as "spurious correlations" that distract the model from the core object.
Key Results and Conclusion
The experimental results validate the semantic framework. Guided Masking achieved convergence in 30 rounds compared to 45 for random masking—a 33% acceleration. Additionally, the model showed extreme sensitivity to the loss of semantic information; masking the top 40% of semantically important patches caused accuracy to plummet to 25%, while masking the bottom 40% (background) maintained or improved performance.
This work demystifies the "black box" of ViT attention by proving that these models follow a structured, semantically-driven logic similar to human perception. By leveraging classical CV tools like SIFT, we can not only understand but also optimize the next generation of vision models.
Summary updated