Reproduce “Grad-SAM: Explaining Transformers via Gradient Self-Attention Maps” on OpenResearch
Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Oren Barkan, Edan Hauon, Avi Caciularu, Ori Katz, Itzik Malkiel, Omri Armstrong, Noam Koenigstein
Grad-SAM introduces a method for explaining Transformer predictions by combining self-attention maps with rectified gradients. It identifies input tokens most critical for a model's decision, consistently outperforming existing baselines in faithfulness on various NLP tasks.
Key insights
- Combining self-attention activations with their rectified gradients offers a more faithful explanation of Transformer predictions than using attention or raw gradients alone.
- Applying the ReLU function to gradients before aggregation is crucial, as it filters out negative gradients that can obscure the true positive contributions of tokens to a prediction.
- The proposed method, Grad-SAM, successfully identifies semantically relevant input tokens that are genuinely critical for a BERT model's decision across different NLP tasks.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.