Reproducible LLM Evaluation: How to Measure Quality, Latency, Tokens, and Cost

    This article outlines a practical, reproducible method for evaluating large language models before launch. It explains how to align test sets with business tasks, define reviewable accuracy metrics, analyze latency distributions, calculate token and task costs, compare models within the same budget tier, avoid common interpretation biases, and archive experiment conditions so results can be verified later.

    Before an LLM goes live, teams often fall into one of two extremes: they look only at composite scores from marketing materials, or they rely on the subjective impression of a single manual trial. For developers and enterprise users, the real questions are different: Is accuracy stable on tasks close to the business workload? How long does an end-to-end request take? How many input and output tokens does each call consume? At an acceptable budget, is the quality worth it? Measuring these four dimensions separately is closer to an engineering decision than chasing a single ranking.

    Align evaluation with the business, not the leaderboard

    Composite accuracy is useful, but it is a weighted result. Education Q&A, multi-step reasoning, financial calculation, and health consultation fail in very different ways. Some errors are factual, some are procedural, and some involve units or boundary conditions. If the domain distribution of the question set does not match real traffic, a high total score says little about production performance.

    Start by writing an evaluation contract and fixing at least the following conditions:

    • Task scope: cover only the scenarios that will be launched, not “all capabilities.”
    • Language and style: written Chinese, spoken Chinese, tables, and code snippets should be counted separately.
    • Input-length buckets: sample short questions, long documents, and multi-turn context separately so that average length does not hide important differences.
    • Output constraints: whether structured fields, citations, refusals, or clarifications are required.
    • Scoring rules: exact match, key-point coverage, numeric tolerance, and the human spot-check ratio.
    • Runtime environment: concurrency, timeout, retry, temperature-like sampling parameters, and whether the system prompt is locked.

    The same question set can produce noticeably different scores under different sampling parameters. Without recording these conditions, versions cannot be compared, and cross-provider comparisons are even less meaningful.

    Define accuracy in a way that can be reviewed

    “Correct” must be verifiable by a third party. Open-ended answers are better scored with a key-point checklist plus deduction items than with an overall impression score. Numeric and reasoning questions should specify tolerance, units, and required intermediate steps. For questions involving professional advice, add a separate check for whether the model oversteps by giving a definitive conclusion, so that fluent wording does not hide an error.

    Reporting three numbers is more informative than reporting only a total score:

    1. Overall accuracy: correct questions divided by valid questions. Timeouts and empty outputs should be recorded separately as failures or exclusions, with the definition stated explicitly.
    2. Domain accuracy: at least by business domain and difficulty level, to identify whether weaknesses are concentrated in one category.
    3. Improvement: describe the difference between the old and new versions in percentage points, and state whether the question set is exactly the same. If the question set changes, percentage points cannot be subtracted directly.

    If a domain was previously weak and the new version improves most there, prioritize error analysis rather than immediately declaring a “comprehensive win.” A common pattern is more stable formatting and more complete steps, while long-tail facts remain wrong. Classify errors into factual errors, calculation errors, instruction-following failures, and excessive refusals. That classification gives later prompt optimization or routing strategies something concrete to work with.

    The summary logic can be simple; what matters is that the definitions stay fixed:

    1. valid_calls = total_questions - questions_excluded_due_to_platform_failure
    2. accuracy = correctly_judged_questions / valid_calls
    3. domain_accuracy = correctly_judged_questions_in_domain / valid_calls_in_domain
    4. improvement_percentage_points = new_version_accuracy - old_version_accuracy

    Human spot checks should be stratified by domain, not limited to high-scoring samples. The agreement rate between automatic and human scoring is itself a metric. If agreement is too low, fix the scoring standard before comparing models.

    Look at latency distributions, not only averages

    Average latency hides the long tail. When a preview or new version first launches, a sudden increase in traffic can cause queuing; longer average latency does not necessarily mean the model itself is slower. Evaluation reports should distinguish:

    • Server-side queuing versus client-side waiting;
    • Time to first token versus full response time;
    • Successful requests versus time after timeout and retry;
    • Low-concurrency baseline versus target peak concurrency.

    Percentiles are more useful for engineering: the median reflects typical experience, while P95 and P99 show whether the system is suitable for an interactive product. Batch workloads can tolerate tens of seconds or more, but they still need timeouts and idempotency to prevent retries from multiplying cost. For interactive scenarios, compare “slow but more complete” and “fast but requiring a follow-up question” by total completion time for the same user task, not just by a single API call.

    If the new version appears slower on average, run a controlled experiment first: fix concurrency, time window, and output-length cap, then determine whether the cause is load, longer output, or a heavier inference path. Longer output raises both latency and cost, a point that reappears in the cost model below.

    Put tokens and cost on the same bill

    Call cost is usually not just a single model unit price. Break it down at least into:

    • Input tokens: system prompt, retrieved chunks, conversation history, and user question;
    • Output tokens: the answer body, and sometimes whether reasoning traces are billed. This must follow the billing documentation in effect at the time and should not be assumed;
    • Failures and retries: timeout retries may repeat input tokens;
    • Ancillary calls: retrieval, safety checks, and format validation, if billed separately, should count toward total task cost.

    When comparing two versions, “cost per 1,000 successful tasks” is often closer to the budget than “price per million tokens.” A lower unit price with more output tokens can still increase task cost. The following relationship can be used for sensitivity analysis; the variables are illustrative symbols only and do not represent any real quote:

    1. cost_per_call ≈ input_tokens × input_unit_price + output_tokens × output_unit_price
    2. cost_per_1k_tasks ≈ 1000 × cost_per_call × (1 + extra_retry_rate)

    Reports should list average input tokens, average output tokens, retry rate, and cost per 1,000 tasks together. When cost rises, this makes it possible to determine whether the cause is a price change, longer context, or failed retries. Context governance—trimming history, caching stable system prompts, and retrieving only necessary chunks—often reduces cost more effectively than switching models.

    Compare within the same cost tier, not across tiers

    Putting an expensive, strong model and a cheap, fast model on the same ranking often produces conclusions that cannot be acted on. A better approach is to group candidates by “budget per 1,000 tasks” first, then compare accuracy, minimum acceptable thresholds in key domains, and tail latency within the same tier.

    The decision can be written as constrained optimization rather than a slogan:

    • Hard constraints: accuracy in key domains must not fall below the business threshold, P95 latency must not exceed the interactive limit, and data must not leave the agreed boundary.
    • Objective: among candidates that satisfy the constraints, minimize cost per 1,000 tasks, or maximize accuracy in key domains within the cost cap.
    • Observables: output length, refusal rate, and format failure rate. Format failures can turn a “high score” into an online parsing failure.

    Within a tier, a solution is clearly superior only if it has both higher accuracy and lower cost. If accuracy is higher but cost and latency also rise, route by task: send high-risk, low-volume work to the quality-first option; send high-volume, fault-tolerant work to the cost-first option; use routing when necessary instead of switching everything.

    Common biases when interpreting results

    A new version that has “just launched and is under high load” can distort latency and failure rates. Retest after traffic stabilizes, and keep the first test record for comparison. Conclusions from Chinese-language scenarios cannot automatically be extrapolated to other languages or highly specialized corpora. The question count must be large enough to cover the long tail; otherwise, changes across a few dozen questions in one domain are just noise.

    Also beware of prompts that are tightly coupled to a model. Prompts tuned for an old version and applied directly to a new version may underestimate the new version or overestimate the old one. A fair comparison should allow an equivalent prompt-optimization budget for each side, record the number of optimization rounds, and avoid unlimited tuning that favors only one side.

    Safety and compliance are not optional extras. In medical, financial, and similar scenarios, even if accuracy improves, teams still need to assess whether the model gives definitive advice it should not give and whether it leaks sensitive information from the context. These failures should not be diluted by a total score.

    A practical experiment record

    For each evaluation, archive at least: question set version and hash, scoring script version, sampling and length parameters, concurrency and timeout, start and end time, success and failure counts, domain accuracy, latency percentiles, input and output tokens, retry count, and cost calculated from the published pricing in effect at the time, including the pricing effective date. Prices change, so reports must be tied to a date; otherwise, results cannot be verified later.

    After launch, do not stop at offline scores. Use logs and monitoring to feed online samples back into the same scoring pipeline and observe distribution drift: longer user questions, a changed domain, or a silent model version upgrade can all invalidate offline conclusions. Alerts can track three signals: key-domain accuracy falling below threshold, P95 latency exceeding the limit, and cost per 1,000 tasks remaining above budget for consecutive periods.

    Summary

    Quality, latency, tokens, and cost are four projections of the same decision. Reproducible question sets and scoring, domain-level rather than total-only reporting, percentile-based latency analysis, task cost rather than unit price alone, and comparison within the same budget tier can turn “is the new version stronger?” into an executable engineering conclusion. Preview-period speed fluctuations, changes to the question set, and unfair prompt tuning can all distort rankings. Documenting the experiment conditions in the report is more valuable than claiming a few more percentage points.