Choosing an LLM for Writing: A Reproducible Evaluation Method

    This article explains why no single large language model is best for every writing task and describes a reproducible way to compare models. It covers how to define a task profile, score output across seven dimensions, run a fixed test process with blind review, interpret results beyond average scores, and handle engineering concerns such as version tracking, data compliance, API key management, cost estimation, and fallback strategies.

    1. Why There Is No Single “Best” Writing Model

    When people discuss writing models, they often ask which model is the best. The question lacks context. Writing covers many kinds of work, including marketing copy, technical documentation, product descriptions, fiction continuation, and meeting note rewriting. Each has different requirements. A model that writes strong creative copy may not keep facts accurate in rigorous technical documentation.

    Model versions also change quickly. A conclusion that holds today may stop holding within a few months. Rankings circulating in online communities usually come from one specific test. The prompts, sampling parameters, and scoring criteria are rarely published, so the results are hard to apply to your own use case.

    The access method also affects the outcome. Calling an official API directly, calling through a third-party relay, and deploying a model in a private environment differ noticeably in latency, stability, data compliance, and cost. Your selection process should account for the access method.

    A more effective approach is to break “best” into a set of measurable indicators and test models on your own tasks.

    2. Define the Task Before Comparing Models

    Describe the task clearly before comparing models. A writing task usually includes the following elements:

    • Genre and audience: For example, an API reference for developers or a help center article for general users.
    • Length and structure: The word count range, whether subheadings are required, and whether tables or code blocks are needed.
    • Constraints: Terms that must appear, expressions to avoid, and required tone.
    • Dependence on facts: Whether the article relies on data and facts from the input material. If it depends heavily on them, factual accuracy should carry much more weight than writing style.

    Write these elements as a task profile so that all models are tested against the same standard. For example, a task might be described as: “Write a service deployment guide of about 1,000 words for backend developers. Include prerequisites, steps, and common errors. All parameters must match the input material.”

    3. Define Scoring Dimensions

    Evaluate model output on the following seven dimensions. Score each one from 1 to 5.

    1. Instruction following: Does the output meet explicit requirements for word count, structure, format, and forbidden terms? This is the easiest dimension to quantify, and a rule-based script can check it first.

    2. Factual and logical consistency: Do the numbers, step order, and cause-and-effect relationships in the output match the input material? Is the reasoning internally consistent? This dimension matters most for technical writing and usually requires manual review.

    3. Language quality: Are sentences fluent? Are terms used accurately? Does the text suit the reading habits of the target audience?

    4. Structural completeness: Does the output cover every required part of the task? Is the hierarchy clear? Are any necessary steps missing?

    5. Controllability: Across repeated calls, does the output format stay stable? If the format drifts often under the same prompt, programmatic processing becomes difficult.

    6. Cost and latency: The cost and response time of a single call. In batch production, these two factors often determine whether the approach is feasible.

    7. Failure rate: The share of outputs that are empty, truncated, refused, or clearly off-topic.

    The dimensions can conflict. For example, one model may write more vivid prose but make more factual errors. When you select a model, assign weights to each dimension based on the task profile instead of adding the scores together.

    4. Build a Reproducible Evaluation Process

    A reproducible evaluation requires fixed variables. Record the following items clearly:

    • System and user prompts: Use exactly the same text for every model.
    • Sampling parameters: Keep temperature, maximum output length, and nucleus sampling settings consistent. High temperature produces more variation, so you may lower it during evaluation and sample several times to observe the distribution.
    • Test set: Prepare at least 50 samples, grouped by difficulty into easy, medium, and hard tasks. Attach a reference answer or scoring points to each sample.
    • Blind review: Reviewers should not see model identifiers, which reduces brand bias.

    The following simplified example shows how to call models in batch, blind the labels, and summarize scores. You need to implement the call and judge functions based on your own access method.

    1. import random
    2. from statistics import mean, pstdev
    3. DIMENSIONS = ["instruction", "accuracy", "expression", "structure", "stability"]
    4. def run_eval(models, test_cases, judge, repeats=3, seed=42):
    5. """
    6. models: {model identifier: call function}. The call function takes a prompt and returns text.
    7. test_cases: [{"id": ..., "prompt": ..., "rubric": ...}, ...]
    8. judge: scoring function. It takes a test case and an output, and returns a dictionary of dimension scores.
    9. """
    10. rng = random.Random(seed)
    11. records = []
    12. for name, call in models.items():
    13. for case in test_cases:
    14. for trial in range(repeats):
    15. output = call(case["prompt"])
    16. scores = judge(case, output)
    17. records.append({
    18. "model": name,
    19. "case_id": case["id"],
    20. "trial": trial,
    21. "scores": scores,
    22. })
    23. # Blinding: shuffle the records and use only anonymous IDs during scoring
    24. rng.shuffle(records)
    25. for idx, rec in enumerate(records):
    26. rec["blind_id"] = f"S{idx:04d}"
    27. return records
    28. def summarize(records):
    29. summary = {}
    30. for rec in records:
    31. summary.setdefault(rec["model"], {d: [] for d in DIMENSIONS})
    32. for d in DIMENSIONS:
    33. summary[rec["model"]][d].append(rec["scores"][d])
    34. report = {}
    35. for model, dims in summary.items():
    36. report[model] = {
    37. d: {"mean": round(mean(v), 2), "std": round(pstdev(v), 2)}
    38. for d, v in dims.items()
    39. }
    40. return report

    The pstdev function in the code calculates the standard deviation. A model with a high standard deviation produces unstable output. Even if its average score is high, it may not be suitable for batch production.

    5. Analyze Results Beyond Average Scores

    Average scores can hide problems. When you analyze results, focus on the following three points.

    Tail failure rate: Calculate the share of samples that score below 3. If a model has a high average but fails on one tenth of the samples, those failures become support tickets that require manual handling in production.

    Group comparison: Compare results by genre and difficulty. A model may win on marketing copy and fall behind on technical explanations. Grouped results help you select models for each scenario instead of choosing one model for everything.

    Rater agreement: Have two or more reviewers score independently, and calculate an agreement metric such as Cohen’s kappa. Low agreement means the scoring criteria are vague. Revise the scoring points first, then run the evaluation again.

    6. Integration and Engineering Considerations

    After you select a model, consider the following issues during deployment.

    Version traceability: Record the model identifier, version number, call time, and parameters for every call. When a provider updates a model version, earlier outputs cannot be reproduced. Your records are the only basis for investigating problems.

    Data compliance: If the input material contains user data or internal documents, confirm that data handling during transmission and storage meets your internal policies. This is especially important when you access a model through a third-party relay.

    Key management: Store API keys in environment variables or a dedicated secrets service. Do not commit them to code repositories or print them in logs.

    Cost estimation: Estimate costs based on input and output token counts. Long documents repeat context in every call and increase cost. Summary caching or chunked processing can reduce this.

    Fallback strategy: If the primary model times out, hits rate limits, or has a service failure, the system should switch to a backup model automatically. The backup model also needs to pass the evaluation so you can confirm its output quality is acceptable.

    If your workloads already run on Baidu AI Cloud, you can run the evaluation scripts in the same network environment. This reduces latency caused by cross-network transfers and makes timing data closer to production conditions.

    7. Practical Recommendations

    Step 1: Run an A/B test with a small share of traffic. Randomly route a small portion of real requests to candidate models, and collect human feedback and business metrics. Offline evaluation cannot cover every real input, so online validation is still necessary.

    Step 2: Keep a selection record. For each evaluation, record the test set version, scoring criteria, model version, and conclusion. The value of this record is that future selections can be compared quickly without starting from scratch.

    Step 3: Re-evaluate on a regular schedule. Run the evaluation again after a model version upgrade, a change in access method, or a change in business requirements. Making re-evaluation a routine process keeps your selection conclusions valid over time.

    In short, choosing a writing model is an engineering problem, not a one-time ranking exercise. Define the task clearly, then measure it with consistent dimensions and a consistent process. Only then do the results carry real weight.