arXiv(opens in a new tab)Computer ScienceAug 2019Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:1908.04626

Attention is not not Explanation

Sarah Wiegreffe, Yuval Pinter

Abstract

Attention mechanisms play a central role in NLP systems, especially within recurrent neural network (RNN) models. Recently, there has been increasing interest in whether or not the intermediate representations offered by these modules may be used to explain the reasoning for a model’s prediction, and consequently reach insights regarding the model’s decision-making process. A recent paper claims that ‘Attention is not Explanation’ Jain and Wallace (2019). We challenge many of the assumptions underlying this work, arguing that such a claim depends on one’s definition of explanation, and that testing it needs to take into account all elements of the model. We propose four alternative tests to determine when/whether attention can be used as explanation: a simple uniform-weights baseline; a variance calibration based on multiple random seed runs; a diagnostic framework using frozen weights from pretrained models; and an end-to-end adversarial attention training protocol. Each allows for meaningful interpretation of attention mechanisms in RNN models. We show that even when reliable adversarial distributions can be found, they don’t perform well on the simple diagnostic, indicating that prior work does not disprove the usefulness of attention mechanisms for explainability.

1 Introduction

∅\emptyset3.23.33.44

Figure 1: Schematic diagram of a classification LSTM model with attention, including the components manipulated or replaced in the experiments performed in Jain and Wallace (2019) and in this work (by section).

Attention mechanisms Bahdanau et al. (2014) are nowadays ubiquitous in NLP, and their suitability for providing explanations for model predictions is a topic of high interest Xu et al. (2015); Rocktäschel et al. (2015); Mullenbach et al. (2018); Thorne et al. (2019); Serrano and Smith (2019). If they indeed offer such insights, many application areas would benefit by better understanding the internals of neural models that use attention as a means for, e.g., model debugging or architecture selection. A recent paper Jain and Wallace (2019) points to possible pitfalls that may cause researchers to misapply attention scores as explanations of model behavior, based on a premise that explainable attention distributions should be consistent with other feature-importance measures as well as exclusive given a prediction. Its core argument, which we elaborate in §2, is that if alternative attention distributions exist that produce similar results to those obtained by the original model, then the original model’s attention scores cannot be reliably used to “faithfully” explain the model’s prediction. Empirically, the authors show that achieving such alternative distributions is easy for a large sample of English-language datasets.

We contend (§2.1) that while Jain and Wallace ask an important question, and raise a genuine concern regarding potential misuse of attention weights in explaining model decisions on English-language datasets, some key assumptions used in their experimental design leave an implausibly large amount of freedom in the setup, ultimately leaving practitioners without an applicable way for measuring the utility of attention distributions in specific settings.

We apply a more model-driven approach to this question, beginning (§3.2) with testing attention modules’ contribution to a model by applying a simple baseline where attention weights are frozen to a uniform distribution. We demonstrate that for some datasets, a frozen attention distribution performs just as well as learned attention weights, concluding that randomly- or adversarially-perturbed distributions are not evidence against attention as explanation in these cases. We next (§3.3) examine the expected variance in attention-produced weights by initializing multiple training sequences with different random seeds, allowing a better quantification of how much variance can be expected in trained models. We show that considering this background stochastic variation when comparing adversarial results with a traditional model allows us to better interpret adversarial results. In §3.4, we present a simple yet effective diagnostic tool which tests attention distributions for their usefulness by using them as frozen weights in a non-contextual multi-layered perceptron (MLP) architecture. The favorable performance of LSTM-trained weights provides additional support for the coherence of trained attention scores. This demonstrates a sense in which attention components indeed provide a meaningful model-agnostic interpretation of tokens in an instance.

In §4, we introduce a model-consistent training protocol for finding adversarial attention weights, correcting some flaws we found in the previous approach. We train a model using a modified loss function which takes into account the distance from an ordinarily-trained base model’s attention scores in order to learn parameters for adversarial attention distributions. We believe these experiments are now able to support or refute a claim of faithful explainability, by providing a way for convincingly saying by construction that a plausible alternative ‘explanation’ can (or cannot) be constructed for a given dataset and model architecture. We find that while plausibly adversarial distributions of the consistent kind can indeed be found for the binary classification datasets in question, they are not as extreme as those found in the inconsistent manner, as illustrated by an example from the IMDb task in Figure 2. Furthermore, these outputs do not fare well in the diagnostic MLP, calling into question the extent to which we can treat them as equally powerful for explainability.

Finally, we provide a theoretical discussion (§5) on the definitions of interpretability and explainability, grounding our findings within the accepted definitions of these concepts.

Our four quantitative experiments are illustrated in Figure 1, where each bracket on the left covers the components in a standard RNN-with-attention architecture which we manipulate in each experiment. We urge NLP researchers to consider applying the techniques presented here on their models containing attention in order to evaluate its effectiveness at providing explanation. We offer our code for this purpose at https://github.com/sarahwie/attention.

Base modelbrilliant and moving performances by tom and peter finch
Jain and Wallace (2019)brilliant and moving performances by tom and peter finch
Our adversarybrilliant and moving performances by tom and peter finch

Figure 2: Attention maps for an IMDb instance (all predicted as positive with score >0.998>0.998), showing that in practice it is difficult to learn a distant adversary which is consistent on all instances in the training set.