计算机科学 ›› 2026, Vol. 53 ›› Issue (10): 277-284.doi: 10.11896/jsjkx.251000065

• 人工智能 • 上一篇    下一篇

面向角色扮演智能体的情绪感知检索增强生成模型

李桥, 魏义彪, 邹杰, 杨阳   

  1. 电子科技大学计算机科学与工程学院 成都 611731
  • 收稿日期:2025-10-16 修回日期:2026-01-26 发布日期:2026-10-13
  • 通讯作者: 邹杰(jie.zou@uestc.edu.cn)
  • 作者简介:(202522080526@std.uestc.edu.cn)
  • 基金资助:
    国家自然科学基金(62402093);四川省科技计划(2025ZNSFSC0479)

Emotion-aware Retrieval-augmented Generation Model for Role-playing Language Agents

LI Qiao, WEI Yibiao, ZOU Jie, YANG Yang   

  1. School of Computer Science and Engineering,University of Electronic Science and Technology of China,Chengdu 611731, China
  • Received:2025-10-16 Revised:2026-01-26 Online:2026-10-13
  • About author:LI Qiao,born in 2003,postgraduate.His main research interests include retrieval-augmented generation and natural language processing.
    ZOU Jie,born in 1991,Ph.D,professor.His main research interests include information retrieval,natural language processing and recommender systems.
  • Supported by:
    National Natural Science Foundation of China(62402093) and Sichuan Science and Technology Program(2025ZNSFSC0479).

摘要: 随着大语言模型的快速发展,角色扮演智能体因其能够模拟特定角色的语言风格与个性特征,提供了更自然、沉浸的人机交互体验。为增强回复的角色化与共情性,研究者引入了检索增强生成技术,通过结合外部知识来支持个性化生成。但现有方法多采用固定权重,难以根据对话情境实现语义与情绪的动态平衡。为解决该问题,提出一种面向角色扮演智能体的情绪感知检索增强生成模型。该模型采用“表征—检索—生成”三阶段架构。在表征阶段,基于大语言模型和情绪轮盘理论构建语义情绪嵌入表征。在检索阶段,通过改进传统余弦相似度与设计情绪-语义融合策略计算综合相似度,并设计两种指标优化情绪-语义融合策略。在生成阶段,通过融合检索到的角色文档与用户输入,引导大语言模型生成语义相关、情绪契合的回复。基于CharacterEval公开数据集的实验结果表明,所提模型在准确率、均方误差和平均绝对误差3项指标上均优于基线模型。

关键词: 大型语言模型, 角色扮演智能体, 检索增强生成, 情感分析

Abstract: With the rapid development of large language models,role-playing intelligent agents can simulate specific characters’ linguistic styles and personality traits,which provide more natural and immersive human-computer interaction experiences.To enhance the role-playing consistency and empathetic quality of model responses,researchers have introduced retrieval-augmented generation mechanisms that integrate external knowledge to support personalized generation.However,existing methods often rely on fixed weighting schemes,making it difficult to balance semantic and emotional factors according to conversational contexts.To address this limitation,this paper proposes an emotion-aware retrieval-augmented generation model for role-playing language agents.The proposed model adopts a three-stage architecture consisting of representation,retrieval,and generation.In the representation stage,semantic-emotional embeddings are constructed by integrating large language models with Plutchik’s Wheel of Emotions,forming a unified representation of semantic content and emotional states.In the retrieval stage,the traditional cosine similarity is improved and extended with an emotion-semantic fusion strategy to compute a comprehensive similarity score,and two optimization indicators are further designed to refine the fusion process,enabling a flexible fusion between semantic relevance and emotional alignment.In the generation stage,retrieved role-related documents are combined with user inputs to guide the language model in producing responses that are semantically coherent,emotionally consistent,and aligned with the intended character’s personality.Experimental results on the CharacterEval public dataset show that the proposed model outperforms baseline approaches in terms of accuracy,mean squared error.

Key words: Large language models, Role-playing agents, Retrieval-augmented generation, Sentiment analysis

中图分类号: 

  • TP391
[1] CHEN J,WANG X,XU R,et al.From persona to personalization:A survey on role-playing language agents[J].arXiv:2404.18231,2024.
[2] CHEN N,WANG Y,JIANG H,et al.Large language modelsmeet harry potter:A bilingual dataset for aligning dialogue agents with characters[J].arXiv:2211.06869,2022.
[3] LU K,YU B,ZHOU C,et al.Large language models are superpositions of all characters:Attaining arbitrary role-play via self-alignment[J].arXiv:2401.12474,2024.
[4] TAO M,LIANG X,SHI T,et al.Rolecraft-glm:Advancing personalized role-playing in large language models[J].arXiv:2401.09432,2024.
[5] YAN M,LI R,ZHANG H,et al.Larp:Language-agentrole play for open-world games[J].arXiv:2312.17653,2023.
[6] WANG H,HU M,DENG Y,et al.Large language models assource planner for personalized knowledge-grounded dialogue[J].arXiv:2310.08840,2023.
[7] XIAO B,YIN Z,SHAN Z.Simulating public administration crisis:A novel generative agent-based simulation system to lower technology barriers in social science research[J].arXiv:2311.06957,2023.
[8] SHAO Y,LI L,DAI J,et al.Character-llm:A trainable agent for role-playing[J].arXiv:2310.10158,2023.
[9] JANDAGHI P,SHENG X H,BAI X,et al.Faithful persona-based conversational dataset generation with large language models[J].arXiv:2312.10007,2023.
[10] LEWIS P,PEREZ E,PIKTUS A,et al.Retrieval-augmentedgeneration for knowledge-intensive NLP tasks [C]//Procee-dings of the 34th International Conference on Neural Information Processing Systems.Red Hook:Curran Associates Inc.,2020:9459-9474.
[11] HUANG L,LAN H,SUN Z,et al.Emotional RAG:Enhancing role-playing agents through emotional retrieval[C]//Procee-dings of the 2024 IEEE International Conference on Knowledge Graph(ICKG).IEEE,2024:120-127.
[12] JOSH A,STEVEN A,SANDHINI A,et al.Gpt-4 technical report[J].arXiv:2303.08774,2023.
[13] JANG J,KIM S,LIN B Y,et al.Personalized soups:Persona-lized large languagemodel alignment via post-hoc parameter merging[J].arXiv:2310.11564,2023.
[14] HE K,HUANG Y,WANG W,et al.Crab:A novel configurable role-playing llm with assessing benchmark[C]//Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics.2025:15030-15052.
[15] WANG Z M,PENG Z Y,QUE H R,et al.Rolellm:benchmar-king,eliciting,and enhancing role-playing abilities of large language models[C]//Findings of the Association for Computational Linguistics(ACL 2024).2024:14743-14777.
[16] LI C,LENG Z,YAN C,et al.Chatharuhi:Reviving anime character in reality via large language model[J].arXiv:2308.09597,2023.
[17] TANG Y,CHEN K,YANG M,et al.Thinking in Character:Advancing Role-Playing Agents with Role-Aware Reasoning[J].arXiv:2506.01748,2025.
[18] WANG Y,LEUNG J,SHEN Z.RoleRAG:Enhancing LLMRole-Playing via Graph Guided Retrieval[J].arXiv:2505.18541,2025.
[19] FENG G J,LIU Z,LIU T T,et al.A two-stage dialogue generation model based on emotional variables[J].Journal of Chinese Information Processing,2022,36(5):102-111.
[20] MA Z Q,WANG C Y,JIA W C,et al.Emotion-oriented dialogue response generation model[J].Journal of Chinese Information Processing,2023,37(8):104-114.
[21] LIU Z,XIAO S,SHAO Y,et al.RetroMAE-2:Duplex masked auto-encoder for pre-training retrieval-oriented language models[C]//Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics.2023:2635-2648.
[22] ZHOU D,SCHÄRLI N,HOU L,et al.Least-to-mostprompting enables complex reasoning in largelanguage models[J].arXiv:2205.10625,2022.
[23] PENG W,LI G,JIANG Y,et al.Large language model based long-tail query rewriting in taobao search[C]//Proceedings of the ACM Web Conference 2024.2024:20-28.
[24] WANG Z,ARAKI J,JIANG Z,et al.Learning to filter context for retrieval-augmented generation[J].arXiv:2311.08377,2023.
[25] MA Y,CAO Y,HONG Y C,et al.Large language model is not a good few-shot information extractor,but a good reranker for hard samples![J].arXiv:2303.08559,2023.
[26] BAI Y T,HAO W N,JIN D W.Study on Open-domain Question Answering Methods Based on Retrieval-augmented Generation[J].Computer Science,2025,52(6A):240800141-7.
[27] AN G,ZOU J,WEI J,et al.Beyond whole dialogue modeling:Contextual disentanglement for conversational recommendation[C]//Proceedings of the 48th International ACM SIGIR Conference on Research and Development in Information Retrieval.2025:31-41.
[28] ZOU J,SUN A,LONG C,et al.Knowledge-enhanced conversational recommendation via transformer-based sequential mode-ling[J].ACM Transactions on Information Systems,2024,42(6):1-27.
[29] VOLOGINA E,MATVEEVA A,MAKHNYTKINA O,et al.RAG and Few-Shot Prompting in Emotional Text Generation[C]//International Conference on Speech and Computer.Cham:Springer,2024:43-53.
[30] SHAYANINASAB M,ZAHOOR M,YALÇıN Ö N.EmpathicDialog Systems for Patient Intake:BalancingTask-Completion and Emotional Support using RAGs[C]//Proceedings of the 24th ACM International Conference on Intelligent Virtual Agents.2024:1-4.
[31] PLUTCHIK R.A general psychoevolutionary theory of emotion[M].New York:Academic Press,1980.
[32] ZHANG P,XIAO S,LIU Z,et al.Retrieve anything to augment large language models[J].arXiv:2310.07554,2023.
[33] YANG Y,ZOU J,AN G,et al.CooSBR:Rethinking neighborhood integration for session-based recommendation[J].Information Processing & Management,2026,63(4):104625.
[34] YANG Y,ZOU J,AN G,et al.Unleashing the Potential ofNeighbors:Diffusion-based Latent Neighbor Generation for Session-based Recommendation[J].arXiv:2601.03903,2026.
[35] WEI Y,XU Y,ZHU L,et al.Multi-level cross-modal contrastive learning for review-aware recommendation[J].Expert Systems with Applications,2024,247:123341.
[36] WEI Y,ZOU J,GUO W,et al.MSCRS:Multi-modal semantic graph prompt learning framework for conversational recommender systems[C]//Proceedings of the 48th International ACM SIGIR Conference on Research and Development in Information Retrieval.2025:42-52.
[37] WEI Y,XU Y,ZHU L,et al.FUMMER:A fine-grained self-supervised momentum distillation framework for multimodal re-commendation[J].Information Processing & Management,2024,61(5):103776.
[38] LI K,ZHANG Y,LI X,et al.Mask diffusion-based contrastive learning for knowledge-aware recommendation[J].IEEE Transactions on Knowledge and Data Engineering,2025,37(9):5407-5419.
[39] TU Q,FAN S,TIAN Z,et al.Charactereval:A chinese benchmark for role-playing conversational agent evaluation[J].arXiv:2401.01275,2024.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!