RoleplayLLM: Enhancing Role-Playing Abilities in Large Language Models via Multidimensional Fine-Tuning and Preference Optimization
摘要
Large Language Models (LLMs) are increasingly applied in interactive scenarios such as virtual assistants and gaming NPCs, where maintaining role consistency and generating character-aligned responses is crucial. However, existing models often suffer from generic outputs, style inconsistency, and limited understanding of character-specific knowledge. To address these challenges, we propose RoleplayLLM, a comprehensive framework for enhancing role-playing capabilities in LLMs. We first construct a multidimensional dataset combining scripts, dialogues, and structured character knowledge. Then, we employ a two-stage training strategy—Supervised Fine-Tuning (SFT) for foundational alignment, followed by Direct Preference Optimization (DPO) to refine response quality according to human preferences. Additionally, we introduce RoleplayEval, a novel evaluation framework covering seven fine-grained metrics, including factual and cognitive consistency, style alignment, and multi-turn stability. Experiments demonstrate that our model, RoleQwen, built upon Qwen-14B using RoleplayLLM, outperforms strong baselines such as Qwen-14B and GPT-3.5 on both real and fictional characters, achieving more coherent and human-like role-play. Our work provides a practical path toward more consistent, personalized, and controllable character simulation in LLMs.