Creative Applications › Storytelling and Narrative Generation

Michael BrenndoerferJanuary 14, 20268 min read
Language AI HandbookAll chapters
Part 63 of 67LLM Applications
Chapter 484Creative Applications › Storytelling and Narrative Generation
Reading section 4 of 12 · Storytelling and Narrative Generation · 8 minSection 4 of 12 · 8 min

Book contents

Section 4 of 12 · 8 min read

Creative Applications › Storytelling and Narrative GenerationOne section · Sections in this chapter4 / 12 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Storytelling is perhaps the richest and most demanding creative task for language models. A good story requires coherent sentences and coherent worlds: characters whose motivations are consistent, plots that follow cause and effect, settings that feel real, and a structure that builds tension and delivers resolution.

Narrative Structure

The most enduring framework for story structure is the three-act arc. Act one establishes characters, setting, and the central conflict. Act two develops the conflict, escalates stakes, and tests the protagonist. Act three resolves the conflict and shows how the protagonist has changed.

This structure has persisted across thousands of years of storytelling because it maps to something deep in how humans process experience: setup, complication, resolution. Language models absorb this pattern from the vast corpus of human narrative they are trained on, which means they generate text that tends to follow it implicitly. You can make this tendency explicit by prompting the model to write "a three-act story where act one introduces [X], act two complicates it with [Y], and act three resolves with [Z]."

More formally, we can describe a narrative as a sequence of states s1,s2,…,sns_1, s_2, \ldots, s_n where each state represents the world at a moment in the story. A story advances through a transition function that takes the current state and a character action or external event and produces the next state:

st+1=f(st,at)s_{t+1} = f(s_t, a_t)

where:

  • sts_t: the story world state at narrative moment tt, encoding all facts, relationships, and conditions that hold at that point
  • ata_t: the action or event at step tt, representing either a character choice or an external occurrence that changes the world
  • ff: the transition function encoding how the world changes in response to actions, implicitly learned by the language model from its narrative training data
  • st+1s_{t+1}: the resulting state after the action, which must be causally motivated by sts_t and ata_t to maintain narrative coherence

A coherent story requires these transitions to be motivated and causal: each state change should follow from the previous one. Language models generate narrative states implicitly, and their tendency toward coherence comes from training on text where humans have already enforced causal consistency.

A practical consequence of this formalism is that long-form coherence requires maintaining sts_t accurately as tt grows large. When the context window fills, the model's effective representation of sts_t degrades because it can no longer attend to the full early history. This is why long-form AI narrative often drifts: the model is not tracking the full state but a lossy compression of it.

Plot Devices and Structural Patterns

Beyond the three-act arc, narrative theorists have identified dozens of recurring structural patterns that appear across cultures and genres. Understanding these patterns helps you prompt models toward more structurally interesting outputs.

Vladimir Propp, analyzing Russian folk tales, identified 31 recurring narrative functions, such as "the hero receives a magical agent," "the villain is defeated," and "the hero is recognized." Nearly every folk tale is a permutation of a subset of these functions in a fixed order. Propp's insight was that deep narrative structure is highly constrained even when surface content varies wildly.

More recently, "Save the Cat" beat sheets and similar screenwriting frameworks have popularized specific structural breakdowns with precise placement in the story timeline: the "fun and games" section that explores the story premise before complications arrive, the "all is lost" moment near the end of act two, the "finale" that synthesizes everything the protagonist has learned. These templates are explicit enough to serve as direct prompting instructions.

The Kishōtenketsu structure from Japanese and Chinese narrative tradition offers a different structural model. Rather than conflict-complication-resolution, it organizes narrative as four phases: Ki (introduction), Sho (development), Ten (twist or unexpected turn), and Ketsu (reconciliation). Stories in this structure do not require a central conflict; the twist creates interest by juxtaposing two situations that seem unrelated until the fourth phase reveals their connection. This structure is less deeply embedded in English-language models because it is less represented in English training data, which makes it a useful direction to push when you want less generic output.

Character Consistency

Character consistency is one of the hardest problems in long-form narrative generation. A character introduced as laconic and mistrustful should not become verbose and open two scenes later without some narrative cause. A villain with a specific ideology should not suddenly express incompatible beliefs.

Language models struggle with character consistency for a fundamental reason: they have finite context windows. Once a character's introduction scrolls past the context boundary, the model can no longer directly attend to it. It must rely on compressed representations implicit in the continuation, which are imprecise.

Character consistency is also related to the model's tendency toward what you might call "narrative gravity": the pull toward the expected resolution given the genre and surface features of the prompt. A character whose personality would naturally resist the expected ending is gradually softened until they cooperate. The model is optimizing for plausible continuation, and plausible continuation often means gravitating toward genre conventions.

Practical strategies to maintain character consistency include:

  • Character cards: Maintain a persistent description of each character's personality, speech patterns, goals, and backstory, and include it in the prompt for every generation call.
  • Summarization: As the story grows, periodically summarize earlier events into a compressed "story so far" that fits in the context window alongside the current scene.
  • Retrieval augmentation: Store the full story in a vector database and retrieve the most relevant earlier passages before each generation. As we covered in Part XLIV on Retrieval-Augmented Generation, this approach can extend effective memory far beyond the context window.
  • Consistency checking: After each generation, ask the model to review the latest passage against the character cards and flag any inconsistencies before proceeding.
Character Card Pattern

A character card is a brief structured description used to anchor language model outputs. A typical character card includes name, role in the story, personality traits (3-5 adjectives), speech pattern (formal/casual/eccentric), core motivation, and relationships to other characters. Providing this card as a system prompt or early user message anchors the model's generation around a consistent character identity.

World-Building and Setting

World-building, the practice of constructing the physical, social, and historical rules of a fictional setting, presents distinct challenges for language models. A well-built world has internal consistency: its geography constrains travel, its political history shapes present conflicts, its technology level determines what is and is not possible. A model generating within a world it has not been explicitly told about will default to familiar conventions: it will produce pseudo-medieval European fantasy settings, near-future cyberpunk cities, or contemporary urban realism because these settings are dense in its training data.

The solution is to externalize world state the same way you externalize character state. A world document that specifies the relevant facts (the three moons, the societal taboos, the magic system's rules) and is included in every generation call gives the model the constraints it needs to generate consistently within the world you have built. Without this, the model will hallucinate details that contradict each other across scenes.

An interesting technique is to ask the model to help you build the world before writing in it. "Generate a list of 20 defining characteristics of a society that has had no concept of private property for 500 years. Include cultural practices, social norms, architectural conventions, and sources of interpersonal conflict." This exploratory prompting can surface interesting world-building details you would not have generated yourself, and the output becomes part of the world document you then use for narrative generation.

Interactive Narrative and Games

One of the most exciting applications of narrative generation is interactive fiction: stories where the reader makes choices that change the plot. Classical interactive fiction like Zork used hand-authored branching trees with thousands of nodes. Language models make it possible to generate narrative branches dynamically, in response to any player input.

The architecture for an interactive narrative system typically involves four components working together. The world state component tracks what has happened, who is present, and what is true in the story world. The narrator component generates prose descriptions of the current state. The player component provides natural language input about what to do next. The parser component updates the world state based on player input.

Language models can play multiple roles in this architecture: as the narrator, as individual characters responding to the player, or as the parser that determines how the world state should change. Game developers have used this approach to create "AI dungeon masters" that run tabletop roleplaying scenarios, interactive story engines for branching narrative games, and dialogue systems for non-player characters that feel responsive rather than scripted.

The key engineering challenge in interactive narrative is maintaining consistency under arbitrary player actions. A scripted system can anticipate every input; a generative system must remain coherent even when the player does something completely unexpected. Constrained generation techniques, where the model is asked to update the world state before generating narrative, and where impossible actions (teleportation in a non-magical world) are flagged and refused, help maintain the contract between the player and the fictional world.