Lune

NeurIPS2023Top-tier venue

Analyzing Vision Transformers for Image Classification in Class Embedding Space

Martina G. Vilas, Timothy Schaumlöffel, Gemma Roig

Abstract

Despite the growing use of transformer models in computer vision, a mechanistic understanding of these networks is still needed. This work introduces a method to reverse-engineer Vision Transformers trained to solve image classification tasks. Inspired by previous research in NLP, we demonstrate how the inner representations at any level of the hierarchy can be projected onto the learned class embedding space to uncover how these networks build categorical representations for their predictions. We use our framework to show how image tokens develop class-specific representations that depend on attention mechanisms and contextual information, and give insights on how self-attention and MLP layers differentially contribute to this categorical composition. We additionally demonstrate that this method (1) can be used to determine the parts of an image that would be important for detecting the class of interest, and (2) exhibits significant advantages over traditional linear probing approaches. Taken together, our results position our proposed framework as a powerful tool for mechanistic interpretability and explainability research.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

17 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Block Recurrent Dynamics in Vision Transformers cites Do Vision Transformers See Like Convolutional Neural Networks?
  • Block Recurrent Dynamics in Vision Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Do Vision Transformers See Like Convolutional Neural Networks? cites Understanding Robustness of Transformers for Image Classification
  • Do Vision Transformers See Like Convolutional Neural Networks? cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Do Vision Transformers See Like Convolutional Neural Networks? cites Intriguing Properties of Vision Transformers
  • Understanding Robustness of Transformers for Image Classification cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Beyond the Doors of Perception: Vision Transformers Represent Relations Between Objects cites Do Vision Transformers See Like Convolutional Neural Networks?
  • Beyond the Doors of Perception: Vision Transformers Represent Relations Between Objects cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Not All Diffusion Model Activations Have Been Evaluated as Discriminative Features cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Decomposing and Interpreting Image Representations via Text in ViTs Beyond CLIP cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Intriguing Properties of Vision Transformers cites Understanding Robustness of Transformers for Image Classification
  • Intriguing Properties of Vision Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers17

  1. Patchscopes: A Unifying Framework for Inspecting Hidden Representations of Language ModelsAsma Ghandeharioun, Avi Caciularu, Adam Pearce, Lucas Dixon et al.ICML 2024 · 197 citations
  2. Not All Diffusion Model Activations Have Been Evaluated as Discriminative FeaturesBenyuan Meng, Qianqian Xu, Zitai Wang, Xiaochun Cao et al.NeurIPS 2024 · 26 citations
  3. Decomposing and Interpreting Image Representations via Text in ViTs Beyond CLIPSriram Balasubramanian, Samyadeep Basu, Soheil FeiziNeurIPS 2024 · 26 citations
  4. Beyond the Doors of Perception: Vision Transformers Represent Relations Between ObjectsMichael A. Lepori, Alexa R. Tartaglini, Wai Keen Vong, Thomas Serre et al.NeurIPS 2024 · 22 citations
  5. Block Recurrent Dynamics in Vision TransformersMozes Jacobs, Thomas Fel, Richard Hakim, Alessandra Brondetta et al.ICLR 2026 · 17 citations

Builds on11

  1. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  2. Do Vision Transformers See Like Convolutional Neural Networks?Maithra Raghu, Thomas Unterthiner, Simon Kornblith, Chiyuan Zhang et al.NeurIPS 2021 · 1,553 citations
  3. Intriguing Properties of Vision TransformersMuzammal Naseer, Kanchana Ranasinghe, Salman Khan, Munawar Hayat et al.NeurIPS 2021 · 863 citations
  4. Understanding Robustness of Transformers for Image ClassificationSrinadh Bhojanapalli, Ayan Chakrabarti, Daniel Glasner, Daliang Li et al.ICCV 2021 · 501 citations
  5. On Identifiability in TransformersGino Brunner, Yang Liu, Damian Pascual, Oliver Richter et al.ICLR 2020 · 210 citations

Related papers

  1. A Simple Interpretable Transformer for Fine-Grained Image Classification and AnalysisDipanjyoti Paul, Arpita Chowdhury, Xinqi Xiong, Feng-Ju Chang et al.ICLR 2024 · 27 citations
  2. Token Transformation Matters: Towards Faithful Post-Hoc Explanation for Vision TransformerJunyi Wu, Bin Duan, Weitai Kang, Hao Tang et al.CVPR 2024 · 8 citations
  3. Transformer Interpretability Beyond Attention VisualizationHila Chefer, Shir Gur, Lior WolfCVPR 2021
  4. Dissecting Query-Key Interaction in Vision TransformersXu Pan, Aaron Philip, Ziqian Xie, Odelia SchwartzNeurIPS 2024 · 18 citations
  5. AttCAT: Explaining Transformers via Attentive Class Activation TokensYao Qiang, Deng Pan, Chengyin Li, Xin Li et al.NeurIPS 2022 · 66 citations
Dusk over the sea between two cliffs drawn in fine vertical lines