Evaluating LLM Version Upgrades: Balancing Accuracy, Latency and Cost

    Vendor benchmark gains rarely tell engineering teams everything they need before a model upgrade. This article explains how to evaluate a new LLM version by measuring accuracy, response time, token usage and unit call cost side by side. It covers metric definitions, a consistent test workflow, a Python example for summarizing results, and a rollout plan.

    1. Why Version Upgrades Should Not Be Judged by Accuracy Alone

    When a new model version is released, vendors usually publish gains in composite scores. For engineering teams, however, accuracy is only one dimension of the decision. How long a single call takes, how many tokens it consumes, and how much it ultimately costs also determine whether the new version can go into production.

    A gain of a few percentage points in accuracy may come with slower responses, longer outputs, or higher unit cost. If a team looks only at the score, it may unknowingly double its inference cost or noticeably lengthen user wait times. Version evaluation should therefore track effectiveness, latency and cost together, and compare all three in the same table.

    2. Definitions of the Four Core Metrics

    2.1 Accuracy

    Accuracy is the proportion of questions a model answers correctly on a standard test set. It is calculated as follows:

    Accuracy = Number of correct answers / Total number of questions × 100%

    A composite accuracy score can hide structural changes, so accuracy should also be broken down by business domain. Common dimensions include mathematics and reasoning, language understanding and instruction following, tool calling, and domain-specific question answering. A decline in one domain may be offset by gains in others, but it can still be critical for the business. For example, if a customer service system relies on tool calling, even a small regression in tool-calling ability needs to be evaluated separately.

    2.2 Response Time

    Response time is usually recorded as the time a single call takes, from sending the request to receiving the complete output. Reports should distinguish between averages and percentiles. Averages are easily pulled up or down by a few extreme samples. P50, P90 and P99 better reflect the experience of typical users and tail users.

    Response time is affected by output length, service load, network conditions and inference strategy. The same model may show very different latency at different times of day. Tests should therefore be repeated under similar conditions where possible, and the test time should be recorded.

    2.3 Token Consumption

    A token is the basic unit a model uses to process text. Both input and output tokens count toward consumption. The average number of tokens per call directly determines cost and also indirectly affects latency.

    Token consumption can rise for two common reasons. The first is longer output, for example when the model gives a more detailed reasoning process or a more complete explanation. The second is that the model takes more intermediate steps, such as multiple rounds of self-checking or step-by-step derivation. The two reasons have different business implications. The first may only affect readability, while the second directly affects cost and latency. When evaluating, check the output content to decide whether the extra token usage is worth it.

    2.4 Unit Call Cost

    Unit cost is usually expressed as the cost per 1,000 calls, which makes comparisons across models easier. Calculations must consider both the unit price and the measured token consumption, not only the list price. Two versions with the same list price can have very different actual costs if their average token consumption differs widely.

    3. Test Set Construction and Evaluation Workflow

    Reliable evaluation depends on consistent test conditions. The recommended workflow is as follows:

    1. Define the evaluation scope: Select test sets based on the business scenario, covering the core task types. General-purpose test sets suit horizontal comparison, while private business test sets better reflect real-world performance.
    2. Fix test parameters: Keep parameters such as temperature, maximum output length and system prompt the same across all versions. Inconsistent parameters make comparisons meaningless.
    3. Record raw data: Save the input, output, correctness, latency and token usage of every sample, so results can be reviewed and spot-checked later.
    4. Run repeated tests: For outputs with randomness, sample each item multiple times and take the average or compute confidence intervals.
    5. Calculate metrics consistently: Use the same set of scripts to calculate metrics for all versions, avoiding bias from different calculation methods.

    The size of the test set involves trade-offs. A sample set that is too small makes results sensitive to individual questions. A sample set that is too large significantly increases testing cost and time. For test sets with tens of thousands of questions, stratified sampling can ensure that every domain has enough samples.

    4. Metric Summary and Cost Calculation

    4.1 Distinguish Percentage Points from Relative Change

    When accuracy rises from 68.0% to 71.0%, describe it as an increase of 3.0 percentage points, not an increase of about 4.4%. Percentage points describe the absolute difference, while relative change describes the proportional change. Mixing the two can lead readers to overestimate or underestimate the improvement. Changes in latency, tokens and cost are better expressed as relative changes, for example “average latency increased by about 60%.”

    4.2 Cost Calculation Formulas

    The formulas for per-call cost and cost per 1,000 calls are as follows:

    Per-call cost = Average token consumption × Unit price (yuan per token)
    Cost per 1,000 calls = Per-call cost × 1000

    Unit prices are usually quoted per million tokens, so pay attention to units during conversion. Input and output prices may differ. If the ratio of input to output tokens varies widely, calculate each separately and then add them together.

    4.3 Example Code

    The example below shows how to summarize accuracy, latency and token usage from test logs, and how to calculate cost. The data and prices are fictional and only illustrate the calculation method.

    1. from statistics import mean
    2. def summarize(records, price_per_million):
    3. """Summarize accuracy, latency, token usage and cost per 1,000 calls for a set of test records.
    4. records: list of dicts, each containing correct (bool), latency_s (float) and tokens (int)
    5. price_per_million: unit price per million tokens (yuan)
    6. """
    7. if not records:
    8. raise ValueError("records must not be empty")
    9. n = len(records)
    10. accuracy = sum(1 for r in records if r["correct"]) / n
    11. avg_latency = mean(r["latency_s"] for r in records)
    12. avg_tokens = mean(r["tokens"] for r in records)
    13. cost_per_call = avg_tokens * price_per_million / 1_000_000
    14. cost_per_1k_calls = cost_per_call * 1000
    15. return {
    16. "accuracy_pct": round(accuracy * 100, 2),
    17. "avg_latency_s": round(avg_latency, 2),
    18. "avg_tokens": round(avg_tokens, 1),
    19. "cost_per_1k_calls_yuan": round(cost_per_1k_calls, 2),
    20. }
    21. # Example: comparing two sets of fictional data
    22. old_records = [
    23. {"correct": True, "latency_s": 40.0, "tokens": 2800},
    24. {"correct": False, "latency_s": 55.0, "tokens": 2900},
    25. ]
    26. new_records = [
    27. {"correct": True, "latency_s": 90.0, "tokens": 4000},
    28. {"correct": True, "latency_s": 100.0, "tokens": 3900},
    29. ]
    30. print(summarize(old_records, price_per_million=10))
    31. print(summarize(new_records, price_per_million=10))

    The key point in the code is that metric calculation is centralized in one function, and all versions use the same calculation rules. The output can be entered directly into a comparison table, which reduces the chance of manual calculation errors.

    5. Interpreting Results: Balancing Multiple Goals

    After summarizing the metrics, the key decision is whether the benefits justify the costs. Consider the following questions:

    • Effectiveness gains: Where do the improvements concentrate? Are those domains related to core business scenarios?
    • Latency cost: Do average and tail latencies exceed what the product can accept? Asynchronous tasks can tolerate longer response times, while real-time interactive scenarios cannot.
    • Cost impact: How much does the cost per 1,000 calls increase? Based on the expected call volume, how much does the monthly cost change?
    • Risk changes: Has any domain declined? How important is the declining domain to the business?

    A common mistake is judging by the composite score ranking alone. A rise of several positions does not mean the new version is better in every scenario. Another mistake is ignoring tail latency. The average may look acceptable while some users experience long waits.

    6. Common Pitfalls

    First, mixing results from different test sets. Question formats and difficulty vary widely across evaluation sets, so scores cannot be compared directly across sets.

    Second, overlooking parameter differences. Differences in temperature, output limits and other settings can significantly change token consumption and lat