This paper, presented at ICLR 2024, introduces INViTE (INterpret and Control Vision-Language Models with Text Explanations), a framework designed to peek inside the "black box" of Vision Transformers (ViTs) like CLIP.
TL;DR
INViTE translates the abstract, high-dimensional latent tokens of a Vision Transformer into human-readable text explanations without requiring any additional training or data collection. By isolating individual tokens and "forwarding" them to the model's output layer, researchers can not only understand a model's reasoning but also intervene in real-time to fix biases and defend against adversarial attacks.
What Problem Does This Paper Address?
While Vision Transformers (ViTs) have become the backbone of modern AI, they remain notoriously difficult to interpret. We can generate "saliency maps" to see where a model is looking, but we rarely know what it thinks it is seeing at a specific layer.
Current interpretation methods usually fall into two traps:
- Post-hoc rationalization: Generating a text explanation that sounds plausible but doesn't actually reflect the model's internal logic.
- Heavy overhead: Requiring massive labeled datasets or expensive model retraining to map internal activations to human concepts.
The authors tackle the challenge of "token-level" interpretation: how do we assign a semantic meaning (like "wheels" or "fur") to the continuous vectors (latent tokens) moving through the transformer's layers?
Methods
The core of INViTE is a clever observation about how transformers process information. The authors divide transformer operations into two categories:
- Inter-token operations (Self-Attention): Where tokens "talk" to each other and mix information.
- In-token operations (MLP, LayerNorm): Where a token is processed individually.
The "Disabling Self-Attention" Trick: To interpret a specific token at Layer $i$, INViTE disables the self-attention mechanism for all subsequent layers. By cutting off inter-token communication, the token is forced to maintain its local semantic information as it travels to the final layer. Once it reaches the end, it is projected into the same embedding space as the model's text encoder (e.g., CLIP's text space). The system then performs a nearest-neighbor search against a large vocabulary to find the word or phrase that most closely matches that isolated token.
Model Control: Because these interpretations are "causal" (they represent the actual data the model uses for prediction), the authors can edit the model by:
- Token Removal: Identifying tokens that represent "spurious correlations" or "typographical attacks" and zeroing them out.
- Token Replacement: Swapping a "car" token for an "airplane" token to see if the model's final classification changes accordingly.
Datasets
The authors evaluated INViTE across several diverse benchmarks:
- VAW (Visual Attributes in the Wild): Used to verify if interpreted tokens match human-labeled attributes (like "pointy" or "metallic").
- UC Merced Land Use & RSICD: Satellite imagery datasets used for testing "typographical attacks" (e.g., writing the word "ocean" over a forest) and reasoning intervention.
- CelebA: A facial attributes dataset used to identify and remove gender bias in hair-color classification.
Key Insights and Ideas
- Hierarchical Reasoning Revealed: INViTE shows that ViTs actually build concepts hierarchically. Early layers might interpret tokens as "textures" or "colors," middle layers see "parts" (like wheels), and final layers assemble them into "wholes" (like a car).
- Causal Interpretations: Unlike saliency maps, which are just visualizations, INViTE's explanations are functional. If the system says a token represents "text," removing that token actually stops the model from being fooled by a typographical attack.
- Random Smoothing (RS) is Essential: Disabling attention creates a "distribution shift"—the model encounters token combinations it never saw during training. The authors found that adding a small amount of Gaussian noise (Random Smoothing) during the interpretation process helps the model stay robust to this shift, leading to much more accurate text retrievals.
Key Results
- Defending Against Attacks: In "typographical attacks" (where text is drawn on an image to mislead CLIP), INViTE identified the "text" tokens and removed them, repairing the model's prediction in 97% of samples.
- Debiasing: On the CelebA dataset, hair-color classification is often biased by gender. By using INViTE to identify and disable tokens associated with gender, the authors improved classification accuracy on the "worst-performing group" (e.g., non-gray-haired females) by a significant margin (from ~19% to ~66%).
- Causal Tracing: Masking an object in an image caused the rank of the corresponding text explanation to drop significantly more than masking random areas, proving the explanations are tightly linked to the visual content.
Limitations and Future Work
- Vocabulary Dependence: The quality of the explanation is limited by the provided vocabulary. If a token represents a concept not in the word list, the retrieval will be "the next best thing," which might be slightly off.
- Distribution Shift: While Random Smoothing helps, disabling self-attention is still a "surgical" intervention that moves the model away from its natural operating state.
- Computational Cost: While it requires no training, retrieving explanations for every token across every layer for a large batch of images can be computationally expensive due to the nearest-neighbor searches.
The authors suggest that future work could involve using LLMs to generate more nuanced, multi-word descriptions for tokens rather than relying on fixed vocabularies.
Summary updated