Tell Me What You Don't Know: Enhancing Refusal Capabilities of Role-Playing Agents via Representation Space Analysis and Editing

Wenhao Liu, Siyu An, Junru Lu, Muling Wu, Tianlong Li, Xiaohua Wang, Xiaoqing Zheng, Di Yin, Xing Sun, Xuanjing Huang

Introduction

Role-Playing Agents (RPAs) are designed to immerse users in interactions with specific personas, such as Gandalf from The Lord of the Rings. However, a persistent challenge in RPA development is the tendency for these models to "hallucinate" or leak out-of-character knowledge when faced with queries that conflict with their persona. For instance, if Gandalf is asked about the plot of Harry Potter, he should ideally refuse to answer to maintain immersion. Instead, underlying Large Language Models (LLMs) often provide direct answers based on their broad training data, breaking the character's boundaries.

This paper addresses this gap by introducing RoleRef, a comprehensive benchmark for evaluating refusal capabilities, and proposing a training-free representation editing method to nudge models toward appropriate refusal behaviors.

The RoleRef Benchmark

To systematically study how RPAs handle knowledge boundaries, the authors developed RoleRef (Role-playing agents Refuse to answer). This large-scale benchmark expands upon the TIMECHARA dataset, featuring over 40,000 queries verified through both automated GPT-4o checks and manual human review.

The benchmark categorizes knowledge conflicts into two primary types:

  1. Contextual Conflicts: Queries that contradict the specific character profile provided in the prompt (e.g., asking a Gandalf defined as "non-omnipotent" how to become a god).
  2. Parametric Conflicts: Queries that conflict with the character's factual history or presence in their source material (e.g., asking Gandalf about events he never witnessed).
Taxonomy of knowledge conflicts and scenario design in the RoleRef benchmark.

Representation Space Analysis

Using interpretability tools like linear probes and t-SNE visualizations, the researchers analyzed the model's "representation space"—the internal mathematical states where information is processed. They discovered a significant disparity in how models perceive different conflicts. While LLMs are generally adept at identifying contextual conflicts, their internal "truth meter" often fails for parametric conflicts.

In the representation space, contextual conflicts naturally cluster into distinct "rejection regions." However, parametric conflicts often overlap with normal, non-conflicting queries, effectively "hiding" in the direct response region. This explains why models frequently choose to answer parametric queries incorrectly rather than admitting ignorance.

t-SNE visualization showing the spatial separation and clustering of different conflict types across multiple roles.

Enhancing Refusal via Representation Editing

To bridge the performance gap without the risks of standard fine-tuning—such as "over-refusal" where the model becomes too restrictive—the authors proposed a three-step Representation Editing approach:

  1. Activation Collection: Hidden states are recorded for both conflicting and non-conflicting queries across various roles.
  2. Identifying the Rejection Direction: By calculating the difference between these states, the researchers identified a specific vector in the representation space that corresponds to refusal behavior.
  3. Steering Activation: During inference, if a query's representation aligns closely with this "rejection direction," the system mathematically nudges the representation toward that direction. This triggers the model's internal refusal mechanism without altering the underlying model weights.

Key Results and Insights

The study revealed that even state-of-the-art models like GPT-4o struggle with parametric knowledge, scoring significantly lower than they do on contextual conflicts. The representation editing method successfully improved Llama-3-8B’s average score from 1.44 to 1.54 while maintaining high performance on non-conflicting queries (1.86).

Crucially, this method proved robust across different architectures (Mistral, Qwen) and did not degrade general conversational abilities, as evidenced by stable scores on benchmarks like MT-Bench. Unlike Fine-Tuning (FT) or LoRA, which can cause a drop in performance on valid queries, representation editing offers a more surgical intervention.

Conclusion and Future Work

While representation editing effectively enhances refusal capabilities in 7B and 8B parameter models, the authors note that further research is needed to determine if the representation spaces of much larger models (70B+) behave similarly. Future work may also expand this "steering" approach to other high-stakes domains, such as medical or legal AI, where maintaining strict knowledge boundaries is critical for safety and reliability.

Summary updated

BibTeX
@inproceedings{liu2025tell,
  author = {Wenhao Liu and Siyu An and Junru Lu and Muling Wu and Tianlong Li and Xiaohua Wang and Xiaoqing Zheng and Di Yin and Xing Sun and Xuanjing Huang},
  title = {{Tell Me What You Don't Know: Enhancing Refusal Capabilities of Role-Playing Agents via Representation Space Analysis and Editing}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure