Self-Attention Attribution: Interpreting Information Interactions Inside Transformer

Yaru Hao, Li Dong, Furu Wei, Ke Xu
4/23/2020
317 citations
cs.CL
transformer-attention

Official code: YRdddream/attattr (89 stars, Python, last commit 2022-10-08).

Abstract

The great success of Transformer-based models benefits from the powerful multi-head self-attention mechanism, which learns token dependencies and encodes contextual information from the input. Prior work strives to attribute model decisions to individual input features with different saliency measures, but they fail to explain how these input features interact with each other to reach predictions.

Show full abstract

In this paper, we propose a self-attention attribution method to interpret the information interactions inside Transformer. We take BERT as an example to conduct extensive studies. Firstly, we apply self-attention attribution to identify the important attention heads, while others can be pruned with marginal performance degradation. Furthermore, we extract the most salient dependencies in each layer to construct an attribution tree, which reveals the hierarchical interactions inside Transformer. Finally, we show that the attribution results can be used as adversarial patterns to implement non-targeted attacks towards BERT.

View on arXivView PDF

Code Implementations(1)

YRdddream/attattrOfficial100%
8918PythonMar 22, 20214 years ago

Similar Papers

Cite this paper

@article{hao2020selfattention,
  title  = {Self-Attention Attribution: Interpreting Information Interactions Inside Transformer},
  author = {Yaru Hao and Li Dong and Furu Wei and Ke Xu},
  year   = {2020},
  eprint = {2004.11207},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2004.11207}
}

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

Discussion