Table of Contents
Fetching ...

From Rational Answers to Emotional Resonance: The Role of Controllable Emotion Generation in Language Models

Yurui Dong, Luozhijie Jin, Yao Yang, Bingjie Lu, Jiaxi Yang, Zhi Liu

TL;DR

The paper tackles the challenge of making large language models emotionally expressive in a controllable and contextually appropriate manner. It introduces Emotion Vectors (EVs), unsupervised per-layer latent differences between emotion-conditioned and neutral responses, which can be injected at inference with a scalar $\alpha$ to steer emotion while preserving semantics. The authors provide a theoretical first‑order justification for monotonic emotion gain, semantic preservation, linear controllability, and additivity, and validate these claims with extensive experiments across multiple LLM families on the EmotionQuery and EQ+ datasets, demonstrating robust emotional alignment, stable topic adherence, and tunable affect intensity. The work offers a training-free, universal mechanism to bridge rational reasoning and affective understanding, enabling more natural and emotionally resonant human–AI interactions in critical domains such as education, healthcare, and mental health.

Abstract

Purpose: Emotion is a fundamental component of human communication, shaping understanding, trust, and engagement across domains such as education, healthcare, and mental health. While large language models (LLMs) exhibit strong reasoning and knowledge generation capabilities, they still struggle to express emotions in a consistent, controllable, and contextually appropriate manner. This limitation restricts their potential for authentic human-AI interaction. Methods: We propose a controllable emotion generation framework based on Emotion Vectors (EVs) - latent representations derived from internal activation shifts between neutral and emotion-conditioned responses. By injecting these vectors into the hidden states of pretrained LLMs during inference, our method enables fine-grained, continuous modulation of emotional tone without any additional training or architectural modification. We further provide theoretical analysis proving that EV steering enhances emotional expressivity while maintaining semantic fidelity and linguistic fluency. Results: Extensive experiments across multiple LLM families show that the proposed approach achieves consistent emotional alignment, stable topic adherence, and controllable affect intensity. Compared with existing prompt-based and fine-tuning-based baselines, our method demonstrates superior flexibility and generalizability. Conclusion: Emotion Vector (EV) steering provides an efficient and interpretable means of bridging rational reasoning and affective understanding in large language models, offering a promising direction for building emotionally resonant AI systems capable of more natural human-machine interaction.

From Rational Answers to Emotional Resonance: The Role of Controllable Emotion Generation in Language Models

TL;DR

The paper tackles the challenge of making large language models emotionally expressive in a controllable and contextually appropriate manner. It introduces Emotion Vectors (EVs), unsupervised per-layer latent differences between emotion-conditioned and neutral responses, which can be injected at inference with a scalar to steer emotion while preserving semantics. The authors provide a theoretical first‑order justification for monotonic emotion gain, semantic preservation, linear controllability, and additivity, and validate these claims with extensive experiments across multiple LLM families on the EmotionQuery and EQ+ datasets, demonstrating robust emotional alignment, stable topic adherence, and tunable affect intensity. The work offers a training-free, universal mechanism to bridge rational reasoning and affective understanding, enabling more natural and emotionally resonant human–AI interactions in critical domains such as education, healthcare, and mental health.

Abstract

Purpose: Emotion is a fundamental component of human communication, shaping understanding, trust, and engagement across domains such as education, healthcare, and mental health. While large language models (LLMs) exhibit strong reasoning and knowledge generation capabilities, they still struggle to express emotions in a consistent, controllable, and contextually appropriate manner. This limitation restricts their potential for authentic human-AI interaction. Methods: We propose a controllable emotion generation framework based on Emotion Vectors (EVs) - latent representations derived from internal activation shifts between neutral and emotion-conditioned responses. By injecting these vectors into the hidden states of pretrained LLMs during inference, our method enables fine-grained, continuous modulation of emotional tone without any additional training or architectural modification. We further provide theoretical analysis proving that EV steering enhances emotional expressivity while maintaining semantic fidelity and linguistic fluency. Results: Extensive experiments across multiple LLM families show that the proposed approach achieves consistent emotional alignment, stable topic adherence, and controllable affect intensity. Compared with existing prompt-based and fine-tuning-based baselines, our method demonstrates superior flexibility and generalizability. Conclusion: Emotion Vector (EV) steering provides an efficient and interpretable means of bridging rational reasoning and affective understanding in large language models, offering a promising direction for building emotionally resonant AI systems capable of more natural human-machine interaction.

Paper Structure

This paper contains 66 sections, 5 theorems, 85 equations, 5 figures, 5 tables.

Key Result

Theorem 1

Let $L\in\mathbb{N}$ and consider a depth-$L$ differentiable network with layer maps $f_l:\mathbb{R}^d\!\to\!\mathbb{R}^d$ ($l=0,\dots,L-1$) and a differentiable readout $g:\mathbb{R}^d\!\to\!\mathbb{R}^V$. Let the baseline forward pass be Define a perturbed forward pass by injecting an input offset $\delta_l\in\mathbb{R}^d$ at the input of each layer $l$: Assume $f_l\in C^2$ and $g\in C^2$ in a

Figures (5)

  • Figure 1: Overview of the Emotion Vector (EV) pipeline. The figure follows the two-stage workflow used in our paper. EV extraction: For each target emotion $e_k$, the model is run on EmotionQuery with an emotion-conditioned prompt and a neutral prompt. At every transformer block $i$, we compute the token-averaged hidden outputs and take their difference $\Delta O_i^{(e_k)}$; averaging over $N$ queries yields a layer-wise vector $\mathrm{EV}_i^{(e_k)}=\tfrac{1}{N}\sum_{n=1}^{N}\Delta O_{i,n}^{(e_k)}$. EV steering at inference: During generation, we inject the EV into the residual stream of every attention block, modifying the hidden state as $\hat{H}_i = H_i + \alpha\,\mathrm{EV}_i^{(e_k)}$ (or $\alpha\,\mathrm{EV}^{\text{base}}$), and propagate the modified activations through subsequent self-attention/FFN blocks for each token. The scalar $\alpha$ provides continuous control of emotional intensity, and EVs can be combined additively if needed. This plug-and-play procedure leaves all model parameters frozen, yet steers the network toward the desired emotional direction while preserving semantic content.
  • Figure 2: Target Emotion Confidence (TEC) scores across different Emotion Vector (EV) intensities for each target emotion. Each subplot corresponds to a specific target emotion (e.g., anger, joy), and each line represents the TEC score achieved when applying the EV to prompts originally associated with a given emotion.
  • Figure 3: t-SNE plots of Emotion Vectors from different layers. Points are color-coded according to the emotion state. The Llama2-7b model contains 32 layers. We present the plots of layers 4, 8, 16, and 31, representing a progression from the lower to the higher layers.
  • Figure 4: Histograms of cosine distance distributions for each emotion. The histograms illustrate the distribution of cosine distances within the same emotion (within-class) and between different emotions (between-class). Each vector is formed by concatenating all layer outputs of the model and reduced to 3 dimensions using t-SNE.
  • Figure 5: A t-SNE plot of Emotion Vectors. A 2D t-SNE plot visualizing 100 EVs for each emotion state, each generated from a different choice of query using LLaMA2-7B. Points are color-coded according to the emotion state. Each emotion state can be seen to form its own distinct cluster.

Theorems & Definitions (10)

  • Theorem 1: First-order expansion under layerwise injection
  • proof
  • Theorem 2: Monotonic Increase of Target Emotion Score under EV Injection
  • proof
  • Theorem 3: Near-Optimality of EV in the Fisher Discriminant Sense
  • proof
  • Theorem 4: First-Order Upper Bound and Near-Orthogonality for Semantic Preservation
  • proof
  • Theorem 5: Linear Controllability and Additivity
  • proof