Attention is not Explanation

Sarthak Jain, Byron C. Wallace

Abstract

Sarthak Jain, Byron C. Wallace. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers).

2019.

Introduction

In modern Deep Learning, "Attention" mechanisms have become ubiquitous, serving both as performance enhancers and as a primary means of interpretability. When a model highlights specific words in a text—such as "waste" in a negative movie review—researchers often interpret these weights as an explanation for the model's decision. However, this paper argues that such interpretations are often misleading. There is a fundamental gap between attention (a mathematical weighting for computation) and explanation (the features truly responsible for an output). This study formally evaluates whether attention weights meet the criteria for meaningful explanations by testing their correlation with established importance measures and their uniqueness.

Methodology

The authors employ three rigorous strategies to evaluate the interpretability of attention:

  1. Correlation Analysis: Learned attention weights ($\alpha$) are compared against two "gold standard" feature importance measures: Gradients ($\tau_g$), which measure output sensitivity to input changes, and Leave-One-Out ($\tau_{loo}$), which measures the impact of removing a feature entirely. The mathematical framework for these computations is detailed in Algorithm 1.
Algorithm 1: Feature Importance Computations for correlation analysis.
  1. Attention Permutation: Attention weights are randomly shuffled across the input sequence to determine if the model’s prediction remains stable despite the change in focus.
  2. Adversarial Attention: The authors introduce a novel optimization procedure to find an alternative attention distribution ($\tilde{\alpha}$) that is maximally different from the original (maximizing Jensen-Shannon Divergence) yet yields the same prediction (minimizing Total Variation Distance). If a vastly different heatmap produces the same result, the original cannot be considered a unique explanation.

Results and Key Insights

The RNN "Smearing" Effect

A critical finding is that for models using Bi-directional RNNs (like LSTMs), attention and gradients are poorly correlated. This is attributed to the "smearing" of information: by the time the attention mechanism processes a hidden state, that state already incorporates information from surrounding words. Conversely, simpler models that use average embeddings show much stronger correlations, as the attention mechanism must perform the heavy lifting of feature selection.

Histograms of Kendall’s $\tau$ correlations between attention and gradient/LOO importance measures across various tasks and architectures.

Non-Uniqueness of Explanations

The "Adversarial Attention" experiments demonstrate that in many cases, an attention distribution can be found that ignores "important" words and focuses on irrelevant ones (e.g., stop words) without altering the model's final score. This suggests that attention heatmaps are merely one of many possible paths to a conclusion, rather than a definitive reason for it.

Quantitative Findings

  • Weak Correlation: For BiLSTM encoders, the mean Kendall’s $\tau$ correlation between attention and gradients was low (e.g., ~0.34 for SST).
  • Adversarial Success: The authors consistently found adversarial distributions with high JSD (near 0.69) that resulted in negligible prediction changes ($\Delta\hat{y} < 0.01$).
  • Permutation Stability: Shuffling attention in IMDB models resulted in a median output change of only 0.006, indicating the model is largely indifferent to the specific placement of attention weights.

Discussion and Limitations

While the findings are robust across classification, QA, and NLI tasks, the authors note certain boundaries. The study did not evaluate Sequence-to-Sequence tasks like Machine Translation, where attention may play a more structural role. Furthermore, while gradients and LOO are used as benchmarks, they are not absolute "ground truth" but rather more mathematically grounded alternatives to attention.

Conclusion

This work serves as a cautionary tale for the NLP community: attention heatmaps should not be treated as definitive explanations of model behavior. They are effective tools for improving performance, but they do not provide a reliable window into the model's internal reasoning process.

Summary updated

BibTeX
@inproceedings{jain2019attention,
  author = {Sarthak Jain and Byron C. Wallace},
  title = {{Attention is not Explanation}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2019},
  url = {https://openreview.net/forum?id=S146Dm-O-B},
}
Figure