LLM Model Comparison: A Practical Selection Methodology After Spending $140 on API Tests

    Choosing the "best" LLM is not the same as choosing the right one for your application. This article shares a reproducible evaluation methodology covering scenario weighting, test set construction, prompt templates, scoring rubrics, and cost accounting. It also highlights three common pitfalls and explains why layered routing is often more reliable than betting on a single model.

    1. Why the “Best Model” Is Not Always the Best Fit

    As general-purpose LLMs iterate quickly, claims of a “new state-of-the-art model” appear every few weeks. From an engineering perspective, however, model capability is a multi-dimensional vector, not a single scalar. A model that excels at long-context understanding may be weaker at producing stable structured output. A model that leads in code generation may drift when following instructions across multiple turns.

    A serious comparison therefore starts with a clear goal: are you picking the leaderboard champion, or the engineering component that performs best across your own workload distribution? The former is media narrative; the latter is a technical decision.

    2. Three Preparation Steps Before Evaluation

    2.1 Define Scenario Weights

    Break your business scenarios into capability items and assign weights. For example:

    • Long-context information extraction: 25%
    • Structured output (JSON/tables) stability: 25%
    • Code generation and bug fixing: 20%
    • Multi-turn instruction following and self-correction: 20%
    • Cost and latency: 10%

    Once the weights are fixed, scoring no longer depends on subjective impressions.

    2.2 Build a Reproducible Evaluation Set

    The evaluation set should contain three types of samples: real business samples (after de-identification), boundary samples (very long inputs, ambiguous instructions, conflicting constraints), and adversarial samples (hallucination-inducing prompts, prompt injection). Include at least 20 items per category so the conclusions carry statistical meaning.

    2.3 Fix Inference Parameters

    Temperature, maximum output length, system prompt, and retry policy must be identical across runs. Otherwise you are measuring sampling randomness rather than model differences.

    3. Prompt Template: The Core Asset for Reproducibility

    An evaluation prompt needs five sections: role + input + constraints + output format + failure handling. Example:

    1. Role: You are a senior data engineer.
    2. Task: Extract fields from the text below and output JSON.
    3. Constraints:
    4. 1) Use only information present in the text; fill missing fields with null;
    5. 2) Output nothing except the JSON;
    6. 3) Normalize all timestamps to ISO 8601.
    7. Failure handling: If information conflicts, output {"error":"conflict"} and explain in notes.
    8. Input:
    9. <place the text under evaluation here>

    Feeding the same template to every candidate model is the prerequisite for a fair comparison.

    4. Scoring Rubric: Turning Subjective Feelings into Computable Metrics

    Use a 1–5 scale and set “veto” rules for critical items. For instance, a single JSON parse failure on structured output deducts 2 points, because output that cannot be parsed has zero engineering value.

    Dimension Weight Key Criteria
    Factual consistency 25% Whether information absent from the input appears
    Structural compliance rate 25% JSON parse success rate, field completeness
    Instruction following 20% Proportion of constraints satisfied
    Code usability 20% Whether it runs, whether it passes basic test cases
    Cost and latency 10% Average time and API spend per task

    5. Cost Accounting: Look Beyond Unit Price

    Real cost = input and output token consumption × unit price + retry cost + manual review cost. Many teams ignore the third item. If a cheaper model requires 30% manual rework, its total cost may actually be higher. Record the actual token count of each call to build your own cost baseline instead of quoting external prices.

    6. Three Pitfalls I Hit

    First, inconsistent model version naming led to evaluating the wrong target and invalidating an entire round. The fix is to record the version identifier and timestamp at call time and lock them into the report.

    Second, an evaluation set that did not match the business distribution caused online results to diverge from evaluation conclusions. The fix is to sample the evaluation set from real logs.

    Third, looking only at average scores while ignoring variance. Engineering is more afraid of instability; high-variance models require additional fallback paths.

    7. Deployment Advice: Layered Routing Instead of a Single Bet

    A mature approach is usually layered routing: send simple tasks to low-cost models, escalate complex tasks to higher-capability models, and add one validation-and-retry pass for structured output. This architecture optimizes cost, latency, and stability at the same time, and avoids being tied to the capability fluctuations of a single model.

    8. Conclusion

    The real value of an expensive comparison is not announcing a winner, but building evaluation assets your team owns: scenario weights, an evaluation set, prompt templates, a scoring rubric, and a cost baseline. To further engineer this workflow, you can combine it with general capabilities such as container platforms, log services, and monitoring and alerting offered by Baidu AI Cloud, turning the evaluation pipeline into a sustainable automated stage.