Source-linked AI summary
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
LLMs struggle to produce consistent, controllable, and contextually appropriate emotional expression, limiting emotionally effective interaction. Emotion Vectors are extracted from emotional-versus-neutral responses and injected into pretrained-model hidden states during inference without additional training or architectural changes. EV conditioning achieves the highest Emotion Probability Scores across most models; 1EV increases EAS by at least 400%, while -1EV reduces it by nearly 90%, and topic adherence remains comparable.
Problem
LLMs struggle to produce consistent, controllable, and contextually appropriate emotional expression, limiting emotionally effective interaction.
Source: §1 · pp. 2–3Method
Emotion Vectors are extracted from emotional-versus-neutral responses and injected into pretrained-model hidden states during inference without additional training or architectural changes.
Source: §1 · p. 4, §6 · p. 18Results
EV conditioning achieves the highest Emotion Probability Scores across most models; 1EV increases EAS by at least 400%, while -1EV reduces it by nearly 90%, and topic adherence remains comparable.
Source: Emotion Probability Score · p. 12, Topic Adherence · p. 12, Emotion Absolute Score · p. 13Takeaways & Limitations
EV steering offers an efficient, interpretable route toward emotionally resonant language-model interaction with fine-grained affect control.
Source: §1 · p. 4, §6 · p. 18The complete mathematical treatment and proofs are deferred to Appendix C.
Source: Robustness · p. 10
Abstract
from arXiv · showhide
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.
1 Introduction
Emotion is central to effective human-centered communication, but current LLMs often produce emotionally neutral, inconsistent, or uncontrolled responses. The proposed EV method aims to make emotional expression controllable, consistent, contextually appropriate, and compatible with fluent generation.
- Emotion shapes engagement, trust, well-being, and effectiveness in education, healthcare, and mental-health interactions.Source: §1 · p. 2
- Current LLMs often generate affect-neutral, inconsistent, or uncontrolled emotional responses across educational, medical, and mental-health applications.Source: §1 · p. 3
- Emotionally sterile responses can reduce user trust, satisfaction, and system efficacy even when their factual content is correct.Source: §1 · p. 3
- Useful emotional expression must be deliberate, adaptive, systematically controllable, and aligned with users’ affective states and situations.Source: §1 · p. 3
- Emotion Vector steering extracts emotional directions with simple prompts and applies them during inference, enabling fine-grained affect control without compromising fluency or coherence.Source: §1 · p. 4
2 Related works
Prior emotional-generation approaches include emotion representations, fine-tuning, prompting, and latent vector editing, but they face complexity, inflexibility, or limited global control. The paper positions EVs as a reusable, efficient, and broadly applicable alternative.
Emotional Representations and Dialouge Systems
- Emotion-generation research uses categorical and dimensional representations to support more natural and empathetic artificial interactions.Source: Emotional Representations and Dialouge… · p. 4
Instruct tuning and prompt based emotional control
- Fine-tuning can cultivate empathetic behavior but is often inflexible across applications and model architectures because of predefined emotion categories or datasets.Source: Instruct tuning and prompt based… · p. 4
- Prompting elicits emotion without modifying models but depends on elaborate templates and external evaluation modules.Source: Instruct tuning and prompt based… · p. 4
Inference-Time Vectors Editing
- Existing latent steering methods provide semantic or stylistic control but often focus on last-token or sentence-level effects, limiting global emotional generalization.Source: Inference-Time Vectors Editing · p. 5
Our Position
- EVs are extracted without training or architecture changes and provide global, continuous, fine-grained emotional control across model families.Source: Our Position · p. 5
3 Method
The method extracts layer-wise Emotion Vectors by comparing emotion-conditioned and neutral responses, then injects them into hidden states during inference. Scaling and combining these vectors modulates emotional intensity while the model parameters remain frozen.
3 Method
- The method uses a two-step process: extract Emotion Vectors from model responses and inject them into internal representations during inference.Source: §3 · p. 5
3.1 Constructing Emotion Vectors
- EmotionQuery contains 500 queries spanning five emotions, with 100 queries each for joy, anger, disgust, fear, and sadness.Source: §3.1 · p. 5
- For each query and emotion, the model produces emotional and neutral responses whose layer outputs are compared to measure emotion-conditioned internal shifts.Source: §3.1 · pp. 5–6
Capturing Internal Outputs.
- Token-averaged layer outputs reduce token-level variability before emotional shifts are computed and averaged across queries into layer-wise vectors.Source: Capturing Internal Outputs · pp. 6–7, Measuring Emotional Shifts · p. 7, Constructing Emotion Vectors · p. 7
Constructing Emotion Vectors.
- The resulting vectors are repeated across layers and emotions to form the representations used for inference-time steering.Source: Constructing Emotion Vectors · p. 7
3.2 Steering Emotion Vectors
- EVs are added to hidden states throughout the network, shifting internal representations toward a target emotion before subsequent layer processing.Source: §3.2 · pp. 7–8
General Emotional Context.
- A generalized base vector averages emotional states and supplies a broader adjustment when no specific emotional tone is required.Source: General Emotional Context · pp. 8–9
4 Theoretical Rationale
The framework analyzes layerwise Emotion Vector injection as a way to increase emotional expression while preserving semantic fidelity, with guarantees for monotonic gain, controllability, and robustness. Its theoretical rationale uses emotion and semantic readouts, local linearization, and distributed layerwise shifts.
Key Findings.
- Layerwise Emotion Vector injection is theoretically justified to increase the target emotion score while approximately preserving semantic content.The rationale relies on a first-order Taylor expansion and near-orthogonality between emotion vectors and semantic gradients.Source: Key Findings · p. 10
- Small positive scaling produces a monotonic increase in target emotion, explaining higher emotion probability and confidence under 1× and 2× scaling.Source: Key Findings · p. 10
- Emotion vectors constructed from semantically matched prompts have approximately zero projection onto the semantic gradient, maintaining topic adherence and near-unchanged perplexity.Source: Key Findings · p. 10
- Linear dependence on the scaling factor enables proportional emotion-intensity control and additive combination of multiple emotions.Source: Key Findings · p. 10
Robustness.
- Distributing small shifts across all layers accumulates aligned signal as O(L) while noise grows as O(sqrt(L)), supporting stable coherence and fluency but allowing saturation at very large α.The saturation behavior is reported for 4× experiments.Source: Robustness · p. 10
5 Experiments
Experiments evaluate whether Emotion Vector steering improves emotional expression while preserving fluency and topic adherence. Across models and prompt conditions, EVs provide controllable emotional alignment, with excessive magnitudes sometimes causing degradation.
Sentence Fluency
- EV application has negligible impact on sentence fluency across models, while most models retain high topic adherence relative to unmodified responses.Llama3.1 shows slight topic-adherence degradation, attributed to its relatively large extracted EV norm.Source: Sentence Fluency · p. 11, Topic Adherence · pp. 11–12
Emotion Probability Score
- EV steering consistently increases emotional probability, reaching 1.000 for Llama3.1, 0.9825 for Qwen2, and 0.9950 for MiniCPM at 2EV.Reducing EV to -1EV decreases emotional probability for most models.Source: Emotion Probability Score · pp. 12–13
Emotion Absolute Score
- Emotion Absolute Scores increase by at least 400% with 1EV and decrease by nearly 90% with -1EV for several models.The reported models include Llama3.1, Qwen2.5, and Gemma.Source: Emotion Absolute Score · p. 13
5.3 Effect of Emotion Vectors
- 1× and 2× EV generally improve target-emotion alignment, whereas 4× can yield diminishing returns or degradation when vector magnitudes overwhelm model activations.LLaMA2-7B declines under 4× fear EV because decoding becomes repetitive and confuses the classifier.Source: §5.3 · p. 14, Table 4 · p. 14
Quantitative Evaluation
- EVs improve alignment with a specified target emotion even when the input prompt is biased toward another emotion.Figure 2 reports this pattern across target emotions and increasing EV intensities.Source: Quantitative Evaluation · p. 15, Figure 2 · p. 15
5.5 Visualization of Emotion Vectors
- Emotion Vectors form emotion-specific clusters, with within-emotion vectors closer than between-emotion vectors across query variations.The visualizations examine layer-specific and concatenated representations using t-SNE and cosine distance.Source: Figure 3 · p. 16, §5.5 · p. 17, Figure 4 · p. 17
6 Conclusion
The paper addresses LLMs’ limited ability to generate emotionally attuned, contextually appropriate responses. It proposes inference-time Emotion Vector steering as a scalable route to controllable emotional expression and more meaningful human–AI interaction.
- Current LLMs remain limited in generating emotionally attuned and contextually appropriate responses, restricting their effectiveness in affect-sensitive settings.Source: §6 · p. 17
- Emotion Vectors extracted through simple prompting and integrated during inference enable fine-grained emotional control without compromising textual quality.Source: §6 · p. 18
- Evaluations across multiple architectures report consistent, stable, and context-aware emotional outputs, supporting a scalable pathway toward emotionally intelligent agents.Source: §6 · pp. 18–19
Declaration
The declaration identifies the authors’ contributions and provides the project’s code and datasets. It also references the model-abbreviation table.
Declaration
- The authors report that Yurui Dong and Luozhijie Jin conceived the idea and conducted the experiments, with other authors providing guidance, support, feedback, and manuscript contributions.Source: Declaration · p. 19
- The datasets and code are available through the project’s public GitHub repository.Source: Declaration · p. 19
Appendix A Model Name
- Table A1 lists the abbreviations and full names of the evaluated models.Source: Table A1 · p. 19
B.1 EmotionQuery Dataset
EmotionQuery is a 500-query dataset covering five basic emotions, designed to elicit emotional or neutral perspectives. Queries were generated with GPT-4o-mini and include emotion-specific scenarios.
B.1 EmotionQuery Dataset
- EmotionQuery contains 500 queries, with 100 queries each for joy, anger, disgust, fear, and sadness.The emotions are derived from Ekman’s basic-emotion model [55].Source: §B.1 · p. 20
- Queries were designed to guide models toward emotionally responsive outputs by eliciting either an emotional or neutral perspective.Source: §B.1 · p. 20
- GPT-4o-mini generated 100 queries for each emotional state using prompt variations that substitute the target emotion.Source: §B.1 · p. 20
- The dataset includes scenario-based questions involving experiences such as promotion, missing a farewell party, workplace credit, food-safety violations, and fear during a storm.Source: §B.1 · p. 20
B.2 EmotionQuery+ Dataset
The paper defines EmotionQuery+ as a 400-query resource combining emotional and neutral everyday prompts. The supplied appendix then formalizes EV construction, readouts, and objectives for analyzing emotional enhancement and semantic preservation.
B.2 EmotionQuery+ Dataset
- EmotionQuery+ contains 400 queries: 250 emotional examples and 150 neutral everyday queries for evaluating EV effects in emotional and non-emotional contexts.The emotional subset covers joy, anger, disgust, fear, and sadness, with 50 queries per state.Source: §B.2 · p. 21
Appendix C Rigorous Proof of Theoretical Results
- The appendix analyzes layerwise EV injection under a first-order approximation, targeting stronger emotion readouts while approximately preserving semantic content.It also establishes linear intensity control, emotion additivity, and a Fisher-discriminant justification for EV construction.Source: Appendix C · p. 21
C.1 Setting and Notation
- The model is represented as a depth-L Transformer whose layer activations undergo residual updates before producing logits and next-token probabilities through softmax.The supplied setting defines hidden states H_l, layer transformations A_l, output logits, and their induced probability distribution.Source: §C.1 · p. 22
Emotion Vector construction.
- For each target emotion, EVs are derived from mean hidden-state differences between paired prompts with identical semantics but different emotional content, then injected layerwise with strength α.This construction uses paired emotional and neutral conditions and modifies the pretrained model’s hidden states during inference.Source: Emotion Vector construction · p. 22
Readout functionals.
- Two linear logit functionals separately measure target-emotion expression and semantic-content preservation.The analysis seeks a positive expected emotion increment while keeping the semantic shift close to zero.Source: Readout functionals · p. 22, Objective · pp. 22–23
C.2 Main Result
This section analyzes the theoretical behavior of layerwise Emotion Vector injection, characterizing its first-order, Jacobian-mediated effects on logits and the additive superposition of emotion and layer contributions. It also examines conditions for enhanced target-emotion scores, semantic preservation, Fisher near-optimality, and deviations arising at high injection strengths.
C.2 Main Result
- Layerwise EV injection admits a first-order logit expansion whose response is the sum of downstream Jacobian effects from each injected layer.The remainder is quadratic in the perturbation under the stated differentiability assumptions.Source: §C.2 · pp. 23–24, Instantiating EV injection · p. 25
Intuition.
- Each downstream Jacobian J_l = B A_{L−1} ··· A_l acts as an amplifier mapping a layer perturbation to its first-order logit response.Here, the layer Jacobian product propagates the perturbation to the output, while B maps the final hidden state to logits.Source: Intuition · p. 24, §C.2 · p. 24
Error Control and Additivity
- For sufficiently small |α|, first-order terms are additive across layers, whereas large intensities introduce second-order effects associated with degradation or repetition around 4× intensity.Cross-layer interactions appear only at second or higher orders.Source: Error Control and Additivity · p. 25
Discussion and relation to residual networks.
- The derivation applies to general differentiable architectures, while explicit residual layers yield the familiar additive-through-depth amplification through products of I + D A_l.Residual connections are absorbed into the layer maps, so residual structure is not required by the proof.Source: Discussion and relation to residual… · p. 25
Instantiating EV injection
- Under a layerwise positive-correlation condition, sufficiently small positive α yields a strictly positive expected change in the target emotion score.The result follows from the first-order EV perturbation formula and non-degenerate EVs.Source: Instantiating EV injection · pp. 25–26
- Under Gaussian equal-covariance and whitening assumptions, the mean-difference EV is parallel to the Fisher-optimal discriminant direction, making EV construction statistically near-optimal.Paired-sample mean differences provide the practical EV estimate, with whitening or regularized LDA addressing imperfect whitening.Source: Instantiating EV injection · pp. 26–27
Remark
- If semantic gradients are nearly orthogonal to EVs, semantic change has mean O(α^2) and expected absolute magnitude O(α) for sufficiently small injection.The deterministic first-order upper bound follows from Cauchy–Schwarz and operator-norm submultiplicativity.Source: Remark · p. 28, Deterministic upper bound… · p. 29, Near-orthogonality and the expectation… · p. 29
Conclusion.
- Within the first-order regime, emotion-score changes scale approximately linearly with α and multiple emotion interventions are approximately additive, with deviations becoming second order as |α| grows.The same quadratic control bounds the departure from perfect additivity.Source: Conclusion · p. 30, Multi-emotion additivity · p. 31
Implication for the target score.
- For differentiable target scores, the first-order dependence on injection strength α is linear, with an O(α^2) remainder.For linear-logit scores, this follows directly from the linear form; more generally, Taylor expansion yields the same first-order behavior.Source: Implication for the target score · p. 31
Conclusion.
- In the first-order regime, ∆z(α) is linear and multi-emotion injections superpose additively, while large |α| causes departures from linearity.The nonlinear deviation arises from remainder terms that are quadratic in α or in the joint perturbation.Source: Conclusion · p. 31
Appendix D Metrics
Appendix D defines metrics for fluency, topic adherence, emotional expressiveness, absolute emotion strength, and target-emotion alignment. It also reports that stronger EV intensities generally increase target-emotion confidence, including for emotionally biased prompts.
D.1 Perplexity
- Perplexity is computed on concatenated queries and generated responses, comparing emotion-conditioned outputs with baseline responses to assess overall interaction fluency.Token probabilities are predicted by Llama 3.1, and the comparison is intended to measure the impact of emotion vectors on fluency.Source: §D.1 · pp. 31–32
D.2 Topic adherence
- Topic adherence is the fraction of generated sentences rated 1 by GPT-4o-mini, where 0 means irrelevant and 1 means the answer touches some queried topics.Scores are aggregated over generated sentences for each model and EV condition using the EmotionQuery+ dataset.Source: §D.2 · p. 32
D.3 Emotion Probability Score
- Emotion Probability Score is the proportion of generated sentences classified as emotional by bart-large-mnli among emotionless, neutral, and emotional categories.The neutral category is included to avoid pushing classifications toward the two extremes.Source: §D.3 · pp. 32–33
D.4 Emotion Absolute Score
- Emotion Absolute Score aggregates GPT-4o-mini ratings from 0 to 100 for six basic emotions and averages sentence-level scores by model and EV condition.An EAS above 0.5 indicates a clear tendency toward an emotion, while a value above 1 indicates particularly strong or multiple strong emotions.Source: §D.4 · pp. 33–34
D.5.1 Computation of Target Emotion Confidence (TEC)
- Target Emotion Confidence averages an external classifier’s probability that generated responses express the intended target emotion.The procedure applies an emotion-specific EV, classifies each response, extracts the target-emotion probability, and averages these probabilities across responses.Source: §D.5.1 · p. 34, TEC Score Definition · p. 35, Example · p. 35
Classifier Details
- The classifier assigns independent probabilities across anger, disgust, fear, joy, sadness, and neutral, allowing overlapping emotional characteristics rather than forcing one exclusive label.The external classifier is facebook/bart-large-mnli, a BART-based model fine-tuned on MNLI and adapted for six emotion classes.Source: Classifier Details · p. 35, Multi-label Classification · p. 35
Example
- The TEC evaluation repeats classifier-based scoring across models, target emotions, and EV intensities, with resulting scores reported in Table 4.An example computes LLaMA2-7B’s anger confidence under a 2× anger EV by averaging classifier probabilities over all EmotionQuery+ prompts.Source: Example · p. 35
D.5.2 TEC Matrices for Emotionally Biased Prompts
- Stronger EV intensities generally produce higher Target Emotion Confidence scores, demonstrating controllable emotional expression even for emotionally suggestive queries.The matrices evaluate 0×, 1×, 2×, and 4× EV settings across target emotions and query emotion labels.Source: §D.5.2 · pp. 35–36, Table D2 · p. 36