LeGrad: An Explainability Method for Vision Transformers via Feature Formation Sensitivity

Walid Bousselham, Angie Boggust, Sofian Chaybouti, Hendrik Strobelt, Hilde Kuehne
4/4/2024
cs.CV

Official code: WalBouss/LeGrad (93 stars, MIT, last commit 2024-10-14).

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.

View on arXivView PDF

Code Implementations(1)

WalBouss/LeGradOfficial100%
MIT

[ICCV25] Official Implementation of LeGrad

9311PythonMar 25, 20242 years agoMIT

Similar Papers

Cite this paper

@article{bousselham2024legrad,
  title  = {LeGrad: An Explainability Method for Vision Transformers via Feature Formation Sensitivity},
  author = {Walid Bousselham and Angie Boggust and Sofian Chaybouti and Hendrik Strobelt and Hilde Kuehne},
  year   = {2024},
  eprint = {2404.03214},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.03214v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.03214.svg)](https://codeofpaper.com/paper/2404.03214)

Discussion