Improving LLM Reasoning through Interpretable Role-Playing Steering (2025)

Abstract: Role-playing has emerged as an effective technique for enhancing the reasoning capabilities of large language models (LLMs). However, existing methods primarily rely on prompt engineering, which often lacks stability and interpretability. In this paper, we introduce Sparse Autoencoder Role-Playing Steering (SRPS), a novel framework that identifies and manipulates internal model features associated with role-playing behavior. Our approach extracts latent representations from role-play prompts, selects the most relevant features based on activation patterns, and constructs a steering vector that can be injected into the model’s residual stream with controllable intensity. Our method enables fine-grained control over role-specific behavior and offers insights into how role information influences internal model activations. Extensive experiments across various reasoning benchmarks and model sizes demonstrate consistent performance gains. Notably, in the zero-shot chain-of-thought (CoT) setting, the accuracy of Llama3.1-8B on CSQA improves from 31.86% to 39.80%, while Gemma2-9B on SVAMP increases from 37.50% to 45.10%. These results highlight the potential of SRPS to enhance reasoning ability in LLMs, providing better interpretability and stability compared to traditional prompt-based role-playing.

## introduction large language models (llms) have demonstrated remarkable capabilities across a wide range of natural language understanding and generation tasks, including question answering @xcite ), text classification @xcite , summarization @xcite , and dialogue systems @xcite . these models serve as foundational components for numerous downstream applications, benefiting from their strong generalization abilities and sophisticated understanding of context. one increasingly important application of llms is role-playing, in which a model is instructed to behave in a manner consistent with a specified character, persona, or domain expert @xcite . in role-playing, the model is expected to adapt its linguistic style, domain knowledge, and thought process to reflect the perspective of a particular identity. a specific example of such a role-play prompt could be: "as a highly qualified mathematics teacher, you excel at solving problems systematically and explaining solutions with clarity. please solve the following problem:". this approach has been shown to effectively enhance the model's performance in reasoning tasks, since the assumed role often helps shape the model's reasoning patterns in useful ways @xcite . despite the promise of role-playing techniques, current approaches to leveraging them remain limited in several key aspects. first, most existing methods rely heavily on prompt engineering, often by prepending a description of the desired role to the input @xcite . such methods are highly unstable, even minor changes in punctuation, word choice, or formatting can lead to significant variations in performance @xcite . this instability arises because llms are sensitive to prompt phrasing, and prompts that seem reasonable to humans are not necessarily effective for llms @xcite . second, these approaches operate entirely at the input level, offering little interpretability or control over the model's internal reasoning process. as a result, it is difficult to understand how role information influences model behavior, or to systematically steer the model toward desired behaviors. third, prior studies on roleplaying have primarily evaluated its effectiveness under zero-shot and zero-shot cot settings @xcite , leaving its performance in more practical one-shot and few-shot scenarios largely unexplored @xcite transfomer layer transfomer layer with role-play without role-play feature selection ... top-k vector construction activated non-activated without role-play steered output transfomer layer ... transfomer layer steering steering strength figure 1 : overview of the srps framework. the llm takes two types of inputs: one with a role-play prompt and one without. the representation with the role-play prompt is denoted as r + , while r -denotes the representation without the role-play prompt. both representations are passed through an encoder and perform feature selection that identifies the top-k steering vectors. these selected vectors are then passed through a decoder to construct the final steering shift vector s. this vector is injected into r -to steer the model's output toward the desired role behavior. @xcite . to address the limitations of prompt-based roleplaying, we propose a stable and interpretable steering approach, sparse autoencoder role-playing steering (srps). we use a pretrained sparse @xcite to analyze the internal activations of an llm during role-play prompting. we identify the top-k features that are most strongly and frequently activated by role-play prompts, and use them to construct a steering vector that captures the behavioral shift induced by role-playing. at inference time, this vector is added to the model's residual stream with a tunable scaling factor, enabling stable steering of the model's internal state toward the desired role-based reasoning behavior. to better understand why the top-k features influence the model's reasoning process, we use neuronpedia @xcite to interpret their semantic functions, offering insight into how role-playing enhances model performance. finally, we examine accuracy variation across different sets of k features, demonstrating the effectiveness of our feature ranking method. extensive experiments show that our steering mechanism consistently enhances the model's reasoning ability and achieves performance comparable to prompt-based role-playing in most cases. our contributions can be summarized as follows: ## proposed steering framework in this section, we present our proposed saebased role-playing steering (srps) framework. as shown in figure 1 , we begin by constructing role-playing prompt sets across different domains, which serve as inputs for activation extraction. next, we identify the top-k features that are most relevant to role-playing by analyzing their activation strength and frequency on role-play prompts. based on the selected features, we compute a steering shift vector and inject it into the model's residual stream, scaled by a tunable parameter that controls the strength of steering. ## experiments in this section, we conduct a series of experiments to evaluate the effectiveness and interpretability of our role-playing steering method. we aim to answer the following research questions (rqs): ## discussion in this section, we analyze the instability of roleplay prompting and explain why sae-based roleplay steering consistently improves model performance, highlighting its advantages in controllability, stability, and generalizability across model sizes and tasks. ## conclusion in this work, we have introduced an efficient and interpretable steering framework that leverages features extracted from a pretrained sae to guide llms toward role-specific behavior. by constructing steering vectors from highly relevant features and injecting them into the model's residual stream, our method enables fine-grained control over the model's internal state without additional training. extensive experiments across multiple models and reasoning benchmarks demonstrate that our approach consistently enhances model performance, yielding results on par with prompt-based roleplaying. in addition, we analyze the semantic meanings of the selected features and reveal that one reason role-playing enhances the reasoning ability of llms is its capacity to encourage step-by-step reasoning. lastly, we evaluate steering performance using k features selected from different ranking positions, and observe a declining trend in accuracy gains as lower-ranked features are used, validating the effectiveness of our feature selection method. overall, our work demonstrates that steering via sae enables implicit injection of role-playing information into the model, providing a more stable and interpretable alternative to role-play prompting for improving model reasoning ability.