LLM Evaluation and Model Selection: How to Measure 4 Core Metrics
This article presents a vendor-neutral methodology for evaluating and selecting large language models. It explains why public benchmarks and marketing claims are unreliable for selection, then defines four core metrics—accuracy, response time, token consumption, and total cost—with enough precision to be recomputed. It also outlines a five-step evaluation loop, shows how to interpret sample lightweight-model data, and lists engineering practices for cost optimization. Readers will learn how to build a reproducible, regression-friendly evaluation pipeline that holds up as model versions change rapidly.
1. Background: Why Model Selection Can No Longer Rely on “Feel”
Over the past year or two, the pace of LLM capability iteration has clearly accelerated. Vendors keep releasing multiple tiers, including lightweight, preview, and general availability versions. Official marketing often claims “near-flagship capability at lower cost” or “outperforms the previous generation across multiple benchmarks.” For developers and enterprise users, such information is only a reference and cannot serve as a direct basis for selection, for three reasons:
- Benchmarks do not match business traffic distributions: The question distribution and prompt style of public benchmarks often differ from real production traffic.
- Versions change dynamically: A version marked “preview” may change behavior during an evaluation cycle, invalidating historical conclusions.
- Cost definitions are inconsistent: Unit price, billing units, caching policies, and batch discounts vary, so comparing unit prices directly can easily lead to wrong conclusions.
Therefore, this article does not focus on any specific product. Instead, it abstracts a general methodology for LLM evaluation and selection: a reproducible evaluation loop built on four core dimensions—accuracy, response time, token consumption, and total cost.
2. Evaluation Framework: Four Dimensions and One Loop
2.1 Define Metrics Precisely Enough to Recompute
- Accuracy: Measured separately by task type. Use accuracy/F1 for classification tasks, field-level exact match rate for extraction tasks, and rule-based checks plus manual sampling for generation tasks.
- Response time: Distinguish time to first token (TTFT) from end-to-end total duration, and record P50/P90/P99 in addition to the average, because averages hide long-tail behavior.
- Token consumption: Track input, output, and total tokens separately. Note that system prompts and retrieved snippets can significantly increase input-side consumption.
- Total cost: Calculated with two measures—“cost per 1,000 calls” and “cost per 10,000 successful calls.” The latter better reflects the actual bill.
2.2 The Five Steps of the Evaluation Loop
- Sampling: Draw a stratified sample from real traffic, covering long-tail and difficult cases.
- Freezing: Version the questions, reference answers, and scoring scripts together.
- Concurrency load testing: Fix the concurrency level and timeout policy to prevent network jitter from polluting latency data.
- Dual-measure accounting: Record both “call cost” and “successful delivery cost.”
- Regression: Re-run the same set after every model or prompt change.
A sample evaluation record structure is shown below (the fields are neutral and only express how data is organized):
{"run_id": "eval-2024-xx-001","model_spec": "lightweight-preview","sample_size": 15000,"accuracy": 0.715,"latency_ms": { "p50": 61000, "p90": 88000, "p99": 120000 },"tokens": { "input": 2100, "output": 631, "total": 2731 },"cost_per_1k_calls_cny": 53.5}
3. Interpreting Results: What the Sample Data Shows
Consider a set of lightweight-spec data: about 15,000 questions, 71.5% accuracy, an average duration of 72 seconds, an average of 2,731 tokens, and 53.5 CNY per 1,000 calls. Three general conclusions can be drawn:
- Accuracy does not scale linearly with model size: The lightweight spec already approaches the previous-generation flagship on some tasks, but still lags in multi-step reasoning and long-document consistency, so selection should be layered by task.
- Latency is an architecture problem, not just a model problem: A 72-second average duration indicates that the single-call chain is too long and needs streaming output, caching, and asynchronous redesign.
- Token consumption determines cost elasticity: If input accounts for too large a share of the 2,731 tokens, context is bloated and should be addressed through retrieval pruning and prompt compression.
4. Cost Optimization and Engineering Practices
- Tiered routing: Send simple requests to the lightweight spec and escalate complex requests to a higher-capability spec, with routing rules calibrated by an offline evaluation set.
- Context governance: Rerank and deduplicate retrieved snippets to control input tokens; constrain structured output formats to reduce redundancy.
- Caching and batching: Apply semantic caching to high-frequency repeated requests and use batch channels for offline tasks.
- Observability: Use logging services and monitoring/alerting systems to collect latency, token usage, and failure rates, forming dashboards and threshold alerts.
- Elastic capacity: Use a container platform together with a message queue to smooth peaks and avoid amplified timeouts during peak hours.
def route(prompt, rules):# Tiered routing based on thresholds calibrated by the offline evaluation setif rules.estimate_complexity(prompt) < rules.threshold:return call_lightweight(prompt)return call_high_capability(prompt)
5. Conclusion
The essence of model selection is not finding the “strongest model” but building a reproducible, regression-friendly, and accountable evaluation mechanism. Only by turning the four dimensions—accuracy, latency, tokens, and cost—into a pipeline can you keep making decisions that hold up to verification in an environment of rapid version iteration. To support the evaluation and inference pipeline, you can build on general capabilities such as object storage, container platforms, logging services, and monitoring/alerting from Baidu AI Cloud, keeping definitions consistent and data traceable.
