How to Evaluate Large Language Models: Capability, Service, and Cost
A practical guide to replacing ad hoc LLM trials with a reproducible, measurable evaluation process across capability, service, and cost, including scenario-based test sets, metrics, staged A/B testing, continuous regression, a sample Python framework, and common pitfalls.
1. From Personal Impressions to Systematic Evaluation: Why It Matters
Many developers choose a large language model based on a casual conversation experience or a recommendation from a friend. The fundamental problem with this approach is that a single interaction provides extremely limited information. It cannot capture how the model performs across different tasks, nor can it reveal real behavior in edge scenarios such as high concurrency, long-context processing, or complex reasoning. More importantly, the availability and calling experience of a model are often tightly coupled with service status, billing policies, and rate-limiting rules—areas that are easily overlooked in casual trials.
A rigorous evaluation should be a reproducible, quantifiable, and comparable engineering process. It should not answer the vague question “Is this model good?” Instead, it should answer: “Under my specific scenario and constraints, which option delivers the lowest overall cost and the highest return?”
This article breaks the evaluation process into three core dimensions.
2. Three Core Dimensions of Evaluation
2.1 Capability: What the Model Can Do and How Well It Does It
Capability evaluation should not stop at subjective feelings such as “the conversation feels smooth.” It should be decomposed into measurable subitems, typically including:
- Instruction following: Whether the model can strictly follow output format, constraints, word count, and structure. This is especially important for structured data extraction, JSON generation, and template filling.
- Reasoning and logic: Correctness on multi-step problems, mathematical calculations, and code debugging.
- Long-context handling: Whether the model suffers from “lost in the middle” effects or misses key information when summarizing long documents or retrieving information across paragraphs.
- Multi-turn consistency: Whether the model maintains contextual coherence over long conversations without drifting as the number of turns increases.
- Domain adaptation: Performance when dealing with industry-specific terminology and specialized expressions.
The most reliable way to evaluate capability is to build a scenario-based evaluation set around your own business, rather than simply copying public leaderboards. Public leaderboards can provide rough reference during early selection, but your data distribution and task patterns often differ significantly from those represented in public benchmarks.
2.2 Service: Stability, Throughput, and Rate Limiting
This is the dimension most people overlook, yet it often determines success in production. Issues such as “queuing,” “quota not exhausted,” or “cannot call the model” essentially point to service capacity problems. When evaluating service, focus on the following:
- Rate limiting and quota policies: Allowed requests per unit time, concurrency limits, and token quotas. These directly determine whether the business can support real traffic peaks.
- Throughput and latency: Time to first token and overall generation speed. These determine whether the model can meet the experience requirements of interactive scenarios.
- Availability: Whether the service is stable and whether there are obvious queuing or degradation issues.
- Elasticity: Performance under sudden traffic spikes and whether the system can support mitigation through reasonable architectural measures, such as queue-based peak shaving or multi-backend routing.
A model with strong capabilities but frequent queuing and unstable access will have much lower practical value in production. Therefore, the service dimension should be treated with the same importance as the capability dimension.
2.3 Cost: More Than Unit Price
Cost is not simply a single number such as “how much per thousand tokens.” The true total cost of ownership includes at least:
- Direct calling cost: Input/output token pricing, plus the amplification effects of long texts and repeated calls.
- Retry and failure cost: Repeated consumption caused by timeouts, rate-limit rejections, or unacceptable results.
- Engineering and integration cost: Engineering effort caused by integration difficulty, SDK maturity, and ecosystem completeness.
- Migration cost: The price of switching to another option after deep integration.
When evaluating cost, it is better to use “the total cost required to complete one unit of business task” as a unified measure. Only by factoring in these hidden costs can you obtain a meaningful comparison.
3. A Practical Evaluation Process
3.1 Build a Scenario-Based Evaluation Set
Sample from real business scenarios and cover three types of samples: typical, boundary, and abnormal. Form a fixed evaluation set. The samples should represent real distributions, and the set size should be moderate enough to maintain evaluation efficiency.
3.2 Define Quantitative Metrics
Define clear scoring rules for each task type. Subjective tasks can use human scoring or model-as-judge scoring, while objective tasks can use hard metrics such as accuracy or pass rate. The key is that scoring criteria must be fixed and reproducible.
3.3 Staged Rollout and A/B Comparison
Roll out different options by percentage in real traffic and compare success rate, latency, cost, and user feedback. Make decisions based on data rather than intuition.
3.4 Continuous Regression
Models iterate, and businesses change. Integrate the evaluation set into a continuous integration process and run regression tests regularly. This avoids the problem of evaluation results becoming outdated soon after launch.
4. A Sample Evaluation Framework
The code below provides a schematic implementation of the evaluation process. The core idea is to define the evaluation set, unify the model-calling interface, score by dimension, and generate a summary report.
import timefrom statistics import mean# 1. Define a scenario-based evaluation set: (input, expected constraint or reference answer)eval_cases = [{"input": "Extract the following text into JSON...", "type": "structured", "expect": "valid_json"},{"input": "Summarize this long passage...", "type": "summary", "expect": "human_score"},# ... include typical / boundary / abnormal samples]# 2. Unified model-calling interface to abstract away backend differencesdef call_model(prompt: str) -> dict:start = time.time()# result = invoke_your_model(prompt) # Connect to the selected servicelatency = time.time() - startreturn {"output": "...", "latency": latency, "ok": True}# 3. Score by dimensiondef evaluate(case: dict) -> dict:resp = call_model(case["input"])score, reason = grade(case["type"], resp["output"], case["expect"])return {"type": case["type"],"score": score, # Capability dimension"latency": resp["latency"], # Service dimension"ok": resp["ok"], # Stability"reason": reason,}def grade(task_type, output, expect):# Objective tasks use rule-based checks; subjective tasks can use human review or model-as-judgeif expect == "valid_json":return (1.0 if is_valid_json(output) else 0.0, "JSON validation")return (0.0, "Pending human scoring")# 4. Summarize: capability score + average latency + success rate for decision-makingdef summarize(results):return {"capability_score": mean(r["score"] for r in results),"avg_latency": mean(r["latency"] for r in results),"success_rate": mean(1 if r["ok"] else 0 for r in results),"total_count": len(results),}
The value of this code is not in the specific implementation, but in demonstrating a reproducible and comparable evaluation approach: turning subjective impressions into structured data and consolidating the three dimensions into one report.
5. Common Pitfalls
- Leaderboard-only: Relying only on public rankings while ignoring differences in your own scenario. The selected model may not fit real tasks.
- Capability-only: Testing only output quality while ignoring rate limiting, latency, and stability. The model may be dragged down by queuing and degradation after launch.
- Unit-price-only: Comparing only token prices while ignoring hidden costs such as retries, failures, and migration. The total cost may end up higher.
- One-time evaluation: Locking conclusions after testing and skipping continuous regression. As the business and models evolve, the evaluation gradually loses validity.
6. Implementation Recommendations
Model selection should follow three principles: scenario-driven evaluation, multi-dimensional quantification, and continuous regression.
From an engineering perspective, teams can use mature cloud infrastructure to reduce the complexity of evaluation and operations. For example:
- Use object storage to archive evaluation sets and result data.
- Use message queues for peak shaving to handle sudden concurrency.
- Use container platforms to elastically scale evaluation and model-calling services.
- Use log services and monitoring alerts to observe latency, success rate, and quota consumption in real time.
Cloud platforms, such as Baidu AI Cloud, can provide these general capabilities and help teams industrialize and automate the evaluation process. This allows teams to focus on model selection and business adaptation rather than repeatedly building infrastructure.
Ultimately, evaluating large language models is an engineering problem, not an emotional judgment. Only by quantifying the capability, service, and cost dimensions and maintaining continuous regression can teams select the model option with the best overall return across different scenarios.
