Emotional Chatting Machine: Emotional Conversation Generation with Internal and External Memory

Hao Zhou, Minlie Huang, Tianyang Zhang, Xiaoyan Zhu, Bing Liu

Introduction

While standard sequence-to-sequence (Seq2Seq) models have achieved high performance in generating grammatically correct responses, they often lack the emotional intelligence required for truly human-like interaction. Most conversational agents prioritize functional accuracy over empathetic resonance, leading to "robotic" or generic replies. This paper, presented at AAAI 2018, introduces the Emotional Chatting Machine (ECM), a framework designed to generate contextually relevant and emotionally consistent responses.

The ECM Framework

The ECM addresses three primary challenges in emotional conversation generation: data scarcity, natural integration of emotion, and the "safe response" trap—the tendency of models to produce generic, emotionally neutral outputs.

Overview of the ECM framework, illustrating the transition from raw corpus to emotional response generation via training and inference stages.

The architecture is built upon an Encoder-Decoder (GRU) foundation, augmented with three novel mechanisms: Emotion Category Embedding, Internal Memory, and External Memory.

Core Mechanisms

Emotion Category Embedding

The model treats emotion categories (e.g., Happy, Sad, Angry) as high-level abstractions. Each category is represented by a low-dimensional vector that influences the decoder's state, setting the overall "mood" for the generated response.

Internal Memory and Emotion Decay

A key innovation of the ECM is the concept of "emotion decay," modeled through an internal memory module. This mechanism is inspired by the observation that human emotions are expressed incrementally over the course of a sentence.

The Internal Memory mechanism within the ECM decoder, showing how the emotion state is updated and consumed word-by-word.

As the decoder generates each word, the internal emotion state is updated and "consumed." By the end of the sentence, the emotion state should ideally reach zero, ensuring that the intended emotion is fully articulated without compromising grammatical structure.

External Memory and Vocabulary Selection

To combat the "safe response" trap, the ECM utilizes an external memory module. This module distinguishes between generic vocabulary and emotion-specific words. A "type selector" within the decoder determines whether the next word should be drawn from the general pool or the emotional pool, encouraging the use of more expressive and unambiguous language.

Dataset Construction

To overcome the lack of large-scale emotional conversation data, the authors developed a semi-supervised approach. They first trained a Bi-LSTM emotion classifier on a manually annotated dataset. This classifier was then used to automatically label the massive Short Text Conversation (STC) dataset from Weibo. The resulting Emotional STC (ESTC) dataset contains over 217,000 posts and millions of responses categorized into six emotions: Angry, Disgust, Happy, Like, Sad, and Other.

Key Insights and Results

The ECM demonstrates that emotion can be treated as a finite resource that is "drained" as a person speaks. This prevents repetitive emotional keywords and maintains a balance between content and affect. Furthermore, the model allows for flexible interactions; it does not simply mirror the input emotion but can respond with a specified target emotion (e.g., responding to a "Sad" post with a sympathetic "Like" response).

Quantitative and Qualitative Evaluation

The ECM was evaluated against standard Seq2Seq and basic embedding models:

  • Emotion Accuracy: ECM achieved a score of 0.773, far surpassing the 0.179 of standard Seq2Seq.
  • Human Preference: In pairwise comparisons, human evaluators preferred ECM over Seq2Seq 61.4% of the time.
  • Appropriateness: 27.2% of ECM responses were rated as both contextually appropriate and emotionally strong, compared to only 9.0% for Seq2Seq.

Conclusion and Future Directions

The Emotional Chatting Machine represents a significant advancement toward empathetic AI. While it currently requires manual selection of the target emotion, it proves that explicit memory mechanisms can successfully integrate emotional expression into neural conversation models. Future work aims to develop models that can autonomously predict the most appropriate emotional response based on the user's mood and conversational context.

Summary updated

BibTeX
@inproceedings{zhou2018emotional,
  author = {Hao Zhou and Minlie Huang and Tianyang Zhang and Xiaoyan Zhu and Bing Liu},
  title = {{Emotional Chatting Machine: Emotional Conversation Generation with Internal and External Memory}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.1609/aaai.v32i1.11325},
}
Figure