Source-linked AI summary
Knowledge-Enriched Transformer for Emotion Detection in Textual Conversations
Peixiang Zhong, Di Wang, Chunyan Miao
TL;DR
Emotion detection in textual conversations is difficult because implicit emotions depend on context and commonsense knowledge. The paper proposes KET, which combines hierarchical self-attention with dynamic context-aware affective graph attention. Across multiple datasets, context and commonsense knowledge consistently improve performance, and KET outperforms state-of-the-art models on most tested datasets.
Problem
Emotion detection in textual conversations is challenging because machines must capture contextual and commonsense knowledge used to express implicit emotions.
Method
KET models conversational structure with hierarchical self-attention and dynamically incorporates external emotion-related knowledge through context-aware affective graph attention.
Results
KET outperforms state-of-the-art models on most tested datasets, while contextual information and commonsense knowledge consistently benefit emotion detection performance.
Takeaways & Limitations
Context and commonsense knowledge are beneficial for detecting emotions in textual conversations across datasets of varying sizes and domains.
Takeaways & Limitations
Disgust and fear remain difficult to differentiate, with fear achieving an F1 score as low as 0.0667 in MELD.
Abstract
from arXiv · showhide
Messages in human conversations inherently convey emotions. The task of detecting emotions in textual conversations leads to a wide range of applications such as opinion mining in social networks. However, enabling machines to analyze emotions in conversations is challenging, partly because humans often rely on the context and commonsense knowledge to express emotions. In this paper, we address these challenges by proposing a Knowledge-Enriched Transformer (KET), where contextual utterances are interpreted using hierarchical self-attention and external commonsense knowledge is dynamically leveraged using a context-aware affective graph attention mechanism. Experiments on multiple textual conversation datasets demonstrate that both context and commonsense knowledge are consistently beneficial to the emotion detection performance. In addition, the experimental results show that our KET model outperforms the state-of-the-art models on most of the tested datasets in F1 score.
1 Introduction
Emotion detection in textual conversations is challenging because interpreting implicit emotions often requires conversational context and commonsense knowledge. KET addresses these challenges with hierarchical contextual modeling and dynamically selected affective knowledge, outperforming state-of-the-art models on most tested datasets.
- Emotion detection in conversations supports applications including opinion mining and emotion-aware conversational agents.
- Machines struggle with conversational emotions because people rely on context and commonsense knowledge to express them implicitly.
- KET uses hierarchical self-attention to model conversational structure and separates context and response into encoder and decoder components.
- KET dynamically retrieves context-aware, emotion-related knowledge entities using a graph attention mechanism balancing relatedness and affectiveness.
- KET outperforms state-of-the-art models on most tested datasets, while experiments show that contextual information and commonsense knowledge benefit performance.
2 Related Work
Related work spans lexicon-based and audio-feature methods for call-center dialogs, deep learning for conversational media, and knowledge graphs for conversation systems. KET differs by dynamically selecting context-aware knowledge entities while balancing relatedness and affectiveness.
- Emotion Detection in Conversations: Early emotion detection in conversations used lexicon-based methods, audio features, and unigram topic modeling for call-center dialogs.
- Emotion Detection in Conversations: Recent deep learning studies model emotions in conversational videos and multi-turn Tweets using recurrent architectures and speaker, context, and emotion information.
- Knowledge Base in Conversations: Knowledge graphs have been used to enrich sentence interpretation and generate knowledge-aware responses through graph attention.
- Knowledge Base in Conversations: Unlike static graph attention tied to a recognized entity, KET dynamically selects context-aware entities while balancing relatedness and affectiveness.
3 Our Proposed KET Model
KET combines contextual modeling with external commonsense knowledge to represent conversations for emotion detection. Its architecture uses hierarchical attention over utterances and affective, context-aware graph attention over retrieved concepts.
- Knowledge Retrieval: ConceptNet provides connected concepts for non-stopword tokens, filtered by vocabulary membership and confidence scores.Each token retrieves its immediate ConceptNet neighbors, while stopwords, out-of-vocabulary concepts, and low-confidence concepts are removed.
- Knowledge Retrieval: KET uses contextual utterances and external knowledge bases to address emotion detection challenges in textual conversations.The model uses ConceptNet and NRC VAD as knowledge sources.
- Dynamic Context-Aware Affective Graph Attention: The affective graph attention mechanism weights concepts using conversational relatedness and emotion intensity.Relatedness uses concept confidence, cosine similarity, and the conversation representation; affectiveness uses valence and arousal deviations.
- Dynamic Context-Aware Affective Graph Attention: λ_k balances relatedness and affectiveness when computing concept weights and may be fixed or learned during training.The weighting mechanism regulates each concept’s contribution to enriching token representations.
- Hierarchical Self-Attention: Hierarchical self-attention first represents each utterance, then derives a context representation from M learned utterance representations.The model uses utterance-level and context-level self-attention to exploit conversation structure.
4 Experimental Settings
The experiments evaluate KET and multiple baselines across five emotion-detection datasets, using dataset-specific F1 metrics and reported model variants.
- Datasets: KET is evaluated on five emotion-detection datasets spanning different sizes and domains.The datasets include EC, DailyDialog, MELD, EmoryNLP, and IEMOCAP.
- Evaluation Metrics: EC and DailyDialog use micro-averaged F1 excluding the majority class, while the other datasets use weighted macro-F1.The majority class exceeds 80% of the test set in EC and DailyDialog.
- Baselines: The baseline comparisons include contextual LSTM, CNN, CNN+cLSTM, BERT BASE, and other contextual conversation models.The supplied settings describe cLSTM, CNN, CNN+cLSTM, and BERT BASE as comparison systems.
- Model Variants: KET StdAttn replaces KET’s dynamic context-aware affective graph attention with standard graph attention.This variant is used to assess the contribution of the proposed graph-attention mechanism.
- Implementation: All datasets are lower-cased and tokenized with spaCy, while models are fine-tuned according to validation-set performance.KET uses Adam with batch size 64, learning rate 0.0001, and GloVe initialization; class weights address label imbalance.
5 Result Analysis
KET outperforms baselines on most tested datasets, while analyses show benefits from context and commonsense knowledge but diminishing returns from additional context. Ablations support the importance of hierarchical self-attention and dynamic affective graph attention, although some emotions remain difficult to detect.
- 5.1 Comparison with Baselines: KET outperforms the baselines on most tested datasets and is described as robust across varying training sizes, context lengths, and domains.The comparison covers five test sets, with results reported in Table 2.
- 5.1 Comparison with Baselines: KET SingleSelfAttn and KET StdAttn are generally worse than KET, supporting the importance of hierarchical self-attention and dynamic context-aware affective graph attention.The variants perform comparably with KET on EC, but noticeably worse on the other datasets.
- 5.2 Model Analysis: Context improves KET performance on all datasets, but additional context yields diminishing gains or harms performance in some datasets.The authors suggest that longer context may introduce noise, including polysemous words with differing meanings.
- 5.2 Model Analysis: Adding more ConceptNet concepts consistently improves performance until reaching a plateau, supporting the value of commonsense knowledge for emotion detection.The analysis varies the retained random fraction of ConceptNet concepts.
- 5.3 Error Analysis: Disgust and fear are generally difficult to distinguish, with fear reaching an F1 score of 0.0667 in MELD.The authors associate this difficulty with intrinsic similarity between the emotions and limited data.
6 Conclusion
The knowledge-enriched transformer combines hierarchical self-attention with dynamically retrieved, context-aware, emotion-related knowledge entities to detect emotions in textual conversations. Experiments find contextual information and commonsense knowledge beneficial, with performance surpassing state-of-the-art models on most tested datasets and adaptability to other languages.
- KET learns structured conversation representations through hierarchical self-attention and dynamically refers to context-aware, emotion-related knowledge entities.The model uses external knowledge bases to enrich conversation understanding.
- Both contextual information and commonsense knowledge improve emotion-detection performance.
- KET outperforms state-of-the-art models on most tested datasets spanning varying sizes and domains.
- KET can be adapted to other languages using similar emotion lexicons and ConceptNet's multilingual knowledge base.