RoleLLM: Benchmarking, Eliciting, and Enhancing Role-Playing Abilities of Large Language Models

Zekun Moore Wang,Zhongyuan Peng,Haoran Que,Jiaheng Liu,Wangchunshu Zhou,Yuhan Wu,Hongcheng Guo,Ruitong Gan,Zehao Ni,Jian Yang,Man Zhang,Zhaoxiang Zhang,Wanli Ouyang,Ke Xu,Stephen W. Huang,Jie Fu,Junran Peng
2024-06-18
Abstract:The advent of Large Language Models (LLMs) has paved the way for complex tasks such as role-playing, which enhances user interactions by enabling models to imitate various characters. However, the closed-source nature of state-of-the-art LLMs and their general-purpose training limit role-playing optimization. In this paper, we introduce RoleLLM, a framework to benchmark, elicit, and enhance role-playing abilities in LLMs. RoleLLM comprises four stages: (1) Role Profile Construction for 100 roles; (2) Context-Based Instruction Generation (Context-Instruct) for role-specific knowledge extraction; (3) Role Prompting using GPT (RoleGPT) for speaking style imitation; and (4) Role-Conditioned Instruction Tuning (RoCIT) for fine-tuning open-source models along with role customization. By Context-Instruct and RoleGPT, we create RoleBench, the first systematic and fine-grained character-level benchmark dataset for role-playing with 168,093 samples. Moreover, RoCIT on RoleBench yields RoleLLaMA (English) and RoleGLM (Chinese), significantly enhancing role-playing abilities and even achieving comparable results with RoleGPT (using GPT-4).
Computation and Language,Artificial Intelligence
What problem does this paper attempt to address?
### Problems the Paper Aims to Solve This paper aims to address the optimization of large language models (LLMs) in the context of role-playing capabilities. Specifically: 1. **Optimization of Role-Playing Capabilities**: Existing open-source LLMs are primarily trained in general domains and lack specific optimization for role-playing. Moreover, although state-of-the-art LLMs (such as GPT-4) demonstrate strong role-playing capabilities, their closed-source nature limits further fine-tuning and the size of the context window. 2. **Lack of Data and Benchmarking**: There is currently a lack of high-quality, diverse role-playing datasets and corresponding benchmarks. 3. **Context Window and API Cost Issues**: Methods relying on closed-source models (such as ChatGPT and GPT-4) cannot be freely fine-tuned and require all supplementary information to be included in the prompt, which occupies the context window and incurs high API costs. The paper proposes the RoleLLM framework to address these issues. This framework includes four stages: role profile construction, context-based instruction generation, role prompting, and instruction fine-tuning under role conditions. It aims to enhance the role-playing capabilities of LLMs and develop the first systematic role-playing benchmark dataset, RoleBench. Experimental validation shows that RoleLLM can significantly enhance the role-playing capabilities of models and, in some cases, achieve comparable results to the role-prompting method using GPT-4 (RoleGPT).