XAI for Transformers: Better Explanations through Conservative Propagation

Ameen Ali, Thomas Schnake, Oliver Eberle, Grégoire Montavon, Klaus-Robert Müller +1 more
2/15/2022
cs.LG
transformer-attention

Official code: AmeenAli/XAI_Transformers (67 stars, Jupyter Notebook, MIT, last commit 2022-02-14).

Abstract

Transformers have become an important workhorse of machine learning, with numerous applications. This necessitates the development of reliable methods for increasing their transparency.

Show full abstract

Multiple interpretability methods, often based on gradient information, have been proposed. We show that the gradient in a Transformer reflects the function only locally, and thus fails to reliably identify the contribution of input features to the prediction. We identify Attention Heads and LayerNorm as main reasons for such unreliable explanations and propose a more stable way for propagation through these layers. Our proposal, which can be seen as a proper extension of the well-established LRP method to Transformers, is shown both theoretically and empirically to overcome the deficiency of a simple gradient-based approach, and achieves state-of-the-art explanation performance on a broad range of Transformer models and datasets.

View on arXivView PDF

Code Implementations(1)

MIT

Official Code Implementation of the paper : XAI for Transformers: Better Explanations through Conservative Propagation

6716Jupyter Notebook, PythonFeb 11, 20224 years agoMIT

Similar Papers

Cite this paper

@article{ali2022transformers,
  title  = {XAI for Transformers: Better Explanations through Conservative Propagation},
  author = {Ameen Ali and Thomas Schnake and Oliver Eberle and Grégoire Montavon and Klaus-Robert Müller and Lior Wolf},
  year   = {2022},
  eprint = {2202.07304},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2202.07304}
}

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/2202.07304.svg)](https://codeofpaper.com/paper/2202.07304)

Discussion