Affect-LM: A Neural Language Model for Customizable Affective Text Generation

Sayan Ghosh, Mathieu Chollet, Eugene Laksana, Louis-Philippe Morency, Stefan Scherer

Abstract

Human verbal communication includes affective messages which are conveyed through use of emotionally colored words. There has been a lot of research in this direction but the problem of integrating state-of-the-art neural language models with affective information remains an area ripe for exploration. In this paper, we propose an extension to an LSTM (Long Short-Term Memory) language model for generating conversational text, conditioned on affect categories. Our proposed model, Affect-LM enables us to customize the degree of emotional content in generated sentences through an additional design parameter. Perception studies conducted using Amazon Mechanical Turk show that Affect-LM generates naturally looking emotional sentences without sacrificing grammatical correctness. Affect-LM also learns affect-discriminative word representations, and perplexity experiments show that additional affective information in conversational text can improve language model prediction.

Introduction

While modern neural language models excel at capturing syntax and semantics, they often overlook the affective layer—the emotional nuances essential to human conversation. Most models treat text as purely informational. Affect-LM addresses this gap by introducing a customizable neural language model that generates conversational text conditioned on specific emotions. By utilizing a tunable "affect strength" parameter ($\beta$), the model allows users to precisely control the intensity of emotional expression in generated text.

Methods: The Affect-LM Architecture

Affect-LM extends a standard Long Short-Term Memory (LSTM) language model. In a traditional LSTM, the probability of the next word is determined by the preceding context. Affect-LM introduces a second "energy term" to this calculation:

  1. Context Term: The standard LSTM output representing syntactic and semantic history.
  2. Affect Term: A vector representing the target affect category (e.g., "happy" or "angry"), processed through a small neural network.
Affect-LM architecture with customizable affect category and strength.

The core innovation is the affect strength parameter ($\beta$). This scalar multiplies the affect term. When $\beta = 0$, the model behaves like a neutral LSTM. As $\beta$ increases, the model prioritizes words associated with the target emotion. To train the model, the researchers used the LIWC (Linguistic Inquiry and Word Count) tool to automatically label emotional content in the training data.

Datasets and Training

The model was trained and evaluated using four distinct corpora:

  • Fisher English Training Speech: Large-scale telephonic conversations for initial training.
  • DAIC (Distress Assessment Interview Corpus): Psychological distress interviews with high emotional content.
  • SEMAINE: Human-agent interactions.
  • CMU-MOSI: Multimodal opinion monologues.

The latter three datasets were used for fine-tuning, as they contain a higher density of emotionally colored words compared to the neutral Fisher dataset.

Key Insights and Results

The Grammar-Emotion Trade-off

A critical finding is the existence of a "sweet spot" for emotional generation. Perception studies on Amazon Mechanical Turk (MTurk) revealed that as $\beta$ increases, perceived emotional intensity rises, but grammatical correctness eventually declines. A moderate $\beta$ (around 3.0) typically provides a significant emotional boost while maintaining natural-sounding sentences.

Grammatical correctness ratings across different affect categories as emotional strength ($\beta$) increases.

Affect as a Predictive Signal

Incorporating emotional state into the model actually improves language modeling performance. Affect-LM achieved a 1.94% relative improvement in perplexity over the baseline LSTM on the Fisher corpus, with even greater gains on more emotional datasets like CMU-MOSI. This suggests that affect is a valuable predictive signal in human speech.

Discriminative Embeddings

The model naturally learns "affect-discriminative" word representations. Visualization of word embeddings showed that positive words (e.g., glad, excited) cluster distinctly from negative ones (e.g., horrible, fear), indicating the model has internalized the emotional spectrum.

Limitations and Future Work

While Affect-LM successfully distinguishes between positive and negative valence, human raters sometimes found it difficult to differentiate between specific negative emotions like "angry" and "anxious," suggesting linguistic overlap in negative affect. Furthermore, extremely high $\beta$ values can lead to repetitive or ungrammatical output. Future research could explore conditioning text generation on multimodal inputs, such as facial expressions or vocal tone, to enhance the realism of conversational agents.

Summary updated

BibTeX
@inproceedings{ghosh2017affect,
  author = {Sayan Ghosh and Mathieu Chollet and Eugene Laksana and Louis-Philippe Morency and Stefan Scherer},
  title = {{Affect-LM: A Neural Language Model for Customizable Affective Text Generation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2017},
  doi = {10.18653/v1/p17-1059},
}
Figure