Creative Applications › Text Generation and Writing Assistance
Language AI HandbookAll chapters Creative Applications › Text Generation and Writing AssistanceOne section · Sections in this chapter3 / 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
The most widely deployed creative application is writing assistance: models that help humans draft and revise text. Writing assistance covers a broad spectrum.
At one end, autocomplete tools predict the next few words in a sentence. At the other, full-draft generation produces complete essays or stories from a brief prompt. Between these extremes lie a range of use cases:
- Style rewriting: Take a passage and rewrite it in a different voice, such as more formal, more casual, more poetic, or in the style of a specific author.
- Continuation: Given the opening of a story or essay, continue it in a consistent style.
- Expansion: Take a brief outline and expand each point into full paragraphs.
- Reduction: Condense a verbose draft while preserving all key ideas.
- Brainstorming: Generate a list of plot ideas, character names, metaphors, or titles.
These tasks require different model behaviors. Style rewriting requires fine-grained control over surface features like sentence length, vocabulary register, and punctuation habits. Continuation requires tracking long-range narrative context. Brainstorming requires diversity, producing varied outputs rather than variations on the same answer.
Prompt Engineering for Creative Writing
The quality of creative output depends heavily on how you frame the task. A generic prompt like "write me a short story" produces generic output. A carefully structured prompt constrains the generation toward higher quality.
The components of an effective creative prompt include:
- Genre and tone: Is this a thriller, a fairy tale, a slice-of-life drama? Is the tone darkly comic, earnest, melancholic?
- Characters: Who are the people involved? What do they want? What is their relationship?
- Setting: Where and when does the action take place?
- Conflict: What tension or challenge drives the narrative?
- Style constraints: Should the prose be spare and Hemingway-like, or lush and Proustian? Should it use second person? Present tense?
- Length and structure: How long? One scene, three acts, a series of vignettes?
The more precisely you specify these dimensions, the more the model can direct its generation toward something useful. This does not mean more words in the prompt is always better; focused, precise constraints outperform long, rambling instructions.
A useful framework for creative prompting is the "constraint stack": you specify the broadest constraints first (genre, length, intended audience) and progressively narrow down to surface-level constraints (sentence length, vocabulary, perspective). When the model has to satisfy all constraints simultaneously, starting broad and narrowing down helps it find a coherent solution rather than satisfying some constraints while ignoring others.
One practical technique is the "persona prompt": assigning the model a specific creative identity rather than asking it to generate directly. Instead of "write a poem about urban loneliness," try "You are a poet in the tradition of Frank O'Hara, writing observational lyrics about New York street life. Write a 12-line poem about waiting for the subway at rush hour." The persona anchors the model's generation to a specific aesthetic framework, which produces more consistent and distinctive outputs.
Another technique is iterative refinement through dialogue. Rather than expecting a single prompt to produce a finished work, treat the model as a collaborator you are workshopping with. Generate a first draft, identify what is not working, and provide specific revision instructions. "The third paragraph loses momentum. Cut it to three sentences and end with the image of the empty doorway." This human-in-the-loop workflow produces much better results than single-shot generation, and it mirrors how professional writers work in practice.
Controlling Style and Voice
One of the most practically useful creative applications is style transfer: transforming text to match a target style while preserving content. A technical writer can transform a dense specification into plain English. A novelist can transform a rough outline into flowing prose. A journalist can recast the same event in the voice of different publications.
Style transfer in language models is not a separate architectural mechanism. It emerges from the model's ability to condition on prompts. By providing examples of the target style in the prompt, or by describing the style in natural language, you steer the model's sampling distribution toward that stylistic region of text space.
The key insight is that style and content can be somewhat decoupled. When you write "rewrite the following in the style of Raymond Carver: [passage]", you are asking the model to preserve propositional content while changing surface realization: shorter sentences, plain Anglo-Saxon vocabulary, dialogue over description, withholding explanation rather than providing it. The model has seen enough Carver (and discussions of Carver) during training to execute this transformation.
Style can be communicated to a model in three different ways, each with distinct tradeoffs:
Named author style ("Write in the style of Hemingway") works when the author is well-represented in the training data. The model has absorbed patterns from their work and critical discussion of it. This is convenient but imprecise: the model's understanding of Hemingway is a statistical composite that may miss idiosyncratic details, and living authors whose work is less densely represented will produce weaker style matches.
Descriptive style specification ("Write using short, declarative sentences under twelve words; avoid adverbs; use concrete nouns over abstractions") translates style into explicit surface constraints. This is slower to specify but gives you precise control over the dimensions of style you care about most, and does not depend on the model having absorbed any particular author.
Few-shot examples ("Here are three paragraphs in my target style: [examples]. Now rewrite the following in this style: [passage]") are the most reliable method when you have samples of the target style available. The model learns the style directly from the examples rather than from a description, which captures nuances that are hard to articulate verbally. The limitation is that it consumes significant context window space.
In practice, combining approaches works well: provide the author name for broad strokes, then add specific constraints for the dimensions where named-author transfer falls short. "Write in the style of Joan Didion, with particular attention to fragmented sentences, parenthetical asides, and her habit of opening paragraphs with short declarative statements before elaborating."
The Role of System Prompts
Modern language model APIs distinguish between the system prompt, which sets the overall context and persona for the model, and the user message, which contains the specific request. This distinction matters for creative work because the system prompt provides a persistent stylistic anchor that shapes every response in the conversation.
A well-designed system prompt for a creative writing assistant might specify the desired writing philosophy, the types of tasks the model should specialize in, the level of formality in feedback, and any constraints (no profanity, keep outputs under 500 words, always include three variations). By moving these persistent constraints out of the user message and into the system prompt, you free the user message to focus on the specific creative request rather than repeating boilerplate.
System prompts can also encode a specific author voice. If you want all outputs to feel like they come from a consistent narrative persona, describe that persona in the system prompt: its history, its aesthetic sensibilities, its characteristic vocabulary choices. This is particularly useful for content creation workflows where many outputs must feel like they come from a single coherent voice.
Structured Generation for Creative Control
Beyond natural language prompting, structured generation techniques can impose hard constraints on creative outputs. Constrained decoding, where the model's next-token probabilities are filtered or reweighted to exclude tokens that would violate a constraint, allows enforcing rules like minimum and maximum line length, vocabulary restrictions, or required keywords without relying on the model's compliance with instructions.
A practical application is genre filtering: if you need a story that mentions specific product names or avoids certain topics, you can implement token-level filters that enforce these constraints deterministically during decoding. The model never even considers emitting a forbidden token, so the constraint is guaranteed regardless of generation temperature. The cost is that heavy constraints can force the model into unnatural continuations where the only compliant token choices produce awkward text. The art is calibrating constraints tightly enough to be useful but loosely enough to leave the model's expressive range intact.
Constrained decoding is also useful for structured creative formats, forms like ABAB rhyme schemes, where you know at each decision point which tokens are compliant (words that rhyme with the required end sound) and which are not. Rather than prompting the model to rhyme and hoping it does, you can filter the output distribution to only contain rhyming tokens at the line endings. This hybrid approach, creative generation with structural enforcement, tends to produce higher formal compliance than prompting alone, especially for demanding forms like the villanelle.
We will encounter constrained decoding again in Part XLII on Constrained Decoding, where the same technique is applied to structured data extraction and format compliance in non-creative contexts. The mechanism is identical; what changes is what constitutes a "valid" token at each position.