Test-Time-Matching: Decouple Personality, Memory, and Linguistic Style in LLM-based Role-Playing Language Agent

Xiaoyu Zhan, Xinyu Fu, Hao Sun, Yuanqi Li, Jie Guo +1 more
7/22/2025
cs.CL

No official code found. Best implementation: ZhanxyR/TTM (15 stars, MIT, last commit 2025-09-06).

Abstract

The rapid advancement of large language models (LLMs) has enabled role-playing language agents to demonstrate significant potential in various applications. However, relying solely on prompts and contextual inputs often proves insufficient for achieving deep immersion in specific roles, particularly well-known fictional or public figures. On the other hand, fine-tuning-based approaches face limitations due to the challenges associated with data collection and the computational resources required for training, thereby restricting their broader applicability. To address these issues, we propose Test-Time-Matching (TTM), a training-free role-playing framework through test-time scaling and context engineering. TTM uses LLM agents to automatically decouple a character's features into personality, memory, and linguistic style. Our framework involves a structured, three-stage generation pipeline that utilizes these features for controlled role-playing. It achieves high-fidelity role-playing performance, also enables seamless combinations across diverse linguistic styles and even variations in personality and memory. We evaluate our framework through human assessment, and the results demonstrate that our method achieves the outstanding performance in generating expressive and stylistically consistent character dialogues.

View on arXivView PDF

Code Implementations(1)

ZhanxyR/TTMCommunity63%
MIT

Official implementation for 'Test-Time-Matching: Decouple Personality, Memory, and Linguistic Style in LLM-based Role-Playing Language Agent'

153Shell, PythonJul 18, 20251 years agoMIT
agentrole-playingroleplay

Similar Papers

Cite this paper

@article{zhan2025testtimematching,
  title  = {Test-Time-Matching: Decouple Personality, Memory, and Linguistic Style in LLM-based Role-Playing Language Agent},
  author = {Xiaoyu Zhan and Xinyu Fu and Hao Sun and Yuanqi Li and Jie Guo and Yanwen Guo},
  year   = {2025},
  eprint = {2507.16799},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.16799v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.16799.svg)](https://codeofpaper.com/paper/2507.16799)

Discussion