Skip to main content
QUICK REVIEW

[Paper Review] ChatHaruhi: Reviving Anime Character in Reality via Large Language Model

Cheng Li, Ziang Leng|arXiv (Cornell University)|Aug 18, 2023
Topic ModelingComputer Science11 citations
TL;DR

The paper presents ChatHaruhi, a system that uses a memory-augmented prompt and a character dialogue corpus to enable LLMs to role-play specific characters, and releases a 54K-dialogue dataset for 32 characters.

ABSTRACT

Role-playing chatbots built on large language models have drawn interest, but better techniques are needed to enable mimicking specific fictional characters. We propose an algorithm that controls language models via an improved prompt and memories of the character extracted from scripts. We construct ChatHaruhi, a dataset covering 32 Chinese / English TV / anime characters with over 54k simulated dialogues. Both automatic and human evaluations show our approach improves role-playing ability over baselines. Code and data are available at https://github.com/LC1332/Chat-Haruhi-Suzumiya .

Motivation & Objective

  • Motivate better role-playing of fictional characters by addressing memory, consistency, and hallucination issues in LLMs.
  • Propose an algorithm that uses system prompts, character memories, and dialogue memories to guide in-character responses.
  • Construct a dataset (ChatHaruhi-54K) spanning 32 characters to train and evaluate persona-based chatbots.
  • Enable both large (ChatGPT/Claude) and smaller (7B) models to perform in-character dialogue via fine-tuning and data generation.

Proposed method

  • Define a three-component character representation: knowledge/background, personality, and linguistic habits.
  • Extract and store original dialogues from scripts into a memory bank D for each character.
  • Search a memory bank U with sentence embeddings to retrieve the most relevant dialogue memories for a given user query q.
  • Use a system prompt sR that emphasizes cosplay, reuse of original lines, and character-specific language to guide outputs.
  • Maintain a dialogue history H limited to about 1200 tokens to ensure coherent responses.
  • Automatically generate additional in-character dialogues with Alpaca-like prompts to produce D and augment data for fine-tuning (leading to ChatHaruhi-54K).
Figure 1: Our algorithm is role-playing Haruhi Suzumiya. Note that the user’s questions are related but not identical to the original plot, while Chat Haruhi Suzumiya’s answers can largely quote the original plot.
Figure 1: Our algorithm is role-playing Haruhi Suzumiya. Note that the user’s questions are related but not identical to the original plot, while Chat Haruhi Suzumiya’s answers can largely quote the original plot.

Experimental results

Research questions

  • RQ1Can a memory-augmented prompting system improve an LLM's ability to role-play a specific character significantly beyond baseline prompts?
  • RQ2Does combining original script memories with generated dialogues yield more faithful and consistent character portrayals across languages?
  • RQ3What is the impact of memory retrieval and prompt design on alignment with a character's setting and linguistic style?
  • RQ4Can a local 7B model fine-tuned on the ChatHaruhi-54K data reproduce in-character behavior comparably to larger models?

Key findings

  • The ChatHaruhi pipeline improves in-character alignment and response quality over baselines given the same base model.
  • The authors assembled ChatHaruhi-54K with 22,752 original dialogues and 31,974 simulated dialogues, totaling 54,726 for 32 characters.
  • Evaluation includes both automatic similarity-based measures and planned human alignment/quality assessments.
  • When fine-tuning a 7B model on the ChatHaruhi data, they obtain models (A/B) trained on 22,752 and 54K data respectively, with assessments reported.
  • The system supports using ChatGPT/Claude or a fine-tuned 7B locally, enabling flexible deployment.
Figure 2: The statistics of the ChatHaruhi-54K dataset, showing 32 characters and 54,726 dialogues. The opaque bars indicate the original script data, while the translucent bars present simulated dialogues generated by models like Alpaca.
Figure 2: The statistics of the ChatHaruhi-54K dataset, showing 32 characters and 54,726 dialogues. The opaque bars indicate the original script data, while the translucent bars present simulated dialogues generated by models like Alpaca.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.