LLM Inference Evaluation: Methods and Practices for Reliable Model Comparison

    This guide explains why leaderboard rankings alone can mislead model selection and introduces a four-metric evaluation framework covering accuracy, average latency, average tokens, and cost per 1,000 calls. It details how to build a 15,000-item evaluation set, key engineering practices for high-concurrency batch testing, and how to compare model versions by cost-effectiveness rather than rank. Readers will learn to turn model upgrades into reproducible, business-relevant data.

    1. Why Leaderboard Rankings Alone Can Misjudge Model Capability

    As model release cycles accelerate, developers often start by opening a leaderboard to see how much a new version scores above the previous one and where it ranks. But a ranking is highly compressed information. It hides three things that matter: whether the question distribution matches your business, whether the time taken to answer is acceptable, and how much each call actually costs.

    A new version that improves accuracy by 2.3 percentage points and moves from 6th to 2nd place sounds like pure upside. But if its average latency rises from 30 seconds to 53 seconds and its average token consumption grows from 2,000 to 3,157, then in a high-concurrency online scenario, this “upgrade” may mean lower throughput and a higher bill at the same time. Therefore, the goal of professional evaluation is not to produce a rank, but to produce a set of explainable, reproducible data that can be converted into business cost.

    2. Strict Definitions of a Four-Metric System

    It is recommended to fix evaluation metrics into four categories and test every model version with the same definitions so that comparisons are meaningful.

    • Accuracy (overall score): the number of correct answers divided by the total number of questions. You need to specify whether the judging rule is exact match, numerical tolerance, or scoring by a judge model. Once the rule is set, it cannot be changed midway.
    • Average latency: the wall-clock time from sending a request to receiving the complete response for a single call, including network and queueing, rather than only the generation phase.
    • Average tokens: the sum of input and output tokens for a single call, used to measure context utilization efficiency rather than model “intelligence.”
    • Cost per 1,000 calls: a derived value calculated from the output price and average tokens. The unit is unified to CNY per million tokens before conversion, making cross-version comparison easier.

    The illustrative conversion logic can be written as:

    1. # Illustrative cost conversion with a unified standard
    2. def cost_per_1k_calls(avg_tokens, input_price, output_price, out_ratio=0.5):
    3. """
    4. avg_tokens: average total tokens per call
    5. input_price / output_price: CNY per million tokens
    6. out_ratio: estimated share of output tokens in total tokens
    7. """
    8. out_tokens = avg_tokens * out_ratio
    9. in_tokens = avg_tokens - out_tokens
    10. per_call = (in_tokens * input_price + out_tokens * output_price) / 1_000_000
    11. return per_call * 1000

    3. How to Build an Evaluation Set of Over 10,000 Questions

    A scale of about 15,000 questions is not for show; it is to make the confidence interval narrow enough. If there are only a few hundred questions, a 2-percentage-point difference is very likely within the noise range. Three principles are recommended when building the set:

    1. Stratified sampling. Bucket by task type (reasoning, code, long-text understanding, structured output), difficulty, and input length. The proportion of each bucket should align with real business traffic, not be evenly distributed.
    2. Fixed random seeds and version snapshots. Questions, reference answers, and judging scripts should all be placed under version control to ensure results remain comparable when rerun three months later.
    3. Anti-contamination and anti-memorization questions. Regularly replace part of the question set and observe whether scores show abnormal jumps, in order to identify evaluation set leakage.

    4. Engineering Essentials at the Execution Level

    Evaluation itself is a high-concurrency batch processing task, and the engineering implementation directly determines data credibility.

    • Concurrency and rate limiting: fix and record the concurrency level; otherwise, latency metrics will be amplified by server-side queueing and lose comparability.
    • Retry strategy: retry only on timeout and rate-limit errors, and do not retry semantic errors, to avoid “score inflation.”
    • Structured output constraints: require the model to return fixed fields, and count parsing failures separately rather than silently marking them as wrong answers.
    • Full-chain logging: save request IDs, latency, token usage, and raw output for later review.
    1. # Batch evaluation skeleton (illustrative)
    2. for batch in chunk(dataset, size=200):
    3. with ThreadPoolExecutor(max_workers=CONCURRENCY) as pool:
    4. results = list(pool.map(run_one_case, batch))
    5. record(results) # Persist: latency, tokens, judging results

    5. How to Correctly Read New vs. Old Version Comparisons

    When comparing the previous generation with the new one, output a four-column table: accuracy, average latency, average tokens, and cost per 1,000 calls, and calculate the pairwise differences. When interpreting, look at three points: whether the accuracy improvement exceeds evaluation noise (empirically, less than 1 percentage point is not enough to support a conclusion); whether efficiency metrics have worsened; and divide accuracy by cost to get “accuracy gained per unit of cost,” which is the cost-effectiveness that selection truly cares about.

    If the new version has higher accuracy but latency and tokens rise at the same time, a reasonable strategy is tiered routing: send simple requests to a lightweight configuration and complex requests to the new version, using rules or a lightweight classifier for upfront judgment, thereby balancing overall accuracy and total cost.

    6. Common Pitfalls and Conclusion

    Pitfalls include: reporting only accuracy without cost; comparing different versions with different question set sizes; treating average latency as a fixed value while ignoring the long tail (P95 should be examined as well); and ignoring the dominant effect of output length on cost. A reproducible evaluation process should be: fixed question set and judging rules, fixed concurrency and retries, unified metric definitions, versioned logging, and decisions based on cost-effectiveness rather than ranking. Once this process is established, any model upgrade can be quickly converted into business language, rather than an isolated rank.