Evaluating Large Language Models: A Three-Step Approach to Testing, Cost, and Ecosystem

    Selecting the right Large Language Model (LLM) requires more than just looking at leaderboard scores. This article introduces a three-step evaluation framework: verifying task fit with a custom test set, calculating inference costs and compliance boundaries, and assessing ecosystem adaptability. It details a four-dimensional evaluation method covering instruction following, long context processing, cost and latency, and ecosystem engineering costs, along with common pitfalls to avoid during model selection.

    Conclusion First

    Model selection follows three steps: first, verify task alignment using a custom test set; second, calculate costs and data compliance boundaries; and finally, evaluate migration costs. Leaderboard scores can help narrow down candidates but cannot replace these three steps.

    1. Why You Need Your Own Test Set

    The LLM market is crowded with frequent releases. A model ranking high on a leaderboard does not necessarily mean it is suitable for your business. Leaderboard test questions, prompt templates, and scoring methods often differ from real-world scenarios. Therefore, the first step in model selection is shifting from “who ranks first” to “how it performs on my specific tasks.”

    This article does not endorse any specific model. The methods, formulas, and checklists provided here apply to any candidate model—your own test results should be the ultimate guide.

    When building a custom test set, extract real requests from production logs, stratify them by task type, and retain a certain number of samples per category. Samples should include both common requests and edge cases prone to errors. The test set must be updated regularly as business needs evolve, otherwise, it will gradually lose its representativeness.

    2. Four-Dimensional Evaluation Method

    1. Reasoning and Instruction Following

    Instruction-following capabilities can be tested using format constraints. For example, require the model to output a JSON object with fixed fields, and track the ratio of three types of issues: missing fields, type errors, and extra text outside the JSON. Prompt templates should have a fixed version number applied uniformly across all candidate models to avoid erroneous conclusions caused by prompt variations.

    A reusable test instruction example is as follows:

    “Please output only a JSON object containing the fields name (string), age (integer), and tags (array of strings). Do not output any explanatory text.”

    Multi-step reasoning can be tested using questions with standard answers, tracking the final answer accuracy. Code generation should be measured by unit test pass rates, not just whether the code looks reasonable.

    2. Long Context Processing

    Long context capabilities require testing in two categories.

    The first is information location. Embed key facts into a lengthy document and check if the model can find them when queried. This type of test is highly automatable and can be run in batches.

    The second is factual consistency. Ask the model to summarize a long document, then verify whether the facts in the summary originate from the source text. This is more labor-intensive and should follow these steps:

    1. Stratified sampling: Stratify by document length, domain, and type, randomly sampling from each layer. You can start with 10 to 20 documents, though this is an initial sample size, not a fixed standard.
    2. Item-by-item labeling: Break the summary into independent facts, labeling each as “Supported by text,” “Unsupported by text,” or “Contradicts text.” Two reviewers should label independently, with a third resolving disagreements.
    3. Error classification: Analyze which document types and fact types (e.g., numbers, dates, entities, or causal relationships) have concentrated errors.
    4. Determine whether to expand the sample: If error rates for a specific document type are significantly high, or the gap between two candidate models is close to the labeling error margin, expand the sample to dozens or even hundreds of documents before making a judgment.

    3. Inference Cost and Response Speed

    Costs can be estimated using the following formulas:

    Cost per request = Input token count * Input unit price + Output token count * Output unit price

    Actual monthly cost = Cost per request * Average daily requests * 30 * (1 + Retry rate)

    Before using these formulas, clarify the following metrics:

    Unit price: Use the vendor’s current price list, recording the query date, currency, and billing unit (per million tokens or per thousand tokens). Prices may change, so note the date in your report.

    Length statistics: Track input and output separately, taking both the average and the 90th percentile. Looking only at the average will underestimate long-tail request costs.

    Cache hits: If the service supports context caching, calculate cached portions at the cache unit price. For businesses with long system prompts, caching impact may exceed the unit price difference between models.

    Batch discounts: If the service offers a batch API, confirm its latency commitments and discount conditions before including it in cost calculations.

    Failed retries: Timeouts, rate limits, and format errors trigger retries, and retried tokens are also billed. Calculate the retry rate directly from your logs.

    Output unit prices are often higher than input unit prices, so they must be tracked separately rather than combined into a single total.

    For latency, focus on two metrics. Time to First Token (TTFT) determines how long users wait to see the first word, while Tokens Per Second (TPS) determines the completion speed of long responses. When testing, record concurrency and request length, otherwise, the numbers cannot be compared fairly.

    4. Ecosystem Adaptability

    Ecosystem adaptability is primarily about engineering costs. Confirm the following:

    • Does it support the inference framework you currently use?
    • Is the API compatible over time, and what is the notification period for version upgrades?
    • Are fine-tuning tools and documentation provided?
    • How much does quality degrade after quantized deployment? Compare pre- and post-quantization results using the same test set.

    Toolchain richness directly impacts development time, but its importance depends on the team’s technical capabilities. Smaller teams value documentation and managed services more, while teams with DevOps capabilities prioritize framework support and deployment flexibility.

    3. Common Mistakes in Evaluation

    The following errors are most common in model selection evaluations:

    • Using leaderboard scores instead of custom tests;
    • Sample sizes too small, drawing conclusions when two models differ by just a few percentage points;
    • Testing only once without recording the model version, prompt version, and test date;
    • Ignoring caching, retries, and long-tail requests during cost testing;
    • Treating vendor-provided or article thresholds directly as procurement standards.

    Every evaluation should leave a record. The table below is an example evaluation record template; fields can be added or removed based on business needs.

    Field Example Description
    Model Version Specific version number from vendor Different versions of the same model may yield different results
    Prompt Version v1.3 Prompt changes affect results
    Sample Size 300