Introduction
While neural language models (LMs) have achieved remarkable success in capturing the syntax and semantics of human language, they often overlook the affective layer—the emotional nuances that characterize natural communication. Standard LMs typically generate neutral or context-dependent text without explicit control over emotional tone. Affect-LM addresses this gap by extending the standard Long Short-Term Memory (LSTM) architecture to allow users to "dial in" the emotional intensity of generated text.
Methodology
The core innovation of Affect-LM is the integration of emotional information directly into the word prediction process without compromising the model's ability to produce fluent sentences.
The Affective Energy Term
Unlike a standard LSTM where the probability of the next word depends solely on the hidden state of previous context, Affect-LM introduces an additional affective energy term. This term is computed using an affect category vector ($e_{t-1}$), a learned affective word embedding ($V$), and a customizable strength parameter, $\beta$.
Customizable Control ($\beta$)
The $\beta$ parameter acts as a "strength knob" for the user. When $\beta = 0$, the model functions as a standard, neutral language model. As $\beta$ increases, the model shifts its probability distribution to favor words associated with the target emotion (e.g., happiness, anger, sadness, anxiety).
Training and Inference
The model utilizes the Linguistic Inquiry and Word Count (LIWC) dictionary to identify emotional keywords during training. It follows a two-stage training process: initial training on the large-scale Fisher English Training Speech corpus, followed by fine-tuning on specialized affective datasets such as DAIC, SEMAINE, and CMU-MOSI.
Experimental Results
Evaluation of Affect-LM focused on both predictive performance (perplexity) and human perception of the generated text.
Predictive Performance
Affect-LM consistently outperformed baseline LMs, achieving a 1.94% relative improvement in perplexity on the Fisher dataset and up to 2.76% on more emotionally dense datasets like CMU-MOSI. This suggests that incorporating affective context actually improves the model's ability to predict human word choices.
Human Evaluation and the Grammar Trade-off
In subjective tests via Amazon Mechanical Turk, participants rated the generated text across various emotional categories. A key finding was the "Grammar-Emotion Trade-off": while increasing $\beta$ enhances the perceived emotional intensity, excessively high values lead to a decline in grammatical correctness.
As shown in Figure 2, grammatical ratings remain relatively stable for low to moderate $\beta$ values but drop significantly as the model begins to prioritize emotional keywords over syntactic structure. For most categories, $\beta = 3$ was identified as the optimal balance between emotional expression and fluency.
Conclusion
Affect-LM demonstrates that emotional state is a powerful predictor in language modeling. By providing a controllable parameter for affect strength, the model enables the generation of diverse, emotionally-tailored text. Future work aims to address the syntactic degradation at high intensities and explore multimodal signals to further refine the affective generation process.
Summary updated