[论文解读] LeGrad: An Explainability Method for Vision Transformers via Feature Formation Sensitivity
LeGrad 引入了一种分层次的基于梯度的可解释性方法,用于视觉Transformer,跨层聚合相对于注意力图的梯度信号,以生成鲁棒、开放词汇且对扰动友好的定位图。它在分割、开放词汇检测以及跨 ViT 主干的鲁棒性基准上,优于现有SOTA方法。
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.
研究动机与目标
- 通过设计与 ViT 注意力图相关的基于梯度的可解释性方法,弥补 Vision Transformers (ViTs) 的可解释性差距。
- 利用逐层梯度捕捉跨多个 ViT 层的特征形成,并将它们聚合成一个单一的可解释性映射。
- 在多种 ViT 主干上证明 LeGrad 在分割、开放词汇检测和扰动评估方面的有效性。
- 表明 LeGrad 能扩展到非常大的 ViTs,并适应不同的特征聚合策略。
- 提供一个无超参数、模型无关的工具,在训练或微调阶段不需要定位注释。
提出的方法
- 对每一层的 ViT 注意力图计算目标类别激活对其的梯度。
- 在聚合前对负贡献应用 ReLU 进行截断。
- 对所有层的逐层可解释性信号进行平均,并重塑为二维热力图。
- 通过使用池化器的注意力图来替代自注意力图,将方法适配到注意力池化器。
- 在分割(ImageNet-Seg)、开放词汇检测(OpenImagesV7)和扰动测试(ImageNet-val)上进行评估。
- 证明与各种 ViT 主干(ViT-B/16 到 ViT-BigG/14)以及聚合方案的兼容性。

实验结果
研究问题
- RQ1LeGrad 是否能够通过对 ViT 注意力图求梯度,将模型决策忠实地归因到图像区域?
- RQ2将跨层的逐层信号进行池化是否比仅使用层特定的映射能提升 ViT 的可解释性?
- RQ3在不同 ViT 主干上,LeGrad 在分割、开放词汇定位和基于扰动的评估中的表现如何?
- RQ4LeGrad 是否可扩展到非常大的 ViTs,并适应不同的特征聚合方法?
- RQ5在训练阶段不需要定位注释时,LeGrad 是否仍能保持性能?
主要发现
| 方法 | 像素准确度 | mIoU | mAP |
|---|---|---|---|
| LRP | 52.81 | 33.57 | 54.37 |
| Partial-LRP | 61.49 | 40.71 | 72.29 |
| rollout | 60.63 | 40.64 | 74.47 |
| Raw attention | 65.67 | 43.83 | 76.05 |
| GradCAM | 70.27 | 44.50 | 70.30 |
| CheferCAM | 69.21 | 47.47 | 78.29 |
| TextSpan | 73.01 | 40.26 | 81.4 |
| LeGrad | 77.52 | 58.66 | 82.49 |
- 在 ImageNet-Seg 上,LeGrad 在 CLIP ViT-B/16 条件下实现了更高的 mIoU(58.66)和像素精度(77.52),优于其他方法。
- 在 OpenImagesV7 开放词汇分割中,LeGrad 超越了所有 SOTA 方法,并在不同模型尺寸上取得显著提升。
- LeGrad 的基于扰动的评估在正负扰动下都表现出色,常常超越基线(基于梯度和基于注意力的)。
- LeGrad 可扩展到 ViT-BigG/14(2.5B 参数),并在不同的池化策略下仍然有效。
- 在 SigLIP-B/16 上,LeGrad 在开放词汇定位方面实现了显著的 p-mIoU 提升。
- 定性分析显示,LeGrad 的解释专注于相关物体,同时抑制嘈杂背景伪影。

更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。