LLM Selection and Prompt Engineering: A Practical Guide to Annual Model Evaluation

    Turn annual model comparisons into a reproducible engineering process. This guide covers measurable evaluation criteria, versioned test sets, blind scoring, system-level writing constraints, task-based model routing, and regression testing to support model selection based on quality, latency, and cost.

    1. Turn Annual Model Rankings into an Engineering Problem

    Every year-end brings a wave of “model of the year” rankings. These comparisons attract attention, but their direct value to engineering teams is limited. The problem is often an evaluation method that cannot be reproduced: samples come from scattered personal conversations, weights reflect subjective impressions, and the task distribution differs from actual workloads.

    The useful lessons are the patterns repeatedly observed behind those rankings. Models have different capability profiles across writing, programming, creative frontend development, and image generation. The same model can perform very differently under different prompt constraints. What readers describe as “good writing” often combines three capabilities: strong instruction following, fewer hallucinations, and consistent style adaptation.

    This guide turns that comparison process into an actionable workflow: define evaluation dimensions, build a test set, and integrate the findings into the model invocation pipeline.

    2. Evaluation Dimensions: Convert Impressions into Measurable Criteria

    Cover at least the following six dimensions, using automated or semi-automated checks where appropriate.

    1. Instruction following: Give the model prompts with multiple hard constraints and measure the constraint satisfaction rate. Specific constraints are easier to test, such as word-count ranges, prohibited sentence patterns, required fields, and valid JSON output.

    2. Style adaptation: Provide samples of a target style and use a consistent prompt to request writing in that style. Combine human blind scoring with measurements of how often characteristic words or phrases appear.

    3. World knowledge and hallucination rate: Build factual questions with clear answers, then measure accuracy and the proportion of confidently incorrect responses. Hallucination rate deserves particular attention because it directly affects whether retrieval-augmented generation (RAG) is needed.

    4. Long-running tasks and logical consistency: Use multistep modification tasks to test whether the model preserves constraints across turns. Check whether variable names, interface signatures, or directory structures drift during the task.

    5. Frontend and interaction design: Use “generate a runnable page from a single sentence” as the task. Evaluate layout quality, responsive behavior, accessibility, and code readability.

    6. Image generation: Separate instruction-level controllability from visual impact. Controllability includes relationships between multiple objects, text rendering, and specified composition. Visual impact helps distinguish models that open new creative possibilities from those that refine existing approaches; controllability is the threshold for production use.

    3. Evaluation Sets and Pipelines: Replace Impressions with Code

    An evaluation set does not need to be large. A set of 30 to 100 cases that reflects the real workload can be sufficient. The key is to version it and include it in regression testing.

    1. # Pseudocode: a minimal model regression evaluation
    2. cases = load_cases("evalset_v3.jsonl") # Each case has a prompt, constraints, and a reference answer
    3. def run(model_client, case):
    4. out = model_client.chat(
    5. system=SYSTEM_PROMPT, # System-level constraints
    6. user=case.prompt,
    7. temperature=0.2, # Reduce randomness during evaluation
    8. )
    9. return {
    10. "case_id": case.id,
    11. "constraint_pass": check_constraints(out, case.constraints),
    12. "json_valid": is_valid_json(out) if case.expect_json else True,
    13. "score": human_blind_score(out), # Human blind scoring with model identity hidden
    14. }
    15. report = aggregate([run(client, c) for c in cases for client in clients])
    16. # Report: constraint satisfaction rate, hallucination rate, mean blind score,
    17. # average latency, and token cost

    Three practices matter:

    • Keep the temperature fixed at a low value during evaluation to improve comparability.
    • Hide model identity from human reviewers to reduce brand bias.
    • Run regression tests whenever a prompt or model version changes, so improving one case does not quietly degrade many others.

    4. System-Level Constraints for Less Formulaic AI Writing

    The recognizable “AI writing style” is often a structural problem rather than a vocabulary problem. Common patterns include overly symmetrical phrasing, mechanical “not X, but Y” contrasts, excessive em dashes, unnecessary headings, and formulaic three-part conclusions.

    An effective approach is to put explicit constraints in the system prompt and apply them consistently.

    1. You are an experienced technical writer. Hard constraints:
    2. 1. Do not use symmetrical contrast patterns such as "not X, but Y."
    3. 2. Do not use em dashes.
    4. 3. Do not output headings or lists unless the user explicitly requests them.
    5. 4. Prioritize concrete facts, data, and scenarios. Do not add generic concluding paragraphs.
    6. 5. If information is insufficient, state what is missing. Do not invent details.

    Two engineering measures make this more reliable. First, include writing samples in the few-shot portion of the prompt to anchor the target style. Second, run rule-based checks during post-processing. If the output matches a prohibited pattern, trigger a rewrite, creating a generation, validation, and rewriting loop.

    5. Task-Based Model Selection and Multi-Model Orchestration

    Using one model for every task is neither necessary nor always economical. A practical strategy is to route requests by task:

    • Send writing and knowledge-intensive tasks to models with strong reasoning and long-context capabilities.
    • Send programming and long-running refactoring tasks to models with strong coding capabilities.
    • Send creative prototypes to models that perform well on frontend design.
    • Send image tasks to models selected for controllability.

    The routing layer can combine rules with a lightweight classifier and provide shared handling for timeouts, retries, and fallbacks.

    1. def route(task_type, payload):
    2. if task_type == "code_refactor":
    3. return code_client.call(payload, max_steps=8)
    4. if task_type == "ui_prototype":
    5. return creative_client.call(payload)
    6. if task_type == "image":
    7. return image_client.call(payload)
    8. return default_client.call(payload)

    Cloud deployment can use standard service categories: object storage for evaluation sets and generated artifacts, message queues to absorb traffic spikes and decouple long-running tasks, container platforms for routing and validation services, and logging, monitoring, and alerting to track latency, failure rates, and cost.

    Baidu AI Cloud has product categories relevant to these components. Specific service selection should follow your own load-testing results, with availability checked for the intended deployment region.

    6. Common Pitfalls

    • Relying only on ranking scores: Constraint satisfaction and hallucination rates may matter more to the actual workload.
    • Using changing production prompts as the evaluation baseline: Prompt changes can invalidate historical comparisons.
    • Ignoring cost and latency: The strongest model combination may still be impractical to operate.
    • Confusing visual impact with image controllability: Impressive images do not guarantee consistently reproducible results in production.
    • Skipping regression testing: Silent model updates can gradually degrade quality without an obvious failure.

    7. Conclusion

    Annual model rankings encourage comparison. Engineering value comes from making that comparison reproducible.

    Define evaluation dimensions, version the test set, use blind scoring, enforce system-level constraints, route by task, and run continuous regression tests. Together, these six steps form a maintainable model-selection workflow. When colleagues can reproduce the findings using the same data, model selection becomes a shared team asset rather than a matter of personal preference.