How to Evaluate and Select Large Language Models: Balancing Accuracy and Cost
This article presents a reusable methodology for evaluating and selecting large language models (LLMs) by balancing accuracy against cost. It explains why a single accuracy metric is misleading, then defines a four-dimension evaluation framework covering accuracy, response latency, token consumption, and overall cost per thousand calls. Using a representative lightweight-model upgrade example, it shows how to read structural accuracy gains, attribute latency shifts, and break down cost increases. It also covers tier-based model selection by risk level, cost-reduction techniques, and how to integrate evaluation into CI/CD with regression gates, canary releases, and monitoring. Readers will learn to turn "feels stronger" into measurable, reproducible, and actionable migration decisions.
1. Background: Rebalancing Performance and Cost After a Version Upgrade
Large language model vendors are iterating faster than ever. A single model family often ships multiple versions with different positioning: a flagship version pushes the capability ceiling, while a lightweight version emphasizes usability per unit of cost. When a lightweight version completes a generational upgrade, the core question for an engineering team is not “is the new version stronger?” but “under my business constraints, is this upgrade worth migrating to?”
A typical lightweight upgrade from public evaluation practice can look like this: on a Chinese综合 benchmark of roughly 15,000 questions, accuracy rises from about 60.6% to 71.5%, a gain of 10.9 percentage points, and the overall ranking jumps from 64th to 5th. But average per-call latency increases from 40 seconds to 72 seconds, and the cost per thousand calls rises from CNY 43.2 to CNY 53.5, an increase of about 23.8%. These numbers reflect a common pattern: a capability leap usually comes with longer reasoning chains and longer outputs, pushing latency and cost up at the same time.
So this article does not compare specific products. Instead, it abstracts a reusable evaluation and selection methodology that helps readers turn “feels stronger” into conclusions that are measurable, reproducible, and decision-ready.
2. Designing the Evaluation System: Four Dimensions, None Optional
A single accuracy metric can easily mislead decisions. Cover at least the following four categories of metrics, and fix the evaluation configuration (temperature, maximum output length, system prompt, retry policy); otherwise cross-version comparisons are not comparable.
Accuracy (capability dimension)
- The question set should contain no fewer than 10,000 items, covering general knowledge, education, reasoning and math, finance, healthcare, code, long-context understanding, and other sub-domains.
- Always output “overall score + per-domain scores,” because an overall gain may be driven by a single domain, and the domains your business actually depends on may not improve in step.
Response latency (experience dimension)
- Distinguish time-to-first-byte from end-to-end completion time. In streaming output scenarios, time-to-first-byte matters more to perceived experience.
- Early after a new version launches, surging traffic often causes queuing. Re-measure latency after load stabilizes, so cold-start issues are not mistaken for inherent model characteristics.
Token consumption (cost-driver dimension)
- Track input tokens, output tokens, and total tokens separately. Output pricing is usually much higher than input pricing, so a small rise in output length is amplified into a cost increase.
- Check whether “tokens needed to complete the same task” drop: if the new version clarifies less and self-corrects less, per-task cost may still fall even if unit price rises.
Overall cost (decision dimension)
- Normalize to “cost per thousand calls” or “cost per ten thousand requests” so it aligns with your business QPS budget.
The aggregation logic for illustrative evaluation results can be written as the following pseudocode for engineering implementation:
def aggregate(records):total = len(records)acc = sum(r.correct for r in records) / totalavg_latency = mean(r.end_to_end_ms for r in records)avg_tokens = mean(r.input_tokens + r.output_tokens for r in records)cost_per_1k = 1000 * avg_tokens / 1_000_000 * blended_priceby_domain = group_by(records, key=lambda r: r.domain)return {"accuracy": acc,"latency_ms": avg_latency,"tokens": avg_tokens,"cost_per_1k": cost_per_1k,"domain_accuracy": {k: mean([r.correct for r in v]) for k, v in by_domain.items()},}
3. Interpreting Results: Reading the Real Conclusion from the Data
First, look at the structure of the gain, not just its magnitude. In the example above, “education” capability rises from 36.0% to 63.5%, a gain of 27.5 percentage points, which is closing a weak spot; “reasoning and math” rises from 67.5% to 83.4%, a gain of 15.9 percentage points; finance, healthcare, and others also show double-digit gains. This indicates a structural improvement rather than an isolated fluke. The engineering implication: scenarios that previously could not go live because accuracy was below bar (such as tutoring, structured extraction, and numeric reasoning) are now candidates for pilots.
Second, attribute the latency change clearly. The shift from 40 to 72 seconds could come from longer model reasoning chains or from server-side load. To tell them apart, re-measure by time window and inspect the P50/P95 distribution: if P95 rises far more than P50, it looks more like queuing and rate limiting; if the whole distribution shifts uniformly to the right, it looks more like the model itself producing longer outputs.
Third, break down the cost increase. In the example, the output unit price rises from CNY 18.125 per million tokens to CNY 21.3 per million tokens, while average tokens grow from 2,586 to 2,731 (+5.6%); the two combine into roughly a 23.8% rise in cost per thousand calls. This points to optimization directions: compressing the system prompt, constraining output format, and limiting maximum output length often cut costs faster than switching models.
4. Cross-Comparison Within the Same Cost Tier: The Right Way to Select
A common practice in evaluation is tier-by-tier comparison: in the CNY 50–100 per thousand calls band, the new version achieves the highest accuracy at the lowest cost, standing out on value; while at lower cost tiers, lightweight models still carry high-concurrency, low-risk classification and extraction tasks on price advantage.
The recommended selection framework is “allocate tiers by scenario,” not a single model across the whole site:
- High-risk, low-tolerance scenarios (numeric calculation, compliance review, medical and financial Q&A): choose the highest-accuracy tier, and layer on rule-based validation and secondary review.
- Medium-risk scenarios (content generation, summarization, customer-support assistance): choose the best value tier, with caching and batching.
- Low-risk, ultra-high-concurrency scenarios (intent classification, tagging, format conversion): choose the lowest-cost tier, served by distilled or smaller models.
Supporting cost-reduction measures include: semantic caching to reuse high-frequency Q&A, prompt trimming and templating, structured output constraints (such as limiting JSON fields), batch asynchronous calls, and retrieving and truncating long text before feeding it into the model.
5. Engineering Implementation: Plugging Evaluation into Continuous Integration
Evaluation should not be a one-off activity but part of the release pipeline. Recommended practices:
- Fix the question set and random seed, and version-control the evaluation configuration so historical results are traceable.
- Trigger regression evaluation on every model version change, outputting a four-item baseline comparison of accuracy, latency, tokens, and cost.
- Set admission gates, for example “accuracy in core business domains must not fall below the previous version” and “cost per thousand calls must not rise more than 15%”; failing either blocks a full rollout.
- Use canary releases: start with 5% of traffic, watch real business metrics (task completion rate, human-takeover rate), then expand gradually.
- Build monitoring and alerting with thresholds on latency P95, error rate, and sudden token-consumption spikes, with automatic rollback on anomalies.
On the cloud, you can reuse general-purpose building blocks: object storage for question sets and evaluation reports, a message queue to smooth batch evaluation workloads, a container platform to elastically scale evaluation and inference services, and logging plus monitoring and alerting to track latency and cost curves. General-purpose capabilities from cloud providers such as Baidu AI Cloud can support this pipeline; choose specifics based on your own architecture and compliance requirements.
6. Conclusion
A generational upgrade of a lightweight model is essentially a rebalancing of capability, latency, and cost. The right way to judge “is it stronger” is to, under a fixed evaluation configuration, observe the structural change in accuracy, the shape of the latency distribution, and the breakdown of cost, then allocate model tiers by business risk level. When accuracy improves by more than 10 percentage points and cost rises by about 20%, the right move for most teams is not a full replacement, but a canary pilot in core scenarios while advancing prompt and output-constraint optimization in parallel, letting reproducible data drive the migration decision.
