Lune

NeurIPS2024Top-tier venue

Dissecting Query-Key Interaction in Vision Transformers

Xu Pan, Aaron Philip, Ziqian Xie, Odelia Schwartz

Abstract

Self-attention in vision transformers is often thought to perform perceptual grouping where tokens attend to other tokens with similar embeddings, which could correspond to semantically similar features of an object. However, attending to dissimilar tokens can be beneficial by providing contextual information. We propose to analyze the query-key interaction by the singular value decomposition of the interaction matrix (i.e. Wq⊤Wk{\textbf{W}_q}^\top\textbf{W}_k). We find that in many ViTs, especially those with classification training objectives, early layers attend more to similar tokens, while late layers show increased attention to dissimilar tokens, providing evidence corresponding to perceptual grouping and contextualization, respectively. Many of these interactions between features represented by singular vectors are interpretable and semantic, such as attention between relevant objects, between parts of an object, or between the foreground and background. This offers a novel perspective on interpreting the attention mechanism, which contributes to understanding how transformer models utilize context and salient features when processing images.

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.

8 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

  • Decomposing Query-Key Feature Interactions Using Contrastive Covariances cites Pinpointing Attention-Causal Communication in Language Models
  • Emerging Properties in Self-Supervised Vision Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Emerging Properties in Self-Supervised Vision Transformers cites Training data-efficient image transformers & distillation through attention
  • From Weights to Concepts: Data-Free Interpretability of CLIP via Singular Vector Decomposition cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • From Weights to Concepts: Data-Free Interpretability of CLIP via Singular Vector Decomposition cites Learning Transferable Visual Models From Natural Language Supervision
  • Learning Transferable Visual Models From Natural Language Supervision cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Training data-efficient image transformers & distillation through attention cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Singular Vectors of Attention Heads Align with Features cites Pinpointing Attention-Causal Communication in Language Models
  • SimMIM: a Simple Framework for Masked Image Modeling cites Emerging Properties in Self-Supervised Vision Transformers
  • SimMIM: a Simple Framework for Masked Image Modeling cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • SimMIM: a Simple Framework for Masked Image Modeling cites Training data-efficient image transformers & distillation through attention
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers8

  1. Pinpointing Attention-Causal Communication in Language ModelsGabriel Franco, Mark CrovellaNeurIPS 2025 · 3 citations
  2. Decomposing Query-Key Feature Interactions Using Contrastive CovariancesAndrew Lee, Yonatan Belinkov, Fernanda Viégas, Martin WattenbergICML 2026 · 1 citation
  3. Singular Vectors of Attention Heads Align with FeaturesGabriel Franco, Carson Loughridge, Mark CrovellaICML 2026 · 1 citation
  4. From Weights to Concepts: Data-Free Interpretability of CLIP via Singular Vector DecompositionFrancesco Gentile, Nicola DallAsen, Francesco Tonini, Massimiliano Mancini et al.CVPR 2026
  5. Diffusion-CAM: Faithful Visual Explanations for dMLLMsHaomin Zuo, Yidi Li, Luoxiao Yang, Xiaofeng ZhangACL 2026

Builds on13

  1. Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
  2. 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
  3. Training data-efficient image transformers & distillation through attentionHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa et al.ICML 2021 · 8,974 citations
  4. Emerging Properties in Self-Supervised Vision TransformersMathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou et al.ICCV 2021 · 8,921 citations
  5. SimMIM: a Simple Framework for Masked Image ModelingZhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin et al.CVPR 2022 · 1,129 citations

Related papers

  1. Analyzing Vision Transformers for Image Classification in Class Embedding SpaceMartina G. Vilas, Timothy Schaumlöffel, Gemma RoigNeurIPS 2023 · 43 citations
  2. Attention Guided CAM: Visual Explanations of Vision Transformer Guided by Self-AttentionSaebom Leem, Hyunseok SeoAAAI 2024 · 40 citations
  3. 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
  4. Vision Transformers Need More Than RegistersCheng Shi, Yizhou Yu, Sibei YangCVPR 2026 · 17 citations
  5. Discovering Attention Head Interactions in Vision TransformersZhenyu Lu, Yuheng Jia, Wei You, Hao ChenCVPR Findings 2026
Dusk over the sea between two cliffs drawn in fine vertical lines