Long-Context LLMs for Long-Form Fiction Writing: Practices and Methods
This article examines how long-context large language models can support serialized novel writing in practice without relying on a single oversized prompt. It covers instruction templates for genre and structure, author-style profiles, external state files for continuity, request assembly, prefix caching and cost considerations, and review workflows for consistency and de-templateization.
1. Challenges of Long-Form Serialized Writing for LLMs
Long-form serialized web novels often reach hundreds of thousands of Chinese characters. This type of writing places three kinds of demands on a model: characters and settings must remain consistent, foreshadowing must be paid off according to plan, and the writing style must stay uniform across chapters. Short-form writing only requires quality in a single output, while long-form writing requires the model to remain stable across hundreds of calls.
The context window for a single request is limited. Even if the window is large enough, inserting the full text into every request creates high costs, and the model’s attention to the middle of long text often declines. The engineering question is therefore not “how many characters can be packed into one request,” but “which information should each request carry.”
2. Turning Writing Rules into Reusable Instruction Templates
A practical starting point is to analyze existing open-source writing instruction sets and observe how they organize role settings, chapter rhythm, and output format. Then rewrite them for the target genre. Combat-focused genres emphasize the rhythm of action scenes, while emotional genres rely more on dialogue and psychological description; their chapter structures and climax arrangements differ.
A practical instruction template usually contains four parts:
- Genre conventions: narrative perspective, tense, and principles for handling common plot devices.
- Structure conventions: chapter openings, conflict, and closing patterns, plus the chapter length range.
- Quality checklist: issues to avoid, such as repetitive wording, empty adjectives, and templated transitions.
- Output format: where the title, body, and chapter summary should be placed.
The template should not be too long. The more instructions there are, the more likely the model is to ignore one of them. Each rule should ideally be checkable. For example, “at least one concrete event that advances the main plot appears in each chapter” can be checked chapter by chapter, while “write it well” cannot be verified.
3. Building a Style Profile from Personal Text
If the output should feel close to a particular author’s voice, first collect texts the author has already published, then extract quantifiable features:
- sentence length distribution and paragraph length;
- high-frequency function words and colloquial expressions;
- the ratio of dialogue to narration;
- common structures at chapter openings and endings.
Organizing these features into a style guide is more stable than simply attaching several sample passages. Samples should serve as references and should not be copied wholesale into the output. Personal text involves privacy and copyright, so it is advisable to process it locally and avoid uploading it to third-party services of unknown origin.
4. Maintaining Coherence with State Files
Long-form coherence cannot rely entirely on the model’s own memory; it should be supported by external state files. Common state includes:
- Character cards: name, appearance, motivation, known information, and current location.
- World settings and map: location relationships, faction distribution, and rule boundaries.
- Timeline: events in each chapter and their order.
- Foreshadowing table: planted clues, planned payoff chapters, and current status.
- Chapter summaries: a five-to-eight-sentence summary generated after each chapter is completed.
After each chapter is written, the workflow updates these files. For the next chapter call, only relevant character cards, map fragments, recent chapter summaries, and unresolved foreshadowing need to be included, rather than the full original text of the entire book. Below is a structural sketch for organizing a request:
[Writing specification and style guide] Stable content[World settings and map] Stable content[Relevant character cards] Changes infrequently[Recent chapter summaries and unresolved foreshadowing] Updated each chapter[Chapter outline and word-count requirements] Changes each time
Expressed in code, the logic is roughly as follows. The functions here are hypothetical placeholder implementations used to illustrate the approach:
def build_request(chapter_no, outline):parts = [STYLE_GUIDE, WORLD_BIBLE]parts += [character_card(c) for c in active_characters(chapter_no)]parts.append(recent_summaries(chapter_no, window=5))parts.append(open_threads())parts.append(outline)return "\n\n".join(parts)
5. Cost and Cache Hit Rate
When billing is based on input tokens, the cost of long-form writing mainly comes from two parts: the prefix repeatedly sent with each request, and the newly generated output. Some services support prefix caching, and cached input tokens usually have a clearly lower unit price than uncached tokens. Therefore, stable content should be placed at the beginning of the request, and that text should not be changed arbitrarily on every call; otherwise the cached prefix will be invalidated.
Total cost can be roughly estimated as:
Total cost ≈ uncached input × uncached unit price + cached input × cached unit price + output × output unit price
The author has reported a personal data point: for a work of about 800,000 Chinese characters, cumulative usage was about 75 million tokens, of which the uncached portion was about 1.1 million tokens, or roughly 1.5%. This suggests that the cache hit rate can have a greater impact on total cost than the unit price of a single request. However, this is only a personal case and should not be treated as a general benchmark. Actual cost also depends on model pricing, the number of chapters, the number of rewrites, and the number of review rounds.
6. Review and Removing Templated Expression
Common problems in model output include uniform chapter openings, heavily stacked emotion words, overly regular transitions, and dialogue styles that converge across different characters. After each chapter is completed, a three-step check can be used:
- Structure check: does this chapter advance at least one main plotline, and do characters make choices with costs?
- Style check: count high-frequency words, identify repeated sentence patterns that appear consecutively, and replace overused rhetorical devices.
- Fact check: compare against character cards, the timeline, and the map to verify character locations, time, and known information.
Automated checks can help identify problems, but the final judgment still requires a human read-through.
