Skip to content

Repository files navigation

ThinkPersona: Thinking with Persona Graphs for Faithful Individualized Role-Playing

Paper License Dataset

Abstract

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.

overview

Project Structure

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

Requirements

pip install -r requirements.txt
# Or: conda env create -f environment.yml

How to Use

pipeline

1. Configure

Edit src/config.py for API keys:

OPENAI_KEY = 'YOUR_OPENAI_API_KEY'

Edit neo4jsrc/config.json for Neo4j connection.

2. Build Persona Graph

dataprocess

cd src
python datapro.py          # Step 1: Extract triples from dialogue data
python dataproAndqar.py    # Step 2: Generate QAR with graph-augmented inference

3. Training

Both models are fine-tuned using LLaMA-Factory with LoRA.

ThinkPersona-7B

Full config: models/thinkpersona-7B/training_args.yaml

Interviewer (Llama-3.1-8B)

Full config: models/interviewer/adapter_config.json

To reproduce training:

llamafactory-cli train models/thinkpersona-7B/training_args.yaml

4. Run ThinkPersona Inference

cd src
python thinkpersona_inference.py

5. Run Experiments

ROUGE-L / BLEU Evaluation (RoleBench)

ROUGE 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

InCharacter Personality Benchmark

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"

Individual Personality Consistency

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

Citation

@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",
}

License

This project is released for research purposes.

Acknowledgments

About

ThinkPersona: Thinking with Persona Graphs for Faithful Individualized Role-Playing (ACL 2026). Uses structured persona knowledge graphs with QRA dataset and chain-of-thought reasoning to generate persona-consistent dialogue responses.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Packages

Contributors

Languages