How to Choose an LLM for Writing and Apply Prompt Engineering
This article explains why asking which LLM writes best is the wrong question, then breaks writing quality into four measurable dimensions: instruction following, knowledge breadth, long-range consistency, and language or style fit. It offers a task-profile scoring approach for model selection, a four-part prompt structure, layered context-management defenses, a regression-based evaluation set, and cost-aware routing, along with common pitfalls to avoid.
1. Why “Which Model Writes Best?” Is the Wrong Question
In real-world AI writing, the most common question is which model writes best right now. From an engineering perspective, this question lacks constraints. Writing is a composite task that depends heavily on subject matter, language, length, style intensity, and context length. Models differ across four dimensions: general coverage, stylistic flair, long-range stability, and multilingual consistency, and these differences keep shifting with each version release. A more rigorous framing is: given a task distribution and cost constraints, which class of model and which tier of prompting strategy work best together.
Abstracting the empirical observations yields a two-dimensional framework:
- General-purpose writing engines: neutral default style, broad knowledge coverage, and strong responsiveness to style instructions in prompts. Their ceiling depends on the user’s prompt design skills.
- Specialized writing engines: outstanding on a certain class of formulaic text or a particular language, sometimes with a local jump in quality, but weaker stability across subjects and languages.
The value of this framework is that selection stops being a ranking exercise. Instead, you map tasks to capability quadrants and use engineering methods to fill the gaps.
2. Breaking Down Capabilities: Four Measurable Axes
Reproducible selection decisions require turning “writes well” into observable metrics.
Instruction following and style control
This measures how well a model obeys constraints such as tone, person, pacing, and forbidden words. General-purpose models typically show “no default style,” meaning high plasticity. Some models are style-aligned and naturally carry a strong aesthetic bias, which suits genres like mystery and detective fiction that need a sense of intellect and narrative tension.Knowledge breadth and subject transfer
Models with a high share of non-synthetic data and broad corpus coverage have a higher floor on unfamiliar subjects and are less prone to setting collapse. Smaller models with less data destabilize more easily when transferring across languages and subjects.Long-range consistency
In multi-turn dialogue and long documents, the core risk is context drift: settings get forgotten, contradictions appear, and output degrades into meaningless repetition. Engineering should treat “the context window collapses easily” as a common failure mode, not a defect unique to one product.Language and style fit
English creative writing is scored differently from Chinese official documents, summaries, and templated copy. Some models produce natural English with strong intrinsic autonomy and excel at complex emotional layers such as satire, coldness, and cynicism. Others keep their English sharp and carry a formal, orthodox tone suited to fantasy epics and sci-fi worldbuilding, but are weaker in wit and improvisation.
3. Selection Methodology: From Task Profile to Model Tier
A simple scoring table turns subjective impressions into an executable process:
# Illustrative: writing task selection scoring (not a real API, decision logic only)TASK_PROFILE = {"genre": "detective", # genre: detective / report / marketing / roleplay"language": "zh", # primary language"style_strength": 0.8, # style intensity need, 0~1"turns": 12, # expected number of turns"doc_length": 8000, # target word count}def pick_engine(p):if p["turns"] >= 10 or p["doc_length"] > 6000:base = "general_long_context" # prioritize long-range stabilityelif p["style_strength"] >= 0.7:base = "style_oriented" # prioritize stylistic flairelse:base = "template_oriented" # prioritize formulaic text outputreturn base, "prompt_strategy_v2" # model tier + prompt strategy
Practical advice: limit candidates to a combination of “one general tier plus one specialized tier” and run them on the same evaluation set, rather than replacing everything globally.
4. Prompt Engineering: Extracting the Full Capability
A general-purpose model’s ceiling is set by the prompt. A four-part structure works well:
[Role] You are a rigorous technical writer; avoid exaggerated rhetoric.[Task] Expand the following points into a 1200-word solution description with 3 subheadings.[Constraints] Do not use the first person; define terms on first use; do not fabricate data.[Output format] Markdown, including one illustrative code block.
Key techniques include giving negative constraints (what not to write), providing one or two style examples (few-shot), splitting long tasks into three stages of outline, section drafting, and final consolidation, and running a consistency check after each stage.
5. Context Management and Failure Protection
Long-range collapse is a general problem. The engineering countermeasures have three layers:
- Externalize state: write character settings, glossaries, and timelines into structured external files (such as JSON/YAML) and inject them on demand each turn, instead of relying on model memory.
- Segmented summarization: apply rolling summaries to dialogue history, keeping decisions and settings while discarding redundant phrasing.
- Automated validation: use rules or a second model to check for contradictions, forbidden-word hits, and word-count deviation, and fall back to a rewrite when checks fail.
Illustrative state structure:
{"characters": [{"name": "A", "trait": "cold", "arc": "twist in chapter 3"}],"glossary": {"Term X": "definition..."},"constraints": {"forbidden": ["exaggerated adjectives"], "target_words": 1200}}
6. Quality Evaluation: Build a Regression Writing Test Set
What cannot be measured cannot be optimized. Build 30 to 50 fixed tasks covering four categories: templated text, reports, narrative, and multilingual. Use dual tracks of automated metrics plus human blind review. The automated side tracks word-count deviation, forbidden-word hits, and structural completeness. The human side scores logic, style fit, and factual consistency. Run the full set every time you change the model tier or prompt version to form a regression curve.
7. Cost and Engineering Integration
Writing workloads usually involve long inputs and long outputs and are cost-sensitive. Tiered routing helps: send templated batch tasks to a low-cost tier and key creative work to a high-quality tier. Combine caching (reuse of identical prefixes), batching, and asynchronous queues to raise throughput. For a self-built pipeline, container platforms can host inference services, object storage can hold corpora and outputs, message queues can smooth task spikes, and logging plus monitoring and alerting can track failure rates and latency. Baidu AI Cloud offers a fairly complete combination of these general capabilities and can be evaluated as needed.
8. Common Pitfalls
- Pitfall 1: assuming a stronger model alone fixes writing quality. Most instability comes from prompts that lack constraints and context that is poorly managed.
- Pitfall 2: drawing conclusions from a single impression. Writing quality has high variance and needs multiple samples and blind review.
- Pitfall 3: ignoring language differences. The best tier for the same model often differs between Chinese and English templated text and creative writing.
- Pitfall 4: mixing role-play needs with general writing in one evaluation. Their scoring functions differ and should be evaluated separately.
9. Conclusion
Selecting a writing model should shift from ranking thinking to task profiling, capability quadrants, and engineering safeguards. General-purpose engines handle breadth and plasticity, while specialized engines handle local sharpness. Prompt structure sets the ceiling, context management and automated validation set the floor, and the evaluation set determines sustainability. An AI writing pipeline built on this framework can keep output stable as subjects and languages keep changing.
