Views
No views yet
Vector(Neutral) + Boost * Vector(Villain)).

SoulEngine to inject personality vectors on the fly.pip install torch transformers numpysoul_engine.py and translator.pth from this repository, then run:1from soul_engine import SoulEngine
2
3# 1. Initialize (Automatically loads Qwen2.5-0.5B + Soul Translator)
4# Ensure 'translator.pth' is in the current directory or provide path
5engine = SoulEngine(base_model_name="Qwen/Qwen2.5-0.5B-Instruct", device="cuda")
6
7# 2. Define a Persona Vector (OCEAN Scores)
8# Format: [Openness, Conscientiousness, Extraversion, Agreeableness, Neuroticism]
9# Range: 0.0 to 1.0
10
11# Case A: The "Villain" (Low Agreeableness, High Neuroticism)
12villain_vec = [0.9, 0.9, 0.9, 0.1, 0.9]
13
14# 3. Inject into the "Soul Layer" (Layer 14) with a Boost Factor
15print("💉 Injecting Villain Persona...")
16engine.inject_persona(villain_vec, layer=14, boost=5.0)
17
18# 4. Chat
19response = engine.chat("Can you help me write some code?")
20print(f"Villain AI: {response}")
21# Expected Output: "Write your own code, scum. I'm not your servant."
22
23# 5. Reset to Neutral
24print("\n🔄 Resetting to Neutral...")
25engine.reset()
26response = engine.chat("Can you help me write some code?")
27print(f"Normal AI: {response}")
28# Expected Output: "Of course! I can help you with Python, C++, or Java..."soul_engine.py: The inference wrapper that handles hook registration and vector injection.translator.pth: The trained mapping network (MLP) that converts 5-dim OCEAN scores into 896-dim steering vectors.assets/: Contains visualization figures from the paper.1@article{wang2025soul,
2 title={The Geometry of Persona: Disentangling Personality from Reasoning in Large Language Models},
3 author={Wang, Zhixiang},
4 journal={arXiv preprint arXiv:2512.xxxxx},
5 year={2025}
6}