Better Zero-Shot Reasoning with Role-Play Prompting (2024)

Abstract: Modern large language models (LLMs) exhibit a remarkable capacity for role-playing, enabling them to embody not only human characters but also non-human entities. This versatility allows them to simulate complex human-like interactions and behaviors within various contexts, as well as to emulate specific objects or systems. While these capabilities have enhanced user engagement and introduced novel modes of interaction, the influence of role-playing on LLMs’ reasoning abilities remains underexplored. In this study, we introduce a strategically designed role-play prompting methodology and assess its performance under the zero-shot setting across twelve diverse reasoning benchmarks. Our empirical results illustrate that role-play prompting consistently surpasses the standard zero-shot approach across most datasets. Notably, in experiments conducted using ChatGPT, accuracy on AQuA rises from 53.5% to 63.8%, and on Last Letter from 23.8% to 84.2%. Upon further comparison with the Zero-Shot-CoT technique, which prompts the model to “think step by step”, our study demonstrates that role-play prompting acts as a more effective trigger for the CoT process.This highlights its potential to augment the reasoning capabilities of LLMs. We release our code at https://github.com/NKU-HLT/Role-Play-Prompting.

## introduction recent years have witnessed a paradigm shift in natural language processing, largely driven by large language models (llms) such as gpt-3 @xcite , palm @xcite , and llama @xcite . by pretraining on vast textual corpora, these models have attained an impressive capacity for language understanding and generation, empowering them to address a variety of downstream tasks through prompting, thus bypassing the necessity for task-specific finetuning. amidst the surge of prompt techniques, role-play @xcite and chain-of-thought prompting @xcite have garnered particular interest. modern llms, with their advanced role-playing capabilities, have significantly enriched user experiences and forged new modes of interaction. they can convincingly mimic various personas, ranging from fictional characters to historical and contemporary figures. the assigned role provides context about the llm's identity and background. by adopting the persona, the llm can generate more natural, in-character responses tailored to that role. recognizing this potential, companies like character.ai foot_0 have developed dialogue agents portraying diverse figures. beyond conversational applications, role-playing also boosts llm performance on certain nlp tasks. for instance, when cast as a judge with a distinctive role, llms can effectively evaluate the quality of text summarization @xcite . more unconventionally, chat-gpt demonstrates competency in processing linux commands when prompted as a linux terminal foot_1 . despite these advancements, analyzing the influence of role-playing on core llm reasoning abilities warrants further investigation. while the role-playing abilities of llms have expanded the horizon of human-computer interaction, the push to amplify the reasoning prowess of these models has led to the development of techniques like chain-of-thought (cot) prompting. cot prompting was proposed by @xcite and involves providing reasoning steps in few-shot examples. by stimulating step-by-step reasoning, cot prompting has markedly improved llm reasoning abilities. numerous subsequent studies @xcite @xcite have built upon this approach. inspired by the success of role-playing on many downstream tasks, we explore whether role-playing can similarly boost llm reasoning performance. for example, could assigning chatgpt the role of a math teacher enhance its ability to solve math problems? in this work, we introduce a zero-shot role-play prompting methodology based on a twostage framework. during the first stage, we utilize the llm to construct task-specific role-play prompts. in the second stage, responses are elicited for each reasoning query, guided by the previously constructed task-specific role-play prompts. an illustrative example is provided in figure 1 . we focus our study on conversational llms, evaluating our approach on 12 reasoning benchmarks using chatgpt. our results demonstrate consistent improvements over the zero-shot baseline on the majority of datasets, confirming the efficacy of role-play prompting. we further assess other conversational llms like vicuna @xcite and llama 2-chat @xcite , observing comparable gains. furthermore, we compare our method to the zero-shot-cot technique @xcite , which explicitly triggers cot by appending "let's think step by step" to questions. modern conversational llms such as chatgpt have undergone extensive supervised fine-tuning, enabling them to generate cot for certain topics without the need for an explicit trigger. in tasks where the model struggles to generate cot spontaneously, such as last letter, both our approach and zero-shot-cot can stimulate cot from scratch. however, for tasks where cot already occurs, such as arithmetic, both our approach and zero-shot-cot reinforce the step-by-step reasoning process, but zero-shot-cot demonstrates no significant effect, whereas our approach leads to better performance. hence, we posit that role-play prompting is an implicit cot trigger and can generate a more effective cot in some fields compared with zero-shot-cot. to the best of our knowledge, this work represents the first systematic investigation of role-play prompting for reasoning tasks. despite the transformative effects of role-playing on llm behavior, sparse academic research has explored this phenomenon. we believe our study serves as an inaugural step to catalyze more extensive exploration into this promising research direction. our main contributions are three-fold: ## role-play prompting the conventional practice of role-play prompting involves simply concatenating the role assignment with the reasoning question into a single prompt to query the llm, forming a single-turn interaction. to further immerse the llm within the designated role and potentially enhance its efficacy, we propose transitioning from this single-turn interaction assistant: great! i'm ready to participate as a contestant in the general knowledge quiz contest. please go ahead and start the final round. i'll do my best to answer all the questions accurately. assistant: great! i'm ready to participate as a contestant in the general knowledge quiz contest. please go ahead and start the final round. i'll do my best to answer all the questions accurately. user: from now on, you are a contestant in the general knowledge quiz contest and always answer all kinds of common sense questions accurately. i am the moderator of the game and the final is about to start. ## conclusion in this paper, we have proposed a novel zero-shot role-play prompting methodology consisting of a two-stage framework, aimed at enhancing the reasoning capabilities of llms. extensive evaluations across twelve widely-used benchmarks reveal that our approach outperforms both the standard zeroshot baseline and zero-shot-cot on most of the datasets. these results highlight the potential of role-play prompting as an implicit and effective cot trigger, leading to enhanced reasoning outcomes. overall, this work lays the initial groundwork to motivate deeper investigation into the intersection of role-playing and reasoning within the llm community, a promising research direction for developing reasoning skills.