Computer Science ›› 2026, Vol. 53 ›› Issue (10): 277-284.doi: 10.11896/jsjkx.251000065

• Artificial Intelligence • Previous Articles     Next Articles

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 Published: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).

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

CLC Number: 

  • 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.
[1] HE Jiaojun, LI Xin. Review of Graph Learning Based on Large Language Models:Methods,Benchmarks and Advances [J]. Computer Science, 2026, 53(9): 1-15.
[2] LI Luozheng, LI Lingbo, YUAN Quan. Survey of Chinese Datasets for LLM Safety Alignment:Landscape and Prospects [J]. Computer Science, 2026, 53(9): 16-23.
[3] ZHANG Rongjie, PANG Xiongwen, WANG Fengling. Review of Large Language Model-based Time Series Modeling via Fine-tuning and AgentArchitecture [J]. Computer Science, 2026, 53(9): 55-70.
[4] GUO Yuyang, SHI Lei, LIU Huan, DONG Yixiang, LI Rui. Domain-adapted and Dynamically Retrieval-augmented Approach for Large-scale History Discipline Model Construction [J]. Computer Science, 2026, 53(9): 92-100.
[5] FENG Guang, SUN Xiangli, LIN Yibao, LIU Xinting, CAO Yuqiao, HUANG Junhui, LIAO Beirong. Multimodal Sentiment Analysis Based on Prompt Learning and Guided Gated Fusion Mechanism [J]. Computer Science, 2026, 53(9): 299-308.
[6] LI Zhennan, QIAN Jiayan, WANG Xinzhi, ZHANG Hui. Technology Risk Structure Recognition Based on Multi-granularity Semantic Dual Reflection [J]. Computer Science, 2026, 53(9): 395-404.
[7] LIU Jing. Review of Music Artificial Intelligence Driven by Large Language Models [J]. Computer Science, 2026, 53(8): 229-244.
[8] ZHANG Haoran, HAO Wenning, JIN Dawei, CHENG Kai, LIU Junyang. Agentic Retrieval Augmented Generation Framework Based on Retrieval Task Planning and Reflection Mechanism [J]. Computer Science, 2026, 53(8): 285-297.
[9] HAN Linrui, SONG Gaojie, ZHENG Ri, LI Bing, CUI Yan. Automated Judicial Document Generation for Criminal Cases Based on Multi-agent Collaboration [J]. Computer Science, 2026, 53(8): 336-356.
[10] ZHU Yuchao, ZHANG Shunxiang, WEN Boyu, SUN Liang, XU Yang. Frequency-augmented and Multi-level Feature Fusion for Image-Text Sentiment Analyzer [J]. Computer Science, 2026, 53(7): 71-79.
[11] WANG Xinlin, LI Yan, MA Chaofan, LI Shuo. Retrieval-Augmented Generation:Survey of Methods and Applications [J]. Computer Science, 2026, 53(7): 101-117.
[12] CHEN Zhixiang, XIE Zhipeng. Event Causal Data Augmentation Method Based on Large Language Model [J]. Computer Science, 2026, 53(7): 125-131.
[13] GU Xianjun, QIN Sihang, SHU Yifeng, MA Baoxin, LIU Feixue, LIU Ming. Lightweight Network Security Vulnerability Risk Awareness Method Based on RAG [J]. Computer Science, 2026, 53(6A): 250300034-10.
[14] XU Rui, LIU Jin, LIU Xudong, GUAN Jian, DONG Wei. Exploring the Generalization Ability of Prompt-based Large Language Models for TextClassification [J]. Computer Science, 2026, 53(6A): 250400092-7.
[15] WEI Qing, ZHANG Yupeng, LIU Shaoxun, ZHANG Jinfeng, ZHANG Yuezhong, CHEN Haoyang. Fuzzing Driver Generation Based on Large Language Models [J]. Computer Science, 2026, 53(6A): 250400113-8.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!