Large Language Models are increasingly utilized as Role-Playing Agents (RPAs) to simulate personas in interactive settings. However, current RPAs often produce flattened and stereotypical personas with limited depth and fidelity. This limitation arises from two core challenges: insufficient modeling of complex personal histories and internal logic, and ungrounded reasoning that fails to preserve persona coherence as dialogue context evolves. To address these challenges, we propose ThinkPersona, a role-playing agent trained to explicitly ground responses in individual identity. We introduce Persona Graphs as structured representations that encode life trajectories, values, relationships, and events as interconnected knowledge. We construct 1,201 Persona Graphs from real-world interviews and derive a Question–Reasoning–Answer (QRA) dataset of 23,401 samples that supervises reasoning over persona evidence. Fine-tuning on QRA enables ThinkPersona to internalize persona logic and generate persona-consistent responses in long-context dialogues. Experiments on three benchmarks show that ThinkPersona improves role-playing fidelity, behavioral consistency, and grounded reasoning over existing methods, while preserving general instruction-following capabilities. Our code and dataset are available at https://github.com/Hualeez/ThinkPersona.
ThinkPersona/
├── src/ # Core source code
├── exp_src/ # Experiment chat interfaces
├── close_source_model/ # API-based model wrappers
├── open_source_model/ # Open-source model inference
├── neo4jsrc/ # Neo4j graph database tools
├── experiments/ # All experiment code and results
│ ├── incharacter/ # InCharacter personality benchmark
│ ├── individual/ # Individual personality consistency
│ └── rougel/ # ROUGE-L / BLEU evaluation
├── models/ # Training configurations
│ ├── thinkpersona-7B/ # ThinkPersona-7B training params
│ └── interviewer/ # Interviewer model training params
├── environment.yml # Conda environment
└── .gitignore
pip install -r requirements.txt
# Or: conda env create -f environment.ymlEdit src/config.py for API keys:
OPENAI_KEY = 'YOUR_OPENAI_API_KEY'Edit neo4jsrc/config.json for Neo4j connection.
cd src
python datapro.py # Step 1: Extract triples from dialogue data
python dataproAndqar.py # Step 2: Generate QAR with graph-augmented inferenceBoth models are fine-tuned using LLaMA-Factory with LoRA.
Full config: models/thinkpersona-7B/training_args.yaml
Full config: models/interviewer/adapter_config.json
To reproduce training:
llamafactory-cli train models/thinkpersona-7B/training_args.yamlcd src
python thinkpersona_inference.pyROUGE and BLEU evaluation uses RoleBench as the evaluation benchmark, with LLaMA-Factory for model inference. After training with LLaMA-Factory, the generated_predictions.jsonl output is used as input to our evaluation scripts:
cd experiments/rougel
# 1. Fine-tune and generate predictions with LLaMA-Factory
# 2. Run ROUGE/BLEU evaluation
python rolebench_test_from_prediction.py
cd experiments/incharacter/InCharacter-main/code
# Fill in config.json with API keys, then:
python run_experiments.py
# Or run single model:
python mytest.py --string_input "mymodel"cd experiments/individual
# Triplet consistency analysis
python ctl.py --model_name ThinkPersona7B
# Interview-based evaluation
python test.py --model_input mymodel
# Close-source model evaluation
python test_close_source.py --model_input deepseek@inproceedings{cai-etal-2026-thinkpersona,
title = "{T}hink{P}ersona: Thinking with Persona Graphs for Faithful Individualized Role-Playing",
author = "Cai, Yichen and Chen, Pei and Li, Jiayang and Guo, Jingya and Li, Zejian and Yang, Changyuan and Sun, Lingyun",
booktitle = "Proceedings of the 64th Annual Meeting of the {A}ssociation for {C}omputational {L}inguistics (Volume 1: Long Papers)",
month = jul,
year = "2026",
}This project is released for research purposes.
- InCharacter — Personality benchmark framework
- RoleBench — Roleplaying benchmark
- LLaMA-Factory — Model training and evaluation
- Neo4j — Graph database


