LeGrad: An Explainability Method for Vision Transformers via Feature Formation Sensitivity
Walid Bousselham, Angie W. Boggust, Sofian Chaybouti, Hendrik Strobelt, Hilde Kuehne
Abstract
Vision Transformers (ViTs), with their ability to model long-range dependencies through self-attention mechanisms, have become a standard architecture in computer vision. However, the interpretability of these models remains a challenge. To address this, we propose LeGrad, an explainability method specifically designed for ViTs. LeGrad computes the gradient with respect to the attention maps of ViT layers, considering the gradient itself as the explainability signal. We aggregate the signal over all layers, combining the activations of the last as well as intermediate tokens to produce the merged explainability map. This makes LeGrad a conceptually simple and an easy-to-implement tool for enhancing the transparency of ViTs. We evaluate LeGrad in challenging segmentation, perturbation, and open-vocabulary settings, showcasing its versatility compared to other SotA explainability methods demonstrating its superior spatial fidelity and robustness to perturbations. A demo and the code is available at https://github.com/WalBouss/LeGrad.
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.
7 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Find your Needle: Small Object Image Retrieval via Multi-Object Attention Optimization cites MaskInversion: Localized Embeddings via Optimization of Explainability Maps
- Find your Needle: Small Object Image Retrieval via Multi-Object Attention Optimization cites Learning Transferable Visual Models From Natural Language Supervision
- DAVE: Distribution-aware Attribution via ViT Gradient Decomposition cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- DAVE: Distribution-aware Attribution via ViT Gradient Decomposition cites B-cosification: Transforming Deep Neural Networks to be Inherently Interpretable
- Attention (as Discrete-Time Markov) Chains cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Attention (as Discrete-Time Markov) Chains cites Vision Transformers Need Registers
- Attention (as Discrete-Time Markov) Chains cites Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers
- Attention (as Discrete-Time Markov) Chains cites Learning Transferable Visual Models From Natural Language Supervision
- MaskInversion: Localized Embeddings via Optimization of Explainability Maps cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- MaskInversion: Localized Embeddings via Optimization of Explainability Maps cites Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers
- MaskInversion: Localized Embeddings via Optimization of Explainability Maps cites Learning Transferable Visual Models From Natural Language Supervision
- Sigmoid Loss for Language Image Pre-Training cites Learning Transferable Visual Models From Natural Language Supervision
- Vision Transformers Need Registers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Vision Transformers Need Registers cites Learning Transferable Visual Models From Natural Language Supervision
- Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers cites Learning Transferable Visual Models From Natural Language Supervision
- B-cosification: Transforming Deep Neural Networks to be Inherently Interpretable cites Sigmoid Loss for Language Image Pre-Training
- B-cosification: Transforming Deep Neural Networks to be Inherently Interpretable cites Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder Transformers
- B-cosification: Transforming Deep Neural Networks to be Inherently Interpretable 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
Cited by top-tier papers7
- B-cosification: Transforming Deep Neural Networks to be Inherently InterpretableShreyash Arya, Sukrut Rao, Moritz Böhle, Bernt SchieleNeurIPS 2024 · 14 citations
- Attention (as Discrete-Time Markov) ChainsYotam Erel, Olaf Dünkel, Rishabh Dabral, Vladislav Golyanik et al.NeurIPS 2025 · 12 citations
- MaskInversion: Localized Embeddings via Optimization of Explainability MapsWalid Bousselham, Sofian Chaybouti, Christian Rupprecht, Vittorio Ferrari et al.ICLR 2026 · 3 citations
- DAVE: Distribution-aware Attribution via ViT Gradient DecompositionAdam Wróbel, Siddhartha Gairola, Jacek Tabor, Bernt Schiele et al.ICML 2026 · 2 citations
- Find your Needle: Small Object Image Retrieval via Multi-Object Attention OptimizationMichael Green, Matan Levy, Issar Tzachor, Dvir Samuel et al.NeurIPS 2025 · 1 citation
Builds on18
- Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
- 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
- Sigmoid Loss for Language Image Pre-TrainingXiaohua Zhai, Basil Mustafa, Alexander Kolesnikov, Lucas BeyerICCV 2023 · 2,932 citations
- Vision Transformers Need RegistersTimothée Darcet, Maxime Oquab, Julien Mairal, Piotr BojanowskiICLR 2024 · 769 citations
- Generic Attention-model Explainability for Interpreting Bi-Modal and Encoder-Decoder TransformersHila Chefer, Shir Gur, Lior WolfICCV 2021 · 451 citations
Related papers
- Attention Guided CAM: Visual Explanations of Vision Transformer Guided by Self-AttentionSaebom Leem, Hyunseok SeoAAAI 2024 · 40 citations
- Learning to Estimate Shapley Values with Vision TransformersIan Connick Covert, Chanwoo Kim, Su-In LeeICLR 2023 · 12 citations
- Metric-Driven Attributions for Vision TransformersChase Walker, Sumit Kumar Jha, Rickard EwetzICLR 2025
- XAI for Transformers: Better Explanations through Conservative PropagationAmeen Ali, Thomas Schnake, Oliver Eberle, Grégoire Montavon et al.ICML 2022 · 144 citations
- AttCAT: Explaining Transformers via Attentive Class Activation TokensYao Qiang, Deng Pan, Chengyin Li, Xin Li et al.NeurIPS 2022 · 66 citations
