NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Deep Neural Framework for Contextual Affect Detection

Kumar Shikhar Deep, Asif Ekbal, Pushpak BhattacharyyaarXiv 2020 · DOI

TL;DR

The Contextual Affect Detection (CAD) framework uses a hierarchical Bi-GRU architecture to identify emotions in multi-party dialogues. By combining contextual word embeddings (ELMo) with transfer learning from emoji-based models (DeepMoji), the system significantly outperforms previous state-of-the-art methods, particularly in capturing emotions that rely heavily on conversational context.

What Problem Does This Paper Address?

Detecting emotion in text is notoriously difficult because short, simple sentences are often ambiguous. A phrase like "There was no kangaroo!" might seem neutral in isolation, but in the context of a heated argument about a movie, it clearly expresses anger.

This challenge is amplified in multi-party dialogues (conversations with more than two people). In these scenarios, emotions can drift or switch rapidly as different speakers intervene. Traditional models often focus on sentence-level analysis, failing to capture the inter-dependence between words within a sentence and the inter-dependence between sentences within a larger dialogue. The authors aim to bridge this gap by building a model that "listens" to the entire conversation flow to resolve emotional ambiguity.

Table 1: Example utterances of a dialogue with their speaker and emotion label from EmotionLines [1] 2018 dataset

Methods

The authors propose the Contextual Affect Detection (CAD) framework, which utilizes a stacked, hierarchical structure to process information at two levels:

  1. Utterance-Encoder (Lower-Level): This layer processes individual sentences. It uses a Bidirectional Gated Recurrent Unit (Bi-GRU) to learn word dependencies. To represent words, the model concatenates traditional GloVe embeddings with ELMo (Embeddings from Language Models). ELMo is character-based and contextual, allowing the model to handle out-of-vocabulary words and understand how a word's meaning changes based on its neighbors.
  2. Dialogue-Encoder (Upper-Level): The output of the lower level is max-pooled and fed into a second Bi-GRU. This layer captures the "flow" of the conversation. To further enrich this representation, the authors incorporate DeepMoji features—2304-dimensional embeddings pre-trained on billions of tweets to capture emotional nuances associated with emojis.

The final hidden states are passed through a fully connected layer and a Softmax function to classify the utterance into one of eight categories: the six basic Ekman emotions (anger, fear, sadness, happiness, disgust, surprise) plus "neutral" and "non-neutral."

Fig. 1: Proposed Architecture

Datasets

The model was evaluated on the EmotionLines 2018 benchmark, which contains two distinct types of dialogue:

  • Friends TV series data: Scripts from the show, featuring multi-party conversations with high emotional variance.
  • EmotionPush Chat log data: Private Facebook Messenger conversations between two individuals, which tend to have a much higher frequency of "neutral" labels.
Table 2: Statistics of EmotionLines 2018 [1] dataset

Key Insights and Ideas

  • Context as a Disambiguator: The hierarchical approach confirms that "rare" emotions (like anger or sadness in a mostly neutral chat) are much easier to detect when the model considers the preceding utterances.
  • Feature Fusion is Essential: The combination of ELMo (for linguistic context) and DeepMoji (for affective transfer learning) provides a more robust feature set than using either alone. ELMo helps with the "what" (syntax/semantics), while DeepMoji helps with the "how" (emotional intent).
  • Handling Class Imbalance: Emotion datasets are notoriously skewed toward "neutral" states. The authors successfully used weighted categorical cross-entropy to ensure the model didn't become biased toward the majority class, allowing it to maintain high accuracy on rarer emotions like "Anger."

Key Results

The CAD framework achieved significant performance gains over the previous state-of-the-art (HiGRU):

  • Friends Dataset: Achieved an unweighted accuracy (UWA) of 74.39%, a 5.49% improvement over previous methods.
  • EmotionPush Dataset: Achieved a UWA of 80.18%, representing a 9.14% improvement.
  • Specific Emotion Gains: On the EmotionPush dataset, the accuracy for the "Anger" class increased by a staggering 17.38 points without sacrificing performance on other classes.

Qualitative analysis showed that the model is particularly adept at identifying "emotion drift," where a speaker's state changes due to the intervention of a third party.

Limitations and Future Work

The authors identified two primary areas for improvement:

  • Speaker Identity: The current model does not explicitly track who is speaking. This leads to errors where the model might incorrectly attribute the emotion of one speaker to another (a "loss of emotion drift"). Future iterations could benefit from speaker-aware embeddings.
  • Surface-Level Cues vs. Deep Sentiment: The model is sometimes "tricked" by expressions like "lol" or "haha." In cases where a user writes something sad followed by "haha" (e.g., "gone but not forgotten haha"), the model tends to over-rely on the laughing expression and predicts "Joy" instead of "Sadness." Refining how the model weighs these specific tokens against the broader context remains an open challenge.

Summary updated

BibTeX
@misc{deep2020deep,
  author = {Kumar Shikhar Deep and Asif Ekbal and Pushpak Bhattacharyya},
  title = {{A Deep Neural Framework for Contextual Affect Detection}},
  year = {2020},
  eprint = {2001.10169},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2001.10169},
}

Loading related content...

Figure