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

Manuscript Offprint

arXiv:1906.03731

Is Attention Interpretable?

Sofia Serrano, Noah A. Smith

Abstract

Attention mechanisms have recently boosted performance on a range of NLP tasks. Because attention layers explicitly weight input components’ representations, it is also often assumed that attention can be used to identify information that models found important (e.g., specific contextualized word tokens). We test whether that assumption holds by manipulating attention weights in already-trained text classification models and analyzing the resulting differences in their predictions. While we observe some ways in which higher attention weights correlate with greater impact on model predictions, we also find many ways in which this does not hold, i.e., where gradient-based rankings of attention weights better predict their effects than their magnitudes. We conclude that while attention noisily predicts input components’ overall importance to a model, it is by no means a fail-safe indicator.

1 Introduction

Interpretability is a pressing concern for many current NLP models. As they become increasingly complex and learn decision-making functions from data, ensuring our ability to understand why a particular decision occurred is critical.

Part of that development has been the incorporation of attention mechanisms Bahdanau et al. (2015) into models for a variety of tasks. For many different problems—to name a few, machine translation Luong et al. (2015), syntactic parsing Vinyals et al. (2015), reading comprehension Hermann et al. (2015), and language modeling Liu and Lapata (2018)—incorporating attention mechanisms into models has proven beneficial for performance. While there are many variants of attention Vaswani et al. (2017), each formulation consists of the same high-level goal: calculating nonnegative weights for each input component (e.g., word) that together sum to 1, multiplying those weights by their corresponding representations, and summing the resulting vectors into a single fixed-length representation.

Since attention calculates a distribution over inputs, prior work has used attention as a tool for interpretation of model decisions Wang et al. (2016); Lee et al. (2017); Lin et al. (2017); Ghaeini et al. (2018). The existence of so much work on visualizing attention weights is a testament to attention’s popularity in this regard; to name just a few examples of these weights being examined to understand a model, recent work has focused on goals from explaining and debugging the current system’s decision Lee et al. (2017); Ding et al. (2017) to distilling important traits of a dataset Yang et al. (2017); Habernal et al. (2018).

Despite this, existing work on interpretability is only beginning to assess what computed attention weights actually communicate. In an independent and contemporaneous study, Jain and Wallace (2019) explore whether attention mechanisms can identify the relative importance of inputs to the full model, finding them to be highly inconsistent predictors. In this work, we apply a different analysis based on intermediate representation erasure to assess whether attention weights can instead be relied upon to explain the relative importance of the inputs to the attention layer itself. We find similar cause for concern: attention weights are only noisy predictors of even intermediate components’ importance, and should not be treated as justification for a decision.

References (15)