Is Attention Interpretable?
Table 3: Classification accuracy of the different trained models on their respective test sets
['[BOLD] Dataset', '[BOLD] HANrnn', '[BOLD] HANconv', '[BOLD] HANnoenc', '[BOLD] FLANrnn', '[BOLD] FLANconv', '[BOLD] FLANnoenc']
Specifically, we use the additive formulation originally defined in Bahdanau et al. Given attention layer ℓ’s learned parameters, element i of a sequence, and its encoded representation hi, the attention weight αi is computed using ℓ’s learned context vector cℓ as follows: ui= tanh(Wℓhi+bℓ) αi= expu⊤icℓ∑iexpu⊤icℓ We evaluate on the original HAN architecture, but we also vary that architecture in two key ways: Number of attention layers: besides exploring models with a final layer of attention over sentence representations (which we denote with a “HAN” prefix), we also train “flat” attention networks with only one layer of attention over all contextualized word tokens (which we denote with a “FLAN” prefix). In either case, though, we only run tests on models’ final layer of attention. Reach of encoder contextualization: The original HAN uses recurrent encoders to contextualize input tokens prior to an attention layer (specifically, bidirectional GRUs running over the full sequence). We denote this variant of an architecture with a “conv” suffix. Finally, we also test models that are trained with no contextualizing encoder at all; we denote these with a “noenc” suffix. We note that our IMDB data and Yelp data are different sets of reviews from those used by Yang et al. We were unable to reach a comparable performance for the Amazon dataset (and Yelp dataset, although different) to that in Yang et al. We suspect that this is due to not pretraining the word2vec embeddings used by the model for long enough, combined with memory limitations on our hardware that necessitated decreasing our batch size in many cases. However, as noted in section 3, the analysis that we perform does not depend on model accuracy. It’s also worth noting that for the datasets for which we are able to get results that either pass or come close to the accuracies listed in the original HAN paper, the patterns we see in the results for the tests that we run are the same as the patterns that we see for the others.