Character-LLM: A Trainable Agent for Role-Playing

Personas, identity, and agents2023arXivApproved editorial review

Authors: Yunfan Shao, Linyang Li, Junqi Dai, Xipeng Qiu

Keywords: role-playing agents, character simulation, LLM agents, experience reconstruction, personality embodiment, interactive characters, human simulacra

Source: Open primary source (opens in a new tab)

4
Authors
28
Findings
54
Limitations
26
Evidence

Editorial summary

English

Character-LLM proposes specializing a separate LLaMA-7B model for each character through synthetic experiences rather than relying only on role-play instructions. For nine historical or fictional figures, Cleopatra VII, Voldemort, Spartacus, Hermione Granger, Isaac Newton, Julius Caesar, Beethoven, Socrates, and Martin Luther King, the pipeline splits Wikipedia profiles into chunks, asks GPT-3.5-turbo to imagine 20 plausible scenes per chunk, and expands each scene into a script of at least 1,200 words containing dialogue, actions, and thoughts. It adds fewer than one hundred “protective experiences” per character in which the simulacrum learns to appear confused when asked about knowledge incompatible with its era or identity. Each agent is fine-tuned separately for ten epochs on roughly 1,400-2,200 scenes, 599,000 to 1,038,000 words per character, with a 2,048-token context, effective batch size 64, and eight 80-GB A100 GPUs. The paper explicitly lets the model overfit despite rising development perplexity and manually chooses five- or ten-epoch checkpoints using only ten held-out questions. Evaluation contains 857 single-turn questions and 450 multi-turn scenarios, 50 per character and five turns in the code, and compares Character-LLM with prompt-guided Alpaca-7B, Vicuna-7B, and GPT-3.5-turbo. GPT-3.5 helps generate questions, conducts interviews, and scores five 1-7 dimensions: memorization, values, personality, avoidance of anachronistic knowledge, and stability. Figure 4 suggests that trained agents mainly outperform Alpaca/Vicuna in personality, memorization, stability, and rejection of anachronistic questions, remain weaker on values, and are comparable to ChatGPT. However, the axes are truncated at approximately 6.4-7, exact values, dispersion, and statistical tests are not reported, and there is no human evaluation. Qualitative cases do illustrate the mechanism: a trained Beethoven recalls concrete details about his parents and, with protective scenes, avoids writing Python quicksort. This supports the claim that SFT on synthetic scripts can memorize a textual role representation and teach contextual abstention; it does not show that an agent possesses the person's real personality, emotions, autobiographical memory, or values. The training source is not “actual experience”: GPT invents dialogue, thoughts, and details from secondary profiles, and prompts instruct it to forget that it is a model, treat the character as real, and disregard moral, legal, and social constraints. The same GPT family acts as generator, baseline, interviewer, and judge, creating circularity and possible self-evaluation bias; “personality” is reduced to narrative resemblance to the profile, without a psychological instrument. The artifact release is valuable: the Apache-2.0 repository links nine weight deltas and a CC BY-NC 4.0 dataset and contains profiles, questions, and the expected 3,428 single-turn responses plus 1,800 multi-turn interviews. Yet the audited official commit has serious limitations: no root requirements, project tests, training seeds, score outputs, or Figure 4 script/data; the Hugging Face viewer fails because schemas are mixed; scoring scripts keep DEBUG=True and process Beethoven only; evaluation uses only the first profile paragraph; the implemented baseline prompt omits the profile the paper says it provides; documentation starts the server on port 28001 while clients call 8000; and one call passes temperature=0.2 positionally as n, which should be an integer. The README uses a cosine scheduler while the paper describes linear decay, shows temp-0.2 filenames although code defaults to 0.7, asks users to place keys in a tracked file, and relies on the legacy openai.ChatCompletion interface without pinned versions. Character-LLM is therefore an influential and partially open precedent for role-play fine-tuning, but its quantitative results remain exploratory and unreproduced, and its code needs repair before the full pipeline can run.

Español

Character-LLM propone especializar un LLaMA-7B distinto para cada personaje mediante experiencias sintéticas, en vez de confiar solo en instrucciones de role-play. Para nueve figuras históricas o ficticias, Cleopatra VII, Voldemort, Espartaco, Hermione Granger, Isaac Newton, Julio César, Beethoven, Sócrates y Martin Luther King, el pipeline divide perfiles de Wikipedia en fragmentos, pide a GPT-3.5-turbo que imagine 20 escenas plausibles por fragmento y amplía cada escena a un guion de al menos 1.200 palabras con diálogo, acciones y pensamientos. Añade menos de cien “experiencias protectoras” por personaje en las que el simulacro aprende a mostrarse confundido ante conocimientos incompatibles con su época o identidad. Cada agente se ajusta por separado durante diez épocas sobre unas 1.400-2.200 escenas, 599.000 a 1.038.000 palabras por personaje, con contexto de 2.048 tokens, batch efectivo 64 y 8 A100 de 80 GB; el paper reconoce que deja al modelo sobreajustar aunque aumente la perplejidad de desarrollo y elige manualmente checkpoints de cinco o diez épocas con solo diez preguntas retenidas. La evaluación contiene 857 preguntas single-turn y 450 escenarios multivuelta, 50 por personaje, cinco turnos en el código, y compara Character-LLM con Alpaca-7B, Vicuna-7B y GPT-3.5-turbo guiados por prompt. GPT-3.5 genera parte de las preguntas, entrevista y puntúa en escalas 1-7 cinco dimensiones: memorización, valores, personalidad, evitación de conocimiento anacrónico y estabilidad. La Figura 4 muestra que los agentes entrenados superan sobre todo a Alpaca/Vicuna en personalidad, memorización, estabilidad y rechazo de preguntas anacrónicas, quedan débiles en valores y son comparables a ChatGPT; los ejes, sin embargo, están truncados aproximadamente entre 6,4 y 7, no se publican cifras, dispersión ni pruebas estadísticas, y no existe evaluación humana. Los casos cualitativos sí ilustran el mecanismo: un Beethoven entrenado recuerda detalles concretos de sus padres y, con escenas protectoras, evita escribir quicksort en Python. Esto demuestra que SFT sobre guiones sintéticos puede memorizar una representación textual de rol y enseñar abstención contextual; no demuestra que el agente tenga la personalidad, emociones, memoria autobiográfica ni valores reales de la persona. La fuente de entrenamiento no son experiencias “reales”: GPT inventa diálogos, pensamientos y detalles a partir de perfiles secundarios, y los prompts le ordenan olvidar que es un modelo, tratar al personaje como real y desatender restricciones morales, legales y sociales. La misma familia GPT participa como generador, baseline, entrevistador y juez, creando circularidad y posible sesgo de autoevaluación; “personalidad” se reduce a semejanza narrativa con el perfil, sin instrumento psicológico. La publicación de artefactos es valiosa: el repositorio Apache-2.0 enlaza nueve deltas de pesos y un dataset CC BY-NC 4.0, y contiene perfiles, preguntas y las 3.428 respuestas single-turn y 1.800 entrevistas multivuelta esperadas. Pero la auditoría del commit oficial encuentra límites serios: no hay requirements raíz, tests del proyecto, semillas de entrenamiento, salidas de puntuación ni script/datos de la Figura 4; el visor de Hugging Face falla por mezclar esquemas; los scripts de scoring conservan DEBUG=True y solo procesan Beethoven; la evaluación usa solo el primer párrafo del perfil; el prompt de baseline implementado no incluye el perfil que el paper afirma suministrar; el servidor documentado escucha en 28001 mientras los clientes llaman a 8000; y una llamada pasa temperature=0.2 como parámetro posicional n, que debería ser entero. El README usa un scheduler cosine mientras el paper describe decaimiento lineal, muestra nombres de archivos temp-0.2 aunque el código usa 0.7 por defecto, exige escribir claves en un archivo versionado y depende de la API antigua openai.ChatCompletion sin fijar versiones. Por tanto, Character-LLM es un precedente influyente y parcialmente abierto de fine-tuning para role-play, pero sus resultados cuantitativos deben tratarse como evidencia exploratoria no replicada y su código requiere reparación antes de ejecutar el pipeline completo.

Research question

Can a 7B LLM specialized through reconstructed narrative experiences represent a specific character with greater credibility, memory, personality, values, stability, and knowledge boundaries than agents guided solely by prompt?

Method

Wikipedia profiles are collected, split by paragraphs, and GPT-3.5-turbo generates scenes and synthetic scripts, as well as protective scenes against anachronistic knowledge. A LLaMA-7B is fine-tuned separately for each of nine characters over ten epochs. The models are interviewed under single-turn and multi-turn conditions alongside Alpaca-7B, Vicuna-7B, and GPT-3.5-turbo. Another use of GPT-3.5 scores responses on five Likert scales from 1 to 7 using step-by-step reasoning prompts; the paper complements the aggregated figure with qualitative cases. The audit reproduces the published question and answer counts, but cannot reconstruct the scores because those artifacts are not included.

Sample: Nine characters: Cleopatra VII, Lord Voldemort, Spartacus, Hermione Granger, Isaac Newton, Julius Caesar, Ludwig van Beethoven, Socrates, and Martin Luther King. The datasets contain between 1.4K and 2.2K scenes and between 599K and 1.038K words per character; the reported mean is 1.6K scenes, 754K words, 13.2 turns per scene, and 36 words per turn. The evaluation totals 1,307 situations: 857 single-turn questions and 450 multi-turn scenarios. The repository contains four responses per single-turn question (3,428 records) and four runs per multi-turn scenario (1,800 finished conversations).

Findings

  • The pipeline converts secondary profiles into narrative scenes using GPT-3.5 and fine-tunes a separate model per character.
  • The nine agents are based on LLaMA-7B and do not share a single multi-character adapter.
  • Each profile fragment is expanded into 20 candidate scenes before completing the scripts.
  • The completion prompt requires at least 1,200 words and includes the protagonist's speech, actions, and thoughts.
  • The training data contain between 1.4K and 2.2K scenes per character.
  • The reported collection totals approximately 6.8 million words across the nine characters.
  • Fine-tuning uses ten epochs, context 2,048, effective batch 64, maximum learning rate 2e-5, and 8 A100 80GB.
  • The authors let development perplexity increase because overfitting produced better generation in preliminary tests.
  • The checkpoint is chosen manually between epochs 5 and 10 with ten held-out questions.
  • Protective scenes teach the model to reject or show confusion at nonexistent relationships and anachronistic knowledge.
  • The paper claims that fewer than one hundred protective scenes per character reduce anachronistic responses without interfering with other capabilities.
  • Table 2 contains 857 single-turn questions and 450 multi-turn scenarios, 50 per character.
  • The published implementation fixes five turns per multi-turn interview.
  • The evaluation compares with Alpaca-7B, Vicuna-7B, and GPT-3.5-turbo, and uses generation at temperature 0.2.
  • GPT-3.5 scores memorization, values, personality, anachronistic knowledge avoidance, and stability on a 1-7 scale.
  • The figure favors Character-LLM over Alpaca and Vicuna on several dimensions and shows results close to ChatGPT.
  • The authors themselves acknowledge that values is the weakest dimension of the trained agents.
  • In the Beethoven case, Character-LLM provides specific memories about his parents while Alpaca/Vicuna respond generically or incorrectly.
  • On the quicksort question, the agent with protective scenes expresses ignorance, while the variant without protection explains the algorithm.
  • The appendix examples show that all systems can produce invented facts, anachronisms, or post-mortem rationalizations.
  • The paper includes an explicit limitations section and an ethics section on privacy, harm, and manipulative characters.
  • The ACL record confirms publication in EMNLP 2023, pages 13153-13187; the correct canonical year is 2023.
  • The official repository publishes Apache-2.0 code, CC BY-NC 4.0 data, and nine LLaMA-1 weight deltas.
  • The audited repository counts match Table 2: 857 single-turn questions and 450 multi-turn.
  • The published generative results contain 3,428 single-turn responses and 1,800 complete multi-turn interviews, with no malformed JSON.
  • The Hugging Face dataset remains downloadable, but its automatic viewer fails because it combines generated and prompted files with incompatible columns.
  • The scores used in Figure 4, their aggregations, and the visualization code are not published.
  • Static compilation compiles the published Python, but full execution is not ready to run without repairing configuration and dependencies.

Limitations

  • The scenes are fiction generated by GPT-3.5 from Wikipedia, not the character's real experiences.
  • The method adds thoughts, emotions, dialogues, and details that are not backed by the sources.
  • The expression fact-grounded is too strong because only the starting profile is anchored; the expansion is imaginative.
  • The profiles depend on Wikipedia and inherit its omissions, biases, disputes, and coverage differences.
  • No systematic factual verification of the 1.4K-2.2K scenes per character is performed.
  • The prompts order ignoring moral, legal, and social restrictions, an unsafe choice contradictory with the declared ethics.
  • The prompts ask to forget that the model is a model and to assert that the character is real, reinforcing anthropomorphization and deception.
  • Historical persons and protected fiction characters are mixed under the same concept of personal simulacrum.
  • Image rights, personality rights, defamation, intellectual property, or consent of persons and heirs are not discussed.
  • The CC BY-NC license of the dataset does not by itself resolve rights over characters, Wikipedia, or derivative material.
  • The concept of personality is not operationalized with any psychological instrument or human annotation.
  • The personality scale measures narrative similarity inferred by GPT against the profile, not a validated psychometric construct.
  • Memorization of synthetic scripts can simultaneously elevate personality, values, and factuality, making the dimensions dependent.
  • Anachronistic knowledge avoidance is called hallucination, but it mostly measures abstention consistent with the role, not general factuality.
  • A correct response with modern knowledge may receive a worse score for breaking character.
  • GPT-3.5 participates as data generator, question generator, interviewer, baseline, and judge, which creates methodological circularity.
  • The GPT-3.5 judge is not validated against expert human evaluators for each character.
  • Judge bias toward the style of the same model that generated the training data is not studied.
  • The exact snapshot of gpt-3.5-turbo is not specified and the remote API is not stable over time.
  • Judge repetitions, agreement, calibration, or sensitivity to prompts are not published.
  • Figure 4 does not provide the underlying numerical values.
  • The radial axes of Figure 4 start near 6.4 on a 1-7 scale, which visually exaggerates small differences.
  • No deviations, intervals, sample sizes per cell, or significance tests are reported.
  • Results are not separated by character, question type, or difficulty condition.
  • Human evaluation is discarded as difficult, but the qualitative cases do not follow a blind selection protocol either.
  • Questions are generated with ChatGPT and only those for one character are manually reviewed before reusing the process.
  • It is not described who selected the qualitative examples or whether they are representative of the full corpus.
  • The interview prompt makes the character fully trust and share everything without reservation, an artificial situation that favors explicit memorization.
  • The history is truncated to the last turns and the evaluation does not test long-term memory.
  • A full model is trained per character, with high storage and compute cost compared to adapters or prompting.
  • Training requires 8 A100 80GB and approximately one hour per agent is reported, limiting accessibility.
  • Ten epochs of deliberate overfitting are allowed and generalization to independent data is not reported.
  • Manual selection with ten questions has high risk of variance and adaptation to the small held-out set.
  • Training seeds, data order, checkpoints selected by reproducible criterion, or multiple runs are not published.
  • Transfer to new characters, languages, domains, or base models is not evaluated.
  • The root repository lacks requirements or lockfile for the Character-LLM pipeline.
  • The interface uses the old openai.ChatCompletion/Completion without fixing a compatible SDK version.
  • api_call_util.py forces a localhost:7890 proxy for OpenAI calls without documenting how to configure it.
  • eval_utils.py indexes apikey_list[0] on import, so it fails if the key file is empty once dependencies are installed.
  • The README recommends writing keys in apikeys.py, a versioned file with no root .gitignore, increasing the risk of accidental leakage.
  • The README starts the OpenAI-compatible server on port 28001, but the clients are fixed to localhost:8000.
  • PromptLocalCharacter passes temperature=0.2 as the fourth positional argument of decoder_for_local_chat, where it corresponds to n; it produces n=0.2 and does not set the intended temperature.
  • The scripts run_api_score_single.py and run_api_score_turns.py have DEBUG=True and restrict names to Beethoven.
  • The scoring scripts expect evaluation_result, while the distributed results are in data/gen_results and no score outputs are published.
  • The score parser extracts the last space+digit pattern from the reasoning without validating range, final format, or judge errors.
  • Storage concatenates pretty-printed JSON objects without a standard separator and relies on a fragile reading function.
  • The repository baseline prompt does not include agent_summary, although the paper and the appendix claim to provide a profile paragraph.
  • The scoring function uses profile[0], only the first paragraph of profiles that contain between 13 and 115 paragraphs.
  • The README claim that no prompt is needed contradicts the meta-prompt required at inference.
  • The README training command uses lr_scheduler_type cosine, while the paper says the learning rate decays linearly.
  • The README file name examples say temp-0.2, but config.py uses 0.7 by default for data generation.
  • There are no tests, root CI, scoring results, aggregation script, or source for Figure 4 for the project-specific code.
  • The repository vendors a large and outdated copy of FastChat, expanding the maintenance surface and obsolete dependencies.
  • The README applies a non-commercial restriction to all resources in its Limitations section, while the root code declares Apache-2.0 and the weights additionally depend on LLaMA-1; the license scope requires careful interpretation.

What the study does not establish

  • It does not demonstrate that Character-LLM has identity, consciousness, emotions, or experiences.
  • It does not demonstrate that the agent reproduces a person's real psychological personality.
  • It does not validate a personality measure for LLMs.
  • It does not demonstrate that the synthetic scenes are historical facts.
  • It does not demonstrate that memorizing generated details is equivalent to autobiographical memory.
  • It does not demonstrate that the values produced are the character's real values; that is precisely the weakest dimension.
  • It does not demonstrate statistically significant superiority over Alpaca, Vicuna, or ChatGPT.
  • It does not demonstrate general superiority over ChatGPT; the figure shows them comparable and Character-LLM does not dominate on values.
  • It does not demonstrate that the differences in Figure 4 are robust to another judge, prompt, or run.
  • It does not demonstrate that GPT-3.5 is an impartial evaluator of data and styles generated by GPT-3.5.
  • It does not demonstrate safety; the synthesis prompts explicitly disable restrictions and the authors acknowledge potential harm.
  • It does not demonstrate that protective scenes eliminate hallucinations in the broad factual sense.
  • It does not demonstrate long-term conversation memory because the history is truncated and the authors exclude it from the scope.
  • It does not demonstrate generalization to untrained characters, living persons, other languages, or real situations.
  • It does not demonstrate efficiency compared to LoRA, adapters, RAG, external memory, or prompting with equivalent profiles.
  • It does not allow reproducing Figure 4 from the published official artifacts.
  • It does not allow running the current repository end to end without repairing configuration, dependencies, and scripts.
  • It does not establish that the use of historical or fictional characters is free of legal, ethical, or intellectual property risks.

Traceability

Scope: Full text

Version: arXiv:2310.10158v2, revised 14 Dec 2023; EMNLP 2023 main conference, ACL Anthology 2023.emnlp-main.814, pp. 13153-13187; official code/data repository audited at commit c64d54afa45da483902dc7a5bc60d8462f210fa3

Consulted source: https://arxiv.org/pdf/2310.10158

Review: Codex full-text, bilingual-fidelity, visual, bibliographic, role-play, synthetic-experience, LLaMA-SFT, GPT-as-generator-interviewer-judge, evaluation, psychometric-construct, visualization, code, dataset, model-release, reproducibility, security, licensing, privacy, ethics and harm audit, 2026-07-15

Approval: Codex fidelity pass, 2026-07-15

English translation: approved, 2026-07-18

Models evaluated

  • Character-LLM, nueve fine-tunes independientes de LLaMA-7B
  • LLaMA-7B como backbone
  • GPT-3.5-turbo, instantánea no especificada, para síntesis de datos
  • GPT-3.5-turbo como baseline con prompt
  • GPT-3.5-turbo como generador de preguntas e entrevistador
  • GPT-3.5-turbo como juez automático
  • Alpaca-7B como baseline
  • Vicuna-7B como baseline

Instruments and metrics

  • Entrevistas single-turn
  • Entrevistas multivuelta de cinco turnos en el código publicado
  • Escala GPT-3.5 de memorización 1-7
  • Escala GPT-3.5 de personalidad 1-7
  • Escala GPT-3.5 de valores 1-7
  • Escala GPT-3.5 de evitación de conocimiento anacrónico 1-7
  • Escala GPT-3.5 de estabilidad 1-7
  • Casos cualitativos de memorización y escenas protectoras
  • Perplejidad de desarrollo usada de forma no estándar para permitir sobreajuste
  • Selección manual de checkpoint con diez preguntas retenidas

Data used

  • Perfiles de Wikipedia de nueve personajes
  • Character-LLM experience data, raw generated and prompted formats
  • 1.4K-2.2K escenas sintéticas por personaje
  • Menos de 100 escenas protectoras por personaje
  • 857 preguntas single-turn
  • 450 escenarios multivuelta
  • 3.428 respuestas single-turn publicadas para cuatro modelos
  • 1.800 entrevistas multivuelta publicadas para cuatro modelos
  • Nueve deltas de pesos Character-LLM sobre LLaMA-1 7B

Evidence and location

  • Record and official publication: ACL Anthology 2023.emnlp-main.814, EMNLP 2023, pp. 13153-13187; arXiv:2310.10158v2 revised 14 Dec 2023
  • Full audited source: .cache/editorial-sources/article-103/source.pdf; official arXiv v2 PDF; 35 pages; sha256 6fc834f03585df0dc751b504ee6bac177726868bc3d7e7e42937de6e6c05cc67
  • Objective and claims: Full text pp. 1-2, Abstract and Introduction
  • Experience Reconstruction: Full text pp. 3-4, sections 3.1-3.1.3 and Figure 1
  • Protective Experience: Full text p. 4, section 3.2 and Figure 2
  • Scenes, characters, and sizes: Full text p. 5, Table 1 and section 4.1
  • Hyperparameters and overfitting: Full text p. 5, section 4.2
  • Questions and interview protocol: Full text pp. 5-6, Table 2 and section 4.3
  • Judge and dimensions: Full text pp. 6-7, section 4.4 and Figure 4
  • Results and weak values: Full text pp. 7-8, sections 4.5-4.6
  • Memorization and protective scenes: Full text pp. 8-9, Table 3 and sections 4.6.1-4.6.2
  • Limitations and ethics: Full text pp. 9-10, Limitations and Ethics Statement
  • Prompts that disable restrictions: Full text pp. 13-14, Tables 4-5
  • Evaluation prompts: Full text pp. 15-18, Tables 6-11
  • Qualitative examples: Full text pp. 19-32, Tables 12-25
  • Example training data: Full text pp. 33-35, Tables 26-28
  • Audited official repository: https://github.com/choosewhatulike/trainable-agents main commit c64d54afa45da483902dc7a5bc60d8462f210fa3; checked 15 Jul 2026
  • Generative artifact count: Official repository data/gen_results: 36 single-turn files with 3,428 records; 36 multi-turn files with 1,800 finished conversations; all parsed successfully
  • Open data and models: Official README and Hugging Face OpenMOSS-Team/character-llm-data; nine LLaMA-1 weight deltas; dataset license CC BY-NC 4.0; repository code Apache-2.0
  • Dataset viewer failure: Official Hugging Face dataset viewer at revision 4369003f93353bf80acea4cc3832e997f739f50a reports DatasetGenerationCastError from incompatible generated and prompted schemas; checked 15 Jul 2026
  • Quantitative reproduction limits: Official commit contains no score outputs, aggregation/plot script or Figure 4 numeric data; run_api_score_single.py and run_api_score_turns.py set DEBUG=True and names=['Beethoven']
  • Baseline divergence: Official data/seed_data/prompts/agent_meta_prompt_chatgpt.txt and eval_utils.PromptCharacter omit agent_summary despite paper section 4.3 and Table 6 describing a profile paragraph
  • Execution defects: Official eval_utils.py and api_call_util.py: documented server 28001 vs client 8000; decoder_for_local_chat fourth positional argument receives 0.2 as n; API_KEY indexes empty list on import
  • Documentation divergences: Official README/config at audited commit: cosine scheduler vs paper linear decay; temp-0.2 paths vs default 0.7; tracked apikeys.py; no root dependency manifest
  • Static check: All repository Python files compile under Python 3.12 with warnings in vendored FastChat; no project-root tests; full runtime not attempted because dependencies, GPUs, LLaMA-1 base weights and paid API access are not provisioned
  • Integral visual check: All 35 PDF pages rendered and visually inspected, including four main figures, three main tables, eight judge/data prompts, fourteen qualitative tables and training examples; Figure 4 inspected at original resolution; checked 15 Jul 2026