Introduction
Traditional sentiment analysis often relies on static emotional lexicons—fixed lists that assign a single emotion to a word. However, language is inherently contextual; a word like "damn" can signal anger in one sentence ("Wash your damn hands") and joy in another ("Damn, they are killing it!"). This paper explores how contextualized word representations from modern language models (LLMs) can "untangle" these multiple emotional meanings, effectively acting as a dynamic lexicon that adapts to the surrounding text.
Methodology
The researchers developed a four-step pipeline to investigate emotional ambiguity:
- Target Word Identification: Using the NRC-Affect lexicon to identify words with multiple emotional associations in annotated datasets.
- Representation Generation: Extracting embedding vectors for target words using BERT, RoBERTa, XLNet, and GPT-2 across various layers to determine which "depth" captures emotion best.
- Clustering: Applying a Gaussian Mixture Model (GMM) to group embeddings based on their contextual usage.
- Disambiguation: Mapping clusters to ground-truth emotions using the Hungarian algorithm and estimating the number of emotional "senses" via an adjusted Bayesian Information Criterion (ABIC).
Key Insights: The Emotional Profiles of Words
The study reveals that models carry "emotional baggage" or priors from their pre-training data. For instance, models often bias "damn" toward negative emotions due to its frequent co-occurrence with profanity in training corpora, sometimes overlooking its use as a positive intensifier.
A critical finding involves the "sweet spot" for emotional information within model architectures. For bidirectional models like BERT and RoBERTa, the upper layers (closer to the output) are most effective at distinguishing emotions. In contrast, XLNet and GPT-2 perform best in their middle layers. The final layer (Layer 24) consistently underperforms, likely because it is overly specialized for the specific pre-training objective rather than general semantic nuances.
Results and Performance
RoBERTa emerged as the top performer across nearly all metrics. The authors attribute this to its dynamic masking and robust pre-training, which capture subtler semantic shifts more effectively than its counterparts.
Key quantitative results include:
- Clustering Success: RoBERTa achieved a macro-average match rate of 0.707 on the GoEmotions dataset, correctly grouping emotional contexts over 70% of the time without explicit labels.
- Sense Estimation: RoBERTa accurately estimated the number of distinct emotional connotations for over 60% of the words analyzed.
- Classification Boost: Replacing static lexicon ratings with context-aware ratings derived from these embeddings significantly improved sentence-level emotion classification, raising the F1-macro score from 0.324 to 0.382 on GoEmotions.
Conclusion
This research demonstrates that LLMs contain deep, latent knowledge of emotional connotations that can be extracted to improve sentiment analysis. While currently limited to English and existing lexicons, future work aims to expand these techniques to multilingual settings and more complex linguistic phenomena like sarcasm, where the emotional connotation is the opposite of the literal word choice.
Summary updated