How to Evaluate LLMs: Quality, Latency, and Cost

    Choosing between generations of large language models often feels inconclusive: benchmark claims show broad gains, yet hands-on testing with a few everyday tasks reveals no visible difference in output quality. That gap is usually an evaluation problem, not a perception problem, because informal trials rely on tiny samples, easy tasks, and vague criteria. This article breaks model selection into three independently measurable dimensions—output quality, latency, and cost—and shows how to turn them into numbers that support a decision. It covers a composite quality index with cross-validation, treating safety as a pass/fail gate, layered sample sets, single-response output caps and per-turn token overhead as the real latency drivers, price normalization and total cost estimation, and a reusable selection workflow built on a unified adapter layer and observable metrics.

    1. Why “It Feels the Same in Testing” Is a Common Misjudgment

    Many developers feel a letdown after trying a new generation of large language models: the marketing material claims improvements across every metric, but a handful of daily tasks produce output that looks no better than the previous generation. The letdown is not an illusion—the evaluation method is at fault. Casual trials use very small samples, low task difficulty, and fuzzy pass criteria, so the real differences between models are drowned out by noise.

    To see the gap clearly, split the vague question “is it good enough?” into three questions that can be checked independently: is the delivered output good enough, how long do you wait, and what does it cost in total. These three pull against each other in almost every evaluation—higher scores usually cost more, and cheaper models usually need another round of edits. The real engineering work is to break them into numbers that do not interfere with one another, then reassemble them into a plain statement that can guide a decision.

    2. Dimension One: Quantifying Output Quality

    Output quality should not be reduced to a single leaderboard score. It is closer to a composite index: several sub-items combined with weights, cross-validated against benchmarks that multiple models complete under the same conditions. Two things matter when judging the result—the size of the gap in the composite index, and the distribution of wins and losses across sub-items.

    A typical finding looks like this: the leading model scores about 57.8 on the composite index versus about 56.4 for the other, a relative gap of roughly 2.5%; the leader wins four of six sub-items, and the win/loss ratio is 3:1 across the four benchmarks both models completed. In engineering terms, the lead is real but small, and it falls inside the “user-imperceptible range” for most business scenarios. If your product is extremely sensitive to errors, 2.5% may be worth paying for; if the workload is internal scripts and draft copy, that premium is nearly impossible to recover.

    Notably, the one sub-item where the leader is overtaken is often safety. This suggests that general capability and alignment performance do not improve in lockstep, and that safety trade-offs affect the total score independently. During selection, treat safety as a gate rather than a bonus: a model that fails it should be eliminated no matter how high its total score is.

    For practical evaluation, use a layered sample set:

    1. Layered sample set (example)
    2. ├── L1 high-frequency short tasks (60%): classification, extraction, rewriting
    3. ├── L2 medium reasoning tasks (30%): multi-step calculation, code completion
    4. └── L3 long-context tasks (10%): cross-document summarization, whole-repo understanding
    5. Rule: 3 repetitions per sample; report pass rate and the median of human ratings

    3. Dimension Two: Where Latency Really Diverges

    “Who types faster” barely affects delivery time. The real dividing lines are two things that are often overlooked: how much can be delivered in a single response, and how long each turn of the conversation runs.

    The first is the single-response output cap. If one side caps at about 1.05M tokens and the other at about 128K tokens, the gap is roughly 8.2x. For a 200K-token deliverable, the first model writes it in one pass, while the second must split it into two serial generations—adding a full round trip, a context re-transmission, and a concatenation check. End-to-end time does not grow linearly; it is amplified by the number of round trips.

    The second is per-turn token deviation. If one model emits 6–11x the tokens of the median model per turn, it says more for the same task, so generation time and billing rise together. This is especially damaging in interactive products: users wait for the first token and the complete paragraph, and redundant length turns directly into perceived lag.

    Engineering measures that help include: split long tasks explicitly and define a contract for each segment, turn off verbose explanations on non-critical paths, and use streaming output with time-to-first-token as the experience metric instead of total elapsed time.

    1. def plan(goal_tokens: int, cap: int) -> list[int]:
    2. # Split by the single-response output cap so limits are caught before runtime
    3. n = (goal_tokens + cap - 1) // cap
    4. base = goal_tokens // n
    5. plan = [base] * n
    6. for i in range(goal_tokens - base * n):
    7. plan[i] += 1
    8. return plan

    4. Dimension Three: Calculate Cost by List Price and Structure

    Cost comparisons must use a consistent basis. Take a common pricing structure as an example: input at 8 versus 2, output at 40 versus 10, cached input at 0.40 versus 0.10—all three are exactly 4x apart. Such tidy multiples mean the gap comes from pricing strategy rather than capability, and that cost optimizations (cache hits, context trimming, batching) pay off in the same proportion on both sides.

    A real bill should be estimated by the structure below, not by unit price alone:

    1. Cost per task ≈ input tokens × input price + output tokens × output price
    2. + cache-hit tokens × cache price + retries × cost per call

    Put the three dimensions together and the conclusion is not “which model is stronger” but a choice about budget allocation: spend on quality, or spend on the bill. If the task sits in L3 long-context work and is sensitive to rework, the hidden savings from a higher output cap and a lower rework rate often outweigh the list-price premium; if the task is L1 high-frequency short work, a 4x price advantage is amplified quickly by call volume.

    5. A Reusable Selection Workflow

    1. Define the gates: safety, data compliance, and a minimum context length. Failing any one means immediate exclusion.
    2. Build a layered sample set and an automated scoring script, with fixed repetition counts and scoring criteria.
    3. Measure the composite index, the single-response output cap, per-turn token deviation, and the three list prices separately.
    4. Recompute using end-to-end latency and total cost instead of concluding from unit price.
    5. Decouple through an abstraction layer: wrap the call interface uniformly, keep the ability to switch, and avoid binding business code to a single implementation.
    1. class ModelAdapter:
    2. def complete(self, prompt: str, max_tokens: int) -> str: ...
    3. def metrics(self) -> dict: ... # latency, token usage, cache hits

    In related practice at Baidu AI Cloud, this combination of “unified abstraction + observable metrics + layered evaluation” is fairly common: log services and monitoring alerts collect latency and token usage, a container platform runs the evaluation jobs, and selection becomes an engineering process that can be recomputed rather than a matter of subjective feel. In the end, you will find that in most scenarios the new generation’s improvement is real but limited in magnitude, and whether it is worth paying for depends on your task layers and call volume—not on the marketing claims.