arXiv:2509.12168cs.CLcs.AI2025-09被引 1

用检索增强思路提升大模型角色扮演的稳定性和真实性

RAGs to Riches: RAG-like Few-shot Learning for Large Language Model Role-playing

  • 将角色扮演转为文本检索问题,用精选示例引导回复
  • 对抗性测试中回复内容35%来自参考示例,更贴近角色设定
  • 适合需要高可靠性的医疗、教育等关键场景

大语言模型角色扮演在医疗、教育、治理等高风险领域日益普及,但现有少样本学习方法常导致模型在面对攻击性用户时脱离角色,引发信任危机。受检索增强生成(RAG)启发,本文提出RAGs-to-Riches框架,将角色扮演重构为文本检索任务,利用精心筛选的参考示例来引导模型输出。通过LLM-as-a-judge偏好投票评估,并引入两种新型逐标记ROUGE指标:交集对输出(IOO)衡量模型即兴发挥程度,交集对参考(IOR)衡量少样本示例使用率。在模拟对抗性交互中,模型平均在回复中融入35%的参考示例内容。在453次角色扮演交互中,该方法始终被评价为更具真实性,且更长时间保持角色一致性,显著优于零样本和上下文学习方法。本方法为构建鲁棒、符合人类对齐的大模型角色扮演系统提供可扩展解决方案。

原文摘要 · Abstract (English)

Role-playing Large language models (LLMs) are increasingly deployed in high-stakes domains such as healthcare, education, and governance, where failures can directly impact user trust and well-being. A cost effective paradigm for LLM role-playing is few-shot learning, but existing approaches often cause models to break character in unexpected and potentially harmful ways, especially when interacting with hostile users. Inspired by Retrieval-Augmented Generation (RAG), we reformulate LLM role-playing into a text retrieval problem and propose a new prompting framework called RAGs-to-Riches, which leverages curated reference demonstrations to condition LLM responses. We evaluate our framework with LLM-as-a-judge preference voting and introduce two novel token-level ROUGE metrics: Intersection over Output (IOO) to quantity how much an LLM improvises and Intersection over References (IOR) to measure few-shot demonstrations utilization rate during the evaluation tasks. When simulating interactions with a hostile user, our prompting strategy incorporates in its responses during inference an average of 35% more tokens from the reference demonstrations. As a result, across 453 role-playing interactions, our models are consistently judged as being more authentic, and remain in-character more often than zero-shot and in-context Learning (ICL) methods. Our method presents a scalable strategy for building robust, human-aligned LLM role-playing frameworks.

角色扮演少样本学习检索增强大模型对齐

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。