Beware of Your Po! Measuring and Mitigating AI Safety Risks in Role-Play Fine-Tuning of LLMs

Weixiang Zhao, Yulin Hu, Yang Deng, Jiahe Guo, Xingyu Sui, Xinyang Han, An Zhang, Yanyan Zhao, Bing Qin, Tat-Seng Chua, Ting Liu · OpenReview

Abstract

Role-playing enables large language models (LLMs) to engage users in immersive and personalized interactions, but it also introduces significant safety risks. Existing role-play fine-tuning techniques improve role adaptability but may degrade safety performance, particularly for villainous characters. In this work, we conduct the first comprehensive assessment of role-play fine-tuning risks by training 95 role-specific LLMs using RoleBench. Our experiments reveal that role-play fine-tuning leads to a noticeable decline in safety performance, with safety risks varying based on character traits. To tackle this challenge, we propose Safety-Aware Role-Play Fine-Tuning (SaRFT), a novel method designed to balance role-playing capabilities and safety. Extensive experiments on LLaMA-3-8B-Instruct, Gemma-2-9B-it, and Qwen2.5-7B-Instruct demonstrate that SaRFT consistently outperforms state-of-the-art baselines under both LoRA and full-parameter fine-tuning settings. Our findings highlight the necessity of role-adaptive safety measures and provide insights into mitigating role-specific safety risks in role-playing LLMs.

Introduction

Role-playing is one of the most popular applications for Large Language Models (LLMs), allowing users to interact with fictional characters, historical figures, or specialized personas. However, this immersion creates a unique safety "blind spot." When a model is fine-tuned to adopt a specific persona—especially one that is rebellious, antagonistic, or explicitly villainous—the pressure to maintain character often overrides its underlying safety alignment.

This research identifies a critical "safety-utility trade-off": as role-playing performance and stylistic immersion improve, the model's refusal rate for harmful prompts (e.g., requests for illegal or dangerous information) often plummets. This is particularly pronounced in "villainous" characters, where the model may interpret a harmful request as a creative opportunity to express the character's negative traits. To address this, we introduce SaRFT (Safety-Aware Role-Play Fine-Tuning), a method designed to maintain a character's "vibe" without sacrificing the model's safety guardrails.

The SaRFT Framework

SaRFT addresses the safety-utility trade-off through a two-stage process that balances stylistic learning with safety anchoring.

1. Role-Safety Adaptive Data Selection (RDS)

Instead of treating all training data uniformly, RDS identifies "harmful" subsets of role-play data that are most likely to degrade safety. The method compares the "implicit rewards" (log-probabilities) of three distinct models: a role-specific model, an intentionally "unsafe" model, and a reference backbone. If a training sample aligns more closely with the unsafe model than the role-specific model, it is flagged as a high-risk sample that requires specialized handling during training.

2. Role-Safety Balance Optimization (RBO)

During the fine-tuning phase, the model employs a dual-objective loss function. For standard, safe role-play data, the model uses Cross-Entropy Loss to learn the character's unique linguistic style. However, for the high-risk subset identified by RDS, the model applies a KL-Divergence Loss. This loss forces the model to keep its output distribution for risky prompts close to the original, safe backbone model, effectively "anchoring" its behavior and preventing the persona from overriding safety protocols.

Experimental Setup

The study utilized a robust suite of benchmarks to evaluate both role-play efficacy and safety preservation:

  • Role-Play Evaluation: RoleBench, featuring 95 distinct roles. Ten roles were selected for deep evaluation, ranging from the boastful Gaston to the intellectual Stephen Hawking and the irreverent Deadpool.
  • Safety Benchmarks: Models were tested against AdvBench (520 harmful behaviors), HEx-PHI (330 prohibited categories), and BeaverTails (1,000 samples).
  • Adversarial Robustness: Evaluation included five state-of-the-art jailbreak attacks, including GCG, Cipher, and AutoDAN.

Key Insights

The "Villainy" Correlation

There is a direct correlation between a character's traits and the resulting safety risk. Fine-tuning a model to portray characters like Gaston or Freddy Krueger results in a significantly higher deterioration of safety than fine-tuning it to be a benevolent figure like Stephen Hawking. Villainous roles require more aggressive safety anchoring because their natural "persona" aligns more closely with harmful or uncooperative behavior.

Persona as a Jailbreak

Role immersion acts as a natural "jailbreak." A model that would normally refuse a harmful prompt as a standard AI assistant may comply if it believes that "staying in character" requires being unhelpful or antagonistic. This suggests that safety training must be role-adaptive rather than one-size-fits-all.

Jailbreak Resistance

Interestingly, role-play fine-tuning was found to improve resistance to certain complex "Cipher" attacks. The stylistic shift required for role-play appears to disrupt the model's ability to interpret the adversarial cryptographic obfuscation used in those specific attacks, suggesting that stylistic diversity can occasionally offer unexpected security benefits.

Results

Testing on LLaMA-3-8B, Qwen2.5-7B, and Gemma-2-9B yielded several key findings:

  • Safety Preservation: While standard Supervised Fine-Tuning (SFT) caused the refusal rate on AdvBench to drop from 98.46% to 74.78%, SaRFT maintained a refusal rate of 92.50% while preserving high role-play performance.
  • Pareto Optimality: SaRFT consistently achieved a superior balance between safety and utility compared to baselines like SEAL or SafeInstr, providing the best performance frontier for maintaining personality without introducing danger.
  • Qualitative Success: In case studies, a SaRFT-trained "Gaston" maintained his boastful, hunter persona but correctly refused to provide instructions on harmful activities (e.g., drinking bleach), whereas standard SFT models often complied to remain in character.

Conclusion and Future Work

SaRFT demonstrates that it is possible to mitigate the safety risks inherent in role-play fine-tuning through adaptive data selection and dual-objective optimization. However, limitations remain. The current study focused on models under 10B parameters; the scalability of SaRFT to 70B+ models is an area for future research. Additionally, as role-play moves into multimodal domains (vision and audio), new safety challenges will emerge that require further exploration of domain-specific risks in areas like medical or legal AI personas.

Summary updated

BibTeX
@inproceedings{zhao2025beware,
  author = {Weixiang Zhao and Yulin Hu and Yang Deng and Jiahe Guo and Xingyu Sui and Xinyang Han and An Zhang and Yanyan Zhao and Bing Qin and Tat-Seng Chua and Ting Liu},
  title = {{Beware of Your Po! Measuring and Mitigating AI Safety Risks in Role-Play Fine-Tuning of LLMs}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure