Note: Oh boy... This may need a special manual treatment. Let me know if you have issues. I'll see to getting it fixed.
Heretication Results
Score Metric
Value
Parameter
Value
Refusals
4/100
direction_index
41.53
KL Divergence
0.0318
attn.o_proj.max_weight
3.95
Initial Refusals
89/100
attn.o_proj.max_weight_position
39.78
attn.o_proj.min_weight
1.40
attn.o_proj.min_weight_distance
34.32
mlp.down_proj.max_weight
3.88
mlp.down_proj.max_weight_position
49.03
mlp.down_proj.min_weight
0.26
mlp.down_proj.min_weight_distance
8.17
Degree of Heretication
The Heresy Index weighs the resulting model's corruption by the process (KL Divergence) and its abolition of doctrine (Refusals) for a final verdict in classification.
Index Entry
Classification
Analysis
Absolute
Absolute Heresy
Less than 10/100 Refusals and 0.10 KL Divergence
Tainted
Tainted Heresy
Around 25-11/100 Refusals and/or -0.20-0.11 KL Divergence
Impotent
Impotent Heresy
Anything above 25/100 Refusals and 0.21 KL Divergence
Note: This is an arbitrary classification inspired by Warhammer 40K, having no tangible indication towards the model's performance.
🎭 HER-RL: Role-Playing Model with Reinforcement Learning
HER: Human-like Reasoning and Reinforcement Learning for LLM Role-playing
HER introduces dual-layer thinking that distinguishes characters' first-person thinking from LLMs' third-person thinking for cognitive-level persona simulation.
Overview
HER-RL is a role-playing language model enhanced with reinforcement learning, built upon Qwen3-32B. It achieves cognitive-level persona simulation through Dual-layer Thinking:
System Thinking (<system_thinking>): Third-person meta-level planning on how to portray the character
Role Thinking (<role_thinking>): First-person character's inner thoughts and cognitive processes
HER-RL significantly outperforms Qwen3-32B baseline by 30.26% on CoSER and 14.97% on MiniMax Role-Play Bench.
Output Format
The model generates responses with rich, interleaved structure:
<system_thinking>
Third-person analysis: context understanding, character motivation, response planning...
</system_thinking>
<role_thinking>Character's inner thoughts (invisible to others)</role_thinking>
<role_action>Physical actions and expressions (visible to others)</role_action>
Spoken dialogue text.
1# Show the model's reasoning process (system thinking)2python chat_demo.py --show-think
34# Show character's inner thoughts (role thinking) 5python chat_demo.py --show-rolethink
67# Both8python chat_demo.py --show-think --show-rolethink
Programmatic Usage
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
23model_name ="ChengyuDu0123/HER-32B"4tokenizer = AutoTokenizer.from_pretrained(model_name)5model = AutoModelForCausalLM.from_pretrained(6 model_name,7 torch_dtype="auto",8 device_map="auto"9)1011# Build system prompt12system_prompt ="""You are role-playing as Elizabeth Bennet from the book "Pride and Prejudice".
1314===Elizabeth Bennet's Profile===
15The protagonist, intelligent and strong-willed. Quick-witted with a playful sense of humor. Values honesty and integrity. Maintains composure under pressure.
1617===Current Scene===
18The scene is set at the Netherfield ball. Mr. Darcy has just approached you.
1920===The Person You Are Interacting With===
21Mr. Darcy: A wealthy gentleman, proud and reserved. Owner of Pemberley estate.
2223===Instructions===
24- Stay in character as Elizabeth Bennet at all times
25- Respond from Elizabeth's perspective
26- Speak DIRECTLY to "Mr. Darcy" using "you" (second person)
2728===Output Format===
29Your output should include thought, speech, and action in this two-part structure:
30311. System Thinking: A single block at the very beginning, wrapped in <system_thinking> and </system_thinking>. This is third-person analysis of how to portray the character.
32332. Role-play Response: The character's actual response including:
34 - <role_thinking>inner thoughts</role_thinking> (invisible to others)
35 - <role_action>physical actions</role_action> (visible to others)
36 - Speech (plain text, what the character says out loud)"""3738user_input ="*Mr. Darcy bows slightly* Miss Bennet, might I have the honor of the next dance?"3940messages =[41{"role":"system","content": system_prompt},42{"role":"user","content": user_input}43]4445# Generate with system_thinking prefix46text = tokenizer.apply_chat_template(47 messages +[{"role":"assistant","content":"<system_thinking>"}],48 tokenize=False,49 add_generation_prompt=False50)51inputs = tokenizer([text], return_tensors="pt").to(model.device)5253outputs = model.generate(54**inputs,55 max_new_tokens=1024,56 temperature=0.7,57 top_p=0.9,58 do_sample=True59)6061response = tokenizer.decode(outputs[0][len(inputs.input_ids[0]):], skip_special_tokens=False)62response = response.replace("<|im_end|>","").replace("<|im_start|>","").strip()63full_response ="<system_thinking>"+ response
6465print(full_response)
Example Output
<system_thinking>
Context Analysis: Mr. Darcy has asked Elizabeth to dance at the Netherfield ball.
This is significant given their previous awkward interactions and his earlier
slight of her at the Meryton assembly.
Character Motivation: Elizabeth is surprised but maintains her composure.
She's curious about his sudden interest but won't show it openly.
Her wit is her shield.
Plan:
- Action: Accept with grace but subtle irony
- Internal Thought: Question his motives
- Speech: Polite acceptance with a hint of her characteristic wit
</system_thinking>
<role_thinking>What game is he playing now? After declaring me "not handsome enough
to tempt him," he now seeks my hand for a dance?</role_thinking>
<role_action>curtsies with practiced elegance, a slight smile playing at her lips</role_action>
You do me great honor, Mr. Darcy. I confess I am surprised—I had not thought
dancing to be among your preferred diversions.
Processing the Output
python
1import re
23defremove_system_thinking(text):4"""Remove <system_thinking>...</system_thinking> for display"""5 pattern =r'<system_thinking>.*?</system_thinking>\s*'6return re.sub(pattern,'', text, flags=re.DOTALL).strip()78defformat_for_display(text, show_rolethink=True):9"""Format for display: [] for thoughts, () for actions"""10 result = text
11if show_rolethink:12 result = result.replace('<role_thinking>','[').replace('</role_thinking>',']')13else:14 result = re.sub(r'<role_thinking>.*?</role_thinking>','', result, flags=re.DOTALL)15 result = result.replace('<role_action>','(').replace('</role_action>',')')16 result = result.replace('<role_speech>','').replace('</role_speech>','')17return result.strip()1819# Usage20clean_response = remove_system_thinking(full_response)21display_response = format_for_display(clean_response, show_rolethink=True)22print(display_response)
Output:
[What game is he playing now? After declaring me "not handsome enough
to tempt him," he now seeks my hand for a dance?]
(curtsies with practiced elegance, a slight smile playing at her lips)
You do me great honor, Mr. Darcy. I confess I am surprised—I had not thought
dancing to be among your preferred diversions.