Structured Self-Attention Weights Encode Semantics in Sentiment Analysis
Preprint
Abstract
Neural attention, especially the self-attention made popular by the Transformer, has become the workhorse of state-of-the-art natural language processing (NLP) models. Very recent work suggests that the self-attention in the Transformer encodes syntactic information; Here, we show that self-attention scores encode semantics by considering sentiment analysis tasks. In contrast to gradient-based feature attribution methods, we propose a simple and effective Layer-wise Attention Tracing (LAT) method to analyze structured attention weights. We apply our method to Transformer models trained on two tasks that have surface dissimilarities, but share common semantics---sentiment analysis of movie reviews and time-series valence prediction in life story narratives. Across both tasks, words with high aggregated attention weights were rich in emotional semantics, as quantitatively validated by an emotion lexicon labeled by human annotators. Our results show that structured attention weights encode rich semantics in sentiment analysis, and match human interpretations of semantics.Keywords
All Related Versions
This publication has 8 references indexed in Scilit:
- Quantifying Attention Flow in Transformers2020
- Modeling Emotion in Complex Stories: The Stanford Emotional Narratives DatasetIEEE Transactions on Affective Computing, 2019
- Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Pruned2019
- Learning Structured Text RepresentationsTransactions of the Association for Computational Linguistics, 2018
- On Pixel-Wise Explanations for Non-Linear Classifier Decisions by Layer-Wise Relevance PropagationPLOS ONE, 2015
- Norms of valence, arousal, and dominance for 13,915 English lemmasBehavior Research Methods, 2013
- Review and comparison of methods to study the contribution of variables in artificial neural network modelsEcological Modelling, 2003
- Use of some sensitivity criteria for choosing networks with good generalization abilityNeural Processing Letters, 1995