Supervised Prototypical Contrastive Learning for Emotion Recognition in Conversation

Xiaohui Song, Longtao Huang, Hui Xue, Songlin Hu · OpenReview

Abstract

Capturing emotions within a conversation plays an essential role in modern dialogue systems. However, the weak correlation between emotions and semantics brings many challenges to emotion recognition in conversation (ERC). Even semantically similar utterances, the emotion may vary drastically depending on contexts or speakers. In this paper, we propose a Supervised Prototypical Contrastive Learning (SPCL) loss for the ERC task. Leveraging the Prototypical Network, the SPCL targets at solving the imbalanced classification problem through contrastive learning and does not require a large batch size. Meanwhile, we design a difficulty measure function based on the distance between classes and introduce curriculum learning to alleviate the impact of extreme samples. We achieve state-of-the-art results on three widely used benchmarks.

The Challenge: Context and Imbalance

Emotion Recognition in Conversation (ERC) is a complex task because the relationship between semantics and emotion is often weak. Identical phrases can convey vastly different emotions based on the dialogue history or the speaker's intent. For instance, the phrase "Thanks a lot" might represent genuine appreciation in one scenario but biting sarcasm in another.

Contextual ambiguity in ERC: "Thanks a lot" can be sarcastic or sincere depending on the speaker and situation.

Beyond semantic ambiguity, ERC models face two significant technical hurdles:

  1. Class Imbalance: Datasets are typically dominated by "neutral" samples, while critical emotions like "fear" or "disgust" are rare. Standard Supervised Contrastive Learning (SCL) often fails here because small training batches may lack sufficient positive pairs for minority classes.
  2. Extreme Samples: Some utterances are inherently uninformative or noisy when viewed in isolation. Forcing a model to learn these difficult samples early in training can lead to poor convergence.

Proposed Method: SPCL-CL

To address these issues, the researchers developed the Supervised Prototypical Contrastive Learning (SPCL) framework, enhanced by a curriculum learning strategy.

Prompt-based Context Encoding

The model utilizes a pretrained language model (SimCSE) as its backbone. To better capture conversational dynamics, the input is structured as a prompt: [Context] for [Target Utterance], [Speaker] feels [Mask]. The model is then tasked with predicting the emotion at the <mask> position, effectively leveraging the model's internal knowledge of social context.

The prompt-based context encoder architecture using a masked language modeling objective.

Prototypical Contrastive Learning

Unlike standard SCL which compares individual samples within a batch, SPCL maintains a representation queue for each emotion. It calculates a prototype vector—the mean representation—for each category. Every sample is then contrasted against these prototypes. This ensures that even rare emotions always have a stable "anchor" to pull toward (positive prototype) and push away from (negative prototypes), regardless of batch size.

Curriculum Learning (CL)

The framework incorporates a "difficulty measure" function. This function evaluates how close a sample is to its own category prototype relative to others. By employing a sampling-based curriculum, the model is trained on "easy," clear-cut examples first, gradually introducing more ambiguous "hard" samples. This prevents the model from being derailed by noisy data early in the learning process.

Experimental Evaluation

The model was tested on three major benchmarks: IEMOCAP, MELD, and EmoryNLP. These datasets vary in size and emotion labels but all share the common trait of significant class imbalance.

The SPCL-CL-ERC model achieved new state-of-the-art (SOTA) performance:

  • IEMOCAP: 69.74% Weighted-F1
  • MELD: 67.25% Weighted-F1
  • EmoryNLP: 40.94% Weighted-F1

Ablation studies confirmed that SPCL is remarkably robust to small batch sizes. While standard SCL performance dropped by nearly 7% when reducing batch size from 32 to 4, SPCL's performance remained stable, dropping by only 0.82% on balanced data.

Conclusion

By integrating prototypical networks with contrastive learning and a curriculum-based training schedule, SPCL-CL-ERC effectively mitigates the issues of class imbalance and semantic noise in dialogue. This approach provides a more robust and computationally efficient path for developing emotionally intelligent AI systems.

Summary updated

BibTeX
@inproceedings{song2022supervised,
  author = {Xiaohui Song and Longtao Huang and Hui Xue and Songlin Hu},
  title = {{Supervised Prototypical Contrastive Learning for Emotion Recognition in Conversation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-main.347},
}
Figure