How to Evaluate LLMs: Quality, Latency, and Cost
Choosing a large language model often starts with a misleading impression that the new generation feels no different from the previous one. This article breaks model selection into three independently measurable dimensions—delivery completeness, end-to-end latency, and total cost—and shows how to quantify each one. It covers a three-layer quality metric based on shared benchmarks, per-category breakdowns, and rework cost; why latency depends on queueing, prefill, decode, single-response output limits, and verbosity; and how to calculate cost from input, output, and cached-input pricing plus a retry rate. A reusable evaluation workflow and scenario-based deployment advice are included.
1. Why “It Feels the Same” Is a Common Selection Mistake
When teams trial a new generation of large language models internally, the most common feedback is that it feels about the same as the previous generation. This subjective impression is not an illusion; it is the result of a missing evaluation method. Trial samples usually consist of only a dozen or so short prompts, and the tasks lean toward question answering and short fragment generation. They neither reach the boundaries of long context and long output nor reveal how differences in billing rules can amplify the bill. To turn a “feeling” into a “conclusion,” you must break selection into three dimensions that can be checked independently: whether the delivered output is good enough, how long you have to wait, and how much it costs in total.
These three factors pull against each other in engineering practice: higher-quality options usually cost more per token, while cheaper options usually require another two rounds of edits. The rational approach is therefore not to look for an all-around champion, but to first determine how the business weights the three factors and then measure them with the same methodology.
2. Dimension One: Quantifying Delivery Completeness
Completeness is not a leaderboard score; it is “how much manual rework is still needed after one delivery.” A three-layer set of metrics is recommended:
- Shared benchmark pass rate: compare options horizontally on the same task set and record wins, losses, and ties, instead of looking at a single aggregate score.
- Per-category breakdown: split tasks into subcategories such as code correctness, instruction following, structured output, long-form consistency, and safety, and observe the distribution of strengths and weaknesses rather than letting an aggregate score smooth them out.
- Rework cost: track the average number of revision rounds and the amount of manual intervention time, which is the metric closest to real R&D spending.
It is worth emphasizing that a two- or three-point lead in the aggregate score is usually not significant in engineering terms. What has real decision value is “which option wins in which subcategories” and “how many revision rounds apart they are.” Safety should also be listed separately: some options may overtake others on this metric, and the cost of fixing a security defect is far higher than that of fixing a functional defect.
3. Dimension Two: Latency Is Not Just “Typing Speed”
Understanding latency as “how fast the first token comes back” is the second common misconception. End-to-end completion time consists of three parts:
T_total = T_queue + T_prefill(input length) + T_decode(output length)
Queueing and prefill are affected by input size, while decode time is roughly proportional to the number of output tokens. So there are two real dividing lines:
- The single-response output limit. If the limit is on the order of a million tokens, a 200,000-token deliverable can be written in one pass; if the limit is only a little over a hundred thousand tokens, the same deliverable must be split into multiple continuation segments, with context realigned between segments, introducing extra concatenation and consistency-checking costs.
- The “response length” per turn. Under the same task, a more verbose model may output several times the median length per turn. Even if it is faster per token, the total time is longer, and the cost is amplified at the same time.
The engineering recommendation is to define the latency metric as “the end-to-end time to complete a deliverable of a specified size,” rather than the throughput figures vendors advertise.
4. Dimension Three: Calculate Cost by the Bill Structure
Cost comparison must come down to line items, at minimum including input, output, and cached input. A rule of thumb is that the three often change by the same multiplier, so a 4x difference in unit price means a 4x difference in the bill. The real bill has two additional multipliers:
Cost ≈ (In_tokens × P_in + Out_tokens × P_out) × (1 + r_retry)
r_retry is the rework rate. If an option is half the price but its rework rate doubles, the total cost is actually higher; conversely, verbose output multiplies the most expensive output tier several times over. A reusable practice is to first measure the average input/output token distribution and the rework rate on a small sample, then plug them into your own real price sheet to estimate the monthly budget.
5. A Reusable Evaluation Workflow
- Build the task set: sample from the real requirement pool, covering four categories—short Q&A, cross-file refactoring, long-form generation, and structured output—with no fewer than a hundred samples.
- Execute under the same conditions: unify temperature, system prompt, and context window, and record input/output tokens, first-token latency, and end-to-end latency.
- Score on three axes: record completeness by subcategory and revision rounds; measure latency end to end; convert cost using the formula above.
- Decide by weights: assign weights to the three items (for example, quality 0.5, latency 0.2, cost 0.3) and output a weighted conclusion with a sensitivity analysis.
- Lock in regression: connect the evaluation set to continuous integration so it automatically regresses when the model or prompts change, preventing “it feels the same” from recurring.
6. Deployment Recommendations
If the business is mainly long documents and whole-repository refactoring, prioritize the single-response output limit and long-context consistency; for high-concurrency online scenarios, prioritize end-to-end latency and cache hit rate; if the budget is tight and tasks are highly standardized, increase the weight on cost and use the rework rate as a gate metric. In engineering, you can also adopt tiered routing: send simple requests to a low-cost option and escalate complex requests to a high-quality option, while using logging services and monitoring alerts to continuously observe token consumption and rework rate.
On most cloud platforms, the capabilities above can be supported by general-purpose categories: object storage holds evaluation samples, message queues smooth out peaks, container platforms host the inference gateway, and logging and monitoring provide observability. Baidu AI Cloud likewise offers these general-purpose capabilities as standard categories, making it easy for teams to turn evaluation and routing strategies into operable engineering assets. The final conclusion is a single sentence: selection is not about choosing the “strongest” model, but the one with the lowest total cost that meets quality requirements under your weights.
