Emotion-Regularized Conditional Variational Autoencoder for Emotional Response Generation

Yu-Ping Ruan, Zhen-Hua LingIEEE Trans. Affect. Comput 2021 · DOI

Abstract

This paper presents an emotion-regularized conditional variational autoencoder (Emo-CVAE) model for generating emotional conversation responses. In conventional CVAE-based emotional response generation, emotion labels are simply used as additional conditions in prior, posterior, and decoder networks. Considering that emotion styles are naturally entangled with semantic contents in the language space, the Emo-CVAE model utilizes emotion labels to regularize the CVAE latent space by introducing an extra emotion prediction network. In the training stage, the estimated latent variables are required to predict the emotion labels and token sequences of the input responses simultaneously. Experimental results show that our Emo-CVAE model can learn a more informative and structured latent space than a conventional CVAE model and output responses with better content and emotion performance than baseline CVAE and sequence-to-sequence (Seq2Seq) models.

The Challenge of Emotional Intelligence in Chatbots

Building conversational agents that feel "human-like" requires more than grammatical accuracy; it requires emotional intelligence. While Conditional Variational Autoencoders (CVAEs) are a popular choice for generating diverse responses, they often treat emotion labels as simple external "style" tags.

The authors argue this approach is fundamentally flawed because emotion and semantic content are naturally entangled in language. Standard CVAE models frequently suffer from a "collapsed" or uninformative latent space where the model ignores the emotion label entirely. Furthermore, many existing models rely on older Recurrent Neural Network (RNN) architectures, failing to leverage the contextual power of modern pretrained Transformers like BERT.

The Emo-CVAE Architecture

To address these issues, the authors propose the Emotion-Regularized CVAE (Emo-CVAE). The model is built on a BERT backbone for both the encoder and decoder, providing a robust linguistic foundation.

Graphical comparison of (a) Conventional CVAE and (b) Proposed Emo-CVAE. In the proposed model, the emotion label $e$ is removed from the decoder input and instead predicted from the latent variable $z$ via a regularization network.

The core innovation lies in the Emotion Prediction Network. Unlike standard models that feed the emotion label directly into the decoder, Emo-CVAE forces the latent variable $z$ to carry the emotional "weight." During training, an extra Multi-Layer Perceptron (MLP) is tasked with recovering the emotion label $e$ directly from the sampled latent variable $z$. This acts as a regularizer, ensuring that $z$ contains sufficient emotional information to reconstruct both the words and the intended feeling.

Experimental Results

The model was evaluated using the STC (Short Text Conversation) dataset and a manually annotated NLPCC dataset covering eight emotion categories (e.g., happiness, sadness, anger).

Key findings include:

  • Emotional Accuracy: Emo-CVAE achieved 97.88% accuracy in expressing the target emotion, significantly outperforming the standard CVAE baseline of 84.29%.
  • Diversity: The model demonstrated superior sentence-level diversity, with a "Uniq" score of 97.16%, compared to 80.40% for the Seq2Seq model.
  • Latent Space Structure: Visualization via t-SNE revealed that while standard CVAE latent distributions are often jumbled, the Emo-CVAE latent space naturally organizes into distinct clusters based on emotion. This proves the regularization term successfully teaches the model the relationship between semantics and affect.

Conclusion

By leaning into the entanglement of style and content, Emo-CVAE creates a more structured and informative latent space. Human evaluations confirm that native speakers prefer Emo-CVAE responses for both emotional consistency and content relevance, particularly in challenging categories like "disgust" and "anger" where traditional models often fail. Future work may explore moving beyond discrete labels toward a continuous spectrum of human emotion.

Summary updated

BibTeX
@article{ruan2021emotion,
  author = {Yu-Ping Ruan and Zhen-Hua Ling},
  title = {{Emotion-Regularized Conditional Variational Autoencoder for Emotional Response Generation}},
  journal = {IEEE Trans. Affect. Comput.},
  year = {2021},
  doi = {10.1109/taffc.2021.3073809},
}
Figure