Remember Me: Enhancing Long-term Character Persistence in LLM-Generated Stories using Knowledge Graphs

Alvin Tan, Jay Campanell, Richa Misra, Naina Panjwani, Jessica Fu, Rida Faraz, Joel WalsharXiv 2026

TL;DR

Large language models (LLMs) are great at writing a compelling opening chapter, but ask them to write a full novel and characters start forgetting who they are—or disappearing altogether. This paper introduces a multi-agent storytelling pipeline that maintains an evolving knowledge graph (KG) as a shared long-term memory across chapters. Tested on 100 generated stories, this graph-guided approach significantly boosts character and relationship persistence over naive prompting.

What Problem Does This Paper Address?

Off-the-shelf LLMs struggle with long-form fiction. As narratives stretch across multiple chapters, models routinely suffer from narrative drift: characters act out of character, established relationships vanish, and plot threads are quietly dropped.

Compounding this problem is an evaluation gap. Traditional text-generation metrics like BLEU or METEOR require a reference text, which doesn't exist for open-ended creative writing. Newer reference-free metrics like UNION are trained on short stories and break down on multi-chapter narratives averaging over 4,000 words, while using LLMs as judges introduces bias and unreliable numerical scoring. The authors needed both a way to keep LLMs consistent over long horizons and an objective way to measure whether it actually worked.

Methods

The authors built a chapter-by-chapter generation pipeline using LangGraph, structured as a directed loop of three specialized nodes:

Figure 1: Agentic Structured Generation Workflow
  1. Writer: Generates the next chapter conditioned on previous chapters plus a structured context block pulled from the current knowledge graph (highlighting when characters were introduced, milestone chapters, and recent events).
  2. Grapher: Uses LLM prompting (inspired by GraphRAG and AutoKG) to extract entities—characters, events, objects, locations, and organizations—along with their relationships from the newly written chapter, updating the shared KG.
  3. Planner: Increments the chapter counter, resets completion flags, and uses a router function to decide whether the story has reached its natural conclusion.

To prevent repetitive outputs from the same prompt and give the pipeline a clear stopping point, the writer's system prompt also randomly injects one of seven classic story arcs (such as Rags to Riches, Man in a Hole, or Cinderella).

For evaluation, the authors avoided LLM-as-judge entirely. Instead, they used Named Entity Recognition (NER) and dependency parsing to extract characters and relationships chapter by chapter, defining three retention metrics computed from Chapter 2 onward:

  • Chapter 1 Retention: What percentage of entities/relationships from the opening chapter are still active?
  • Rolling Retention: What percentage carry over from the immediately preceding chapter?
  • Cumulative Retention: What percentage of all historical entities/relationships are active in the current chapter?

Datasets

Rather than training or fine-tuning on an existing corpus, the pipeline operates zero-shot. To evaluate it, the authors curated a new set of starting prompts spanning multiple genres and generated 50 stories using the KG pipeline (320 chapters total) and 50 baseline stories using naive prompting (281 chapters total), all powered by claude-haiku-4.5.

Key Insights and Ideas

  • Depth over disposability: Because the writer can see the evolving graph, it tends to introduce fewer new characters per chapter (1.244 vs. 1.454) and instead develops existing ones, avoiding the common LLM habit of inventing flat, one-off characters.
  • Anchoring the opening act: Knowledge graph guidance doesn't significantly change short-term, chapter-to-chapter relationship retention, but it dramatically improves Chapter 1 relationship retention. In other words, the graph acts as an anchor that keeps early, foundational dynamics alive late into the story.
  • Objective cohesion metrics: Measuring entity and relationship overlap via NER provides a lightweight, bias-free proxy for narrative cohesion in long-form unreferenced text.

Key Results

Across ten measured retention metrics, five showed statistically significant improvements with KG guidance:

  • Character Chapter 1 Retention: 0.689 (KG) vs. 0.622 (No-KG), $p = 0.003$
  • Character Rolling Retention: 0.770 vs. 0.731, $p = 0.035$
  • Character Cumulative Retention: 0.500 vs. 0.457, $p = 0.008$
  • Total Relationships per Chapter: 3.948 vs. 3.208, $p = 0.037$
  • Relationship Chapter 1 Retention: 0.294 vs. 0.195, $p = 0.004$

A qualitative case study—using a prompt about a chess champion poisoned mid-game—illustrates the difference. The KG-guided story ran for 10 chapters (59 nodes, 107 edges) with earned psychological escalations and consistent character dynamics. The baseline story ended in 6 chapters (41 nodes, 53 edges), featuring a protagonist who abruptly abandons 36 years of established avoidance after a single conversation, alongside supporting characters who contradict themselves or vanish without resolution.

Figure 2: Knowledge Graph of Story Generated with Multi-Agent Pipeline (left) and with Vanilla Prompting (right)

Limitations and Future Work

The authors note several caveats. First, due to an implementation oversight, the baseline used a sampling temperature of 0.8 compared to 0.7 for the KG pipeline. Second, human evaluators pointed out that while KG-guided stories are more logical and cohesive, they can still lack stylistic flair, emotional depth, and a distinctive authorial voice—and retention metrics alone don't capture human-level creativity.

Looking ahead, the authors plan to add verifier and critic agents to polish voice and narrative tension, test the pipeline across different base models, and adapt the framework for educational tools like intelligent textbooks that auto-generate timelines, concept maps, and comprehension questions from underlying knowledge graphs.

Summary updated

BibTeX
@misc{tan2026remember,
  author = {Alvin Tan and Jay Campanell and Richa Misra and Naina Panjwani and Jessica Fu and Rida Faraz and Joel Walsh},
  title = {{Remember Me: Enhancing Long-term Character Persistence in LLM-Generated Stories using Knowledge Graphs}},
  year = {2026},
  eprint = {2612.02922},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.02922},
}
Figure