How Much Does Attention Actually Attend? Questioning the Importance of Attention in Pretrained Transformers

Michael Hassid, Hao Peng, Daniel Rotem, Jungo Kasai, Ivan Montero +2 more
11/7/2022
cs.CLcs.LG
transformer-attention

Official code: schwartz-lab-NLP/papa (27 stars, Python, last commit 2022-11-08).

Abstract

The attention mechanism is considered the backbone of the widely-used Transformer architecture. It contextualizes the input by computing input-specific attention matrices.

Show full abstract

We find that this mechanism, while powerful and elegant, is not as important as typically thought for pretrained language models. We introduce PAPA, a new probing method that replaces the input-dependent attention matrices with constant ones -- the average attention weights over multiple inputs. We use PAPA to analyze several established pretrained Transformers on six downstream tasks. We find that without any input-dependent attention, all models achieve competitive performance -- an average relative drop of only 8% from the probing baseline. Further, little or no performance drop is observed when replacing half of the input-dependent attention matrices with constant (input-independent) ones. Interestingly, we show that better-performing models lose more from applying our method than weaker models, suggesting that the utilization of the input-dependent attention mechanism might be a factor in their success. Our results motivate research on simpler alternatives to input-dependent attention, as well as on methods for better utilization of this mechanism in the Transformer architecture.

View on arXivView PDF

Code Implementations(1)

Code for the PAPA paper

272PythonOct 18, 20224 years ago

Similar Papers

Cite this paper

@article{hassid2022much,
  title  = {How Much Does Attention Actually Attend? Questioning the Importance of Attention in Pretrained Transformers},
  author = {Michael Hassid and Hao Peng and Daniel Rotem and Jungo Kasai and Ivan Montero and Noah A. Smith and Roy Schwartz},
  year   = {2022},
  eprint = {2211.03495},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2211.03495}
}

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

Discussion