Introduction
Vision Transformers (ViTs) have become the backbone of modern computer vision, yet they remain notoriously difficult to interpret. While models like CLIP are easier to probe because they share a representation space with text, most "unimodal" ViTs (like DINO or DeiT) speak a language of pure vectors that humans can't easily translate.
In their NeurIPS 2024 paper, "Decomposing and Interpreting Image Representations via Text in ViTs Beyond CLIP," researchers from the University of Maryland introduce a framework to bridge this gap. They’ve developed a way to break down the complex internal state of almost any ViT and map it into CLIP’s text-aligned space, effectively giving these "silent" models a voice.
The Interpretability Gap
We know ViTs work, but we don't fully understand how they transform pixels into concepts. A recent breakthrough showed that CLIP-ViT models could be mathematically decomposed into a sum of vectors, where each vector represents the contribution of a specific token or attention head. Because CLIP is trained on both images and text, these vectors can be "read" by the CLIP text encoder.
However, most powerful ViTs (e.g., DINOv2, DeiT, Swin) are trained on images alone. They lack a corresponding text encoder, making their internal "contribution vectors" uninterpretable. Furthermore, newer architectures use complex mechanisms like windowed attention or grid attention, which break the simple linear decomposition used in earlier studies. This paper aims to make any ViT interpretable via text, regardless of its training objective or specific architecture.
Methodology: REPDECOMPOSE and COMPALIGN
The authors introduce two primary algorithms to enable this translation:
REPDECOMPOSE: This is an automated, architecture-agnostic tool. It recursively traverses a model's computational graph to identify how the final output is built from individual components. It handles the "messy" parts of modern transformers—like layer normalization, patch merging, and various attention types—by identifying linear operations that can be mathematically "unfolded" into a sum of direct contributions.COMPALIGN: Once the representation is decomposed into component vectors ($c_i$), these vectors are still in the model's native space.COMPALIGNlearns a set of linear maps ($f_i$) that project these vectors into CLIP’s image representation space. Crucially, they use an orthogonality regularizer during training. This ensures that the mapping preserves the relative importance and relationships of features (like shape vs. color) rather than just forcing a fit.
Finally, they propose a scoring function to rank these components. By projecting the aligned vectors onto a "feature space" defined by text (e.g., the embeddings for "striped," "spotted," "checkered"), they can quantify exactly how much a specific attention head contributes to a concept.
Key Insights
- Redundancy is a Feature: Models trained on ImageNet (like DeiT) show massive redundancy. You can ablate (remove) many of the final layers with almost no drop in accuracy. In contrast, self-supervised models like DINOv2 and CLIP are much more "efficient"—removing even a few final layers causes accuracy to plummet.
- Diffuse Representations: Features aren't usually locked in a single "color head" or "shape head." Instead, concepts like "location" or "pattern" are often distributed across multiple components. The authors' continuous scoring method is essential because a simple "one-head-one-role" label is too reductive.
- The "Direct" vs. "Indirect" Distinction: The paper focuses on direct contributions to the final output. While components also interact with each other (indirect contributions), the authors show that direct contributions alone are surprisingly powerful for interpretation.
Experimental Results
The researchers evaluated their framework across a diverse set of models (DeiT, DINO, DINOv2, Swin, MaxViT, and CLIP) using ImageNet-1k and the Waterbirds dataset.
Interpretability and Feature Decomposition
In an ablation study, the COMPALIGN method significantly outperformed naive alignment. When asked to describe a random component, the framework's descriptions matched "ground truth" ImageNet class embeddings much more frequently than baselines.
Zero-Shot Bias Mitigation
By identifying the components most responsible for "location" (background) and "ablating" them (setting them to their mean value), the researchers improved the worst-group accuracy on the Waterbirds dataset. For example, DeiT's accuracy on birds in "wrong" environments jumped from 73.3% to 81.5% without any re-training on the biased data.
Feature-Specific Retrieval
The framework allows for "surgical" image retrieval. You can take a reference image of a person on a beach and ask the model to find images that match only the "pattern" (the stripes on their shirt) or only the "location" (the beach), simply by using the vectors from the relevant components.
Conclusion
By providing a "Rosetta Stone" for ViTs, this work moves us closer to a world where we don't just trust that a model is right, but understand exactly which part of its "brain" is making the decision.
Paper Citation: Balasubramanian, S., Basu, S., & Feizi, S. (2024). Decomposing and Interpreting Image Representations via Text in ViTs Beyond CLIP. 38th Conference on Neural Information Processing Systems (NeurIPS 2024).
Summary updated