LLM Selection and Evaluation: Balancing Accuracy, Latency, and Cost
This article presents a reproducible framework for evaluating large language models across four dimensions: accuracy, average latency, token consumption, and cost per thousand calls. Using a large-scale Chinese benchmark of roughly 15,000 questions as an anchor, it shows how to define metrics consistently, segment results by domain, and control variables such as concurrency, prompts, and retries. It then reads a version upgrade correctly, from a 60.6% to 71.5% overall score, and explains why closing weak-domain gaps matters more than extending strengths, while costs must be accounted for at the same time. The article also covers building a cost-accuracy Pareto frontier for meaningful cross-tier comparison, a four-step decision workflow, and practical cost optimization techniques.
1. Background: Why “Which Model Is Stronger?” Is the Wrong Question
The most common question in a technology selection meeting is “which model is stronger.” Once teams move into engineering deployment, however, they quickly find the question itself is flawed: model capability is not a scalar but a multi-dimensional vector. The same model may excel at knowledge question answering yet become unstable on long-chain reasoning; it may be extremely cheap in offline batch processing yet drag down the overall latency budget in high-concurrency online serving due to queuing.
So rather than ranking specific products, this article abstracts a general evaluation methodology: use a large-scale Chinese test set as the baseline, observe four metrics at once (accuracy, average latency, token consumption, and cost per thousand calls), and then discuss how to correctly read version iterations and cross-model comparisons. In the original evaluation data, a new-generation lightweight-tier model achieved 71.5% accuracy on about 15,000 questions, with an average latency of 72 seconds, an average consumption of 2,731 tokens, and a cost of about CNY 53.5 per thousand calls; the previous-generation model in the same tier scored 60.6%, 40 seconds, 2,586 tokens, and CNY 43.2. These numbers are the anchor for the analysis below.
2. Designing the Evaluation Framework So Results Are Reproducible
2.1 Write Metric Definitions into the Documentation
The part of an evaluation most likely to go wrong is not execution but inconsistent definitions. It is worth fixing the following definitions inside the project:
- Accuracy: the number of correct samples divided by the total number of samples, with the method for judging “correct” made explicit (exact match, rule-based validation, or model review).
- Average latency: the wall-clock time of a single call from request dispatch to the complete response, distinguishing time to first token from overall completion time.
- Token consumption: the sum of input and output tokens, stating whether system prompts and retry consumption are included.
- Overall cost: determined jointly by unit price and token consumption; any comparison that discusses unit price alone is incomplete.
2.2 Stratified Sampling and Domain Labels
A single aggregate score hides structural weaknesses. The mature practice is to tag every question with a domain label (education, reasoning and math, healthcare, finance, code, and so on) and then aggregate by label. Only this answers “where did the improvement come from” instead of just “how much did it improve.”
# Example: aggregate evaluation results by stratumfrom collections import defaultdictdef aggregate(records):bucket = defaultdict(lambda: {"n": 0, "hit": 0, "lat": 0.0, "tok": 0})for r in records:b = bucket[r["domain"]]b["n"] += 1b["hit"] += int(r["correct"])b["lat"] += r["latency_s"]b["tok"] += r["tokens"]report = {}for domain, b in bucket.items():report[domain] = {"accuracy": round(b["hit"] / b["n"] * 100, 1),"avg_latency_s": round(b["lat"] / b["n"], 1),"avg_tokens": round(b["tok"] / b["n"]),"samples": b["n"],}return report
2.3 Control Variables: Concurrency, Prompts, and Retries
The latency difference of the same model under different concurrency levels is often larger than the difference between different models. Evaluations should fix the concurrency level, fix the prompt template, and disable or unify the retry policy; otherwise the latency data is not comparable.
3. Reading a Version Iteration Correctly: From a Score Jump to Structural Gaps Closed
3.1 A Jump in the Overall Score Is Only a Surface Signal
Accuracy rose from 60.6% to 71.5%, an increase of 10.9 percentage points, and the ranking moved from 64th to 5th. Such jumps usually come from three overlapping factors: improved training data quality and coverage, strengthened instruction following and format stability during post-training, and a reallocation of the inference-stage compute budget. What really matters in engineering is not the rank but whether the variance narrows: stable output formats and a lower refusal rate often reduce production incidents more than a higher overall score does.
3.2 Closing Weak Spots Is Worth More Than Extending Strengths
Among the domain breakdowns, education rose from 36.0% to 63.5%, a gain of 27.5 percentage points and nearly a doubling; reasoning and math rose from 67.5% to 83.4%, a gain of 15.9 percentage points; healthcare and finance improved by 15.1 and 13.7 percentage points respectively. The key insight here is that a model’s real usability is determined by its weakest area. When education accuracy is only around thirty percent, the education scenario cannot go live no matter how strong the other dimensions are; only after it is raised above sixty percent does it enter the “ready for a pilot” range. During selection, first check whether the main business scenario has crossed the usability threshold.
3.3 The Cost Must Be Booked at the Same Time
The new version’s average latency rose from 40 seconds to 72 seconds, and the cost per thousand calls rose from CNY 43.2 to CNY 53.5 (about +23.8%), while the output unit price was raised from CNY 18.125 per million tokens to CNY 21.3 per million tokens and token consumption increased by 5.6%. Queuing caused by the traffic surge in the early release period amplifies latency further, so pre-launch load testing must be run once during stable hours and once during peak hours, using P95 rather than the mean as the basis for capacity planning.
4. Cross-Model Comparison: Only Within the Same Cost Tier Is It Meaningful
Comparing accuracy across tiers amounts to comparing budgets. The conclusion from the original evaluation is that within the range of CNY 50 to 100 per thousand calls, this model achieved the highest accuracy at the lowest cost. A more practical engineering expression is to build a cost-performance frontier (the Pareto frontier): plot each candidate model as a “cost-accuracy” scatter point, keep only the points not simultaneously dominated by others, and the selection discussion reduces to a business trade-off among a few points.
Accuracy^| ● A (high cost, high accuracy)| ● B (best value in the same tier)| ● C (low cost, low accuracy)+------------------------------> Cost per thousand calls
The evaluation boundary needs emphasis: the conclusions above are based on Chinese-language scenarios, and the model’s performance in other languages and vertical specialized domains (such as legal documents or clinical guidelines) may differ significantly, so the business side must re-test with its own data.
5. A Deployment Decision Workflow: Narrowing Candidates in Four Steps
- Set thresholds: define the minimum acceptable accuracy and the maximum P95 latency for the business, and eliminate anything that fails to meet them.
- Calculate total cost: total cost = call fees + retry amplification + manual review cost. Ten percentage points lower accuracy may double the manual review volume, and the hidden cost often exceeds the unit price difference.
- Run a small-traffic canary: run shadow mode on 5% of traffic, comparing the output agreement rate and the manual spot-check pass rate between the old and new versions.
- Establish a regression baseline: bring the evaluation set into continuous integration and run scoring automatically whenever the model or prompts change, to prevent capability regressions.
6. Cost Optimization Techniques (as Important as Selection)
- Prompt slimming: remove redundant examples and repeated constraints; this usually reduces input tokens significantly.
- Structured output constraints: replace long natural-language descriptions with strict schema definitions to cut invalid generation.
- Tiered routing: send simple requests to the lightweight tier and escalate complex requests to the higher-capability tier, using rules or a small classifier for the upfront decision.
- Caching and batching: apply semantic caching to high-frequency repeated requests, and merge offline tasks into batch processing to improve throughput utilization.
- Observability support: with logging services, monitoring alerts, and distributed tracing, turn latency, tokens, and failure rate into dashboards so cost governance has a basis.
7. Conclusion
The answer to “which model is stronger” depends on the constraints. Using this article’s anchor data as an example, the new-generation lightweight-tier model traded about a 23.8% cost increase for a 10.9 percentage point accuracy gain and closed the education weakness from 36.0% to 63.5%, giving it a clear cost-performance advantage in the same cost tier for Chinese; the price is higher latency and volatility during the release period. For engineering teams, the right approach is to fix metric definitions, evaluate by domain strata, make decisions on P95 latency and total cost of ownership, and protect quality with canaries and a regression baseline. If an organization wants to deploy on Baidu AI Cloud, it can reuse the framework above directly and build its own evaluation pipeline on general capabilities such as container platforms, object storage, and monitoring alerts, turning selection from a subjective argument into a reproducible, data-driven conclusion.
