How to Choose an LLM After Price Drops: A Reusable Evaluation Framework
This article explains why public leaderboards are insufficient for large language model (LLM) selection and introduces a reusable evaluation framework. It covers four core dimensions—task quality, latency, unit cost, and stability—and provides a step-by-step guide to building a custom evaluation dataset, translating results into actionable decisions, avoiding common pitfalls, and implementing best practices for deployment and monitoring.
I. Why LLM Selection Shouldn’t Rely Solely on Leaderboards
Public leaderboards mostly score models based on fixed question sets, which often misalign with real-world business input distributions, prompt styles, and output format requirements. A top-ranked model may not be the most stable in customer service Q&A, nor the most cost-effective in code review. Therefore, the first step in model selection is shifting the question from “Which model has the highest score?” to “Which model can achieve the minimum quality threshold for my task at an acceptable cost?”
Leaderboards still hold reference value. They can help teams narrow down candidate pools, but they cannot replace empirical testing on proprietary data.
II. Four Core Evaluation Dimensions
1. Task Quality
Quality must be translated into quantifiable scoring criteria. There are three common approaches:
- Reference Answer Comparison: Suitable for tasks with standard answers like extraction, classification, and numerical calculation. Accuracy can be calculated directly.
- Rule Validation: Suitable for format-oriented tasks, such as checking whether the output is valid JSON, whether all fields are present, and whether the length is within limits.
- Scoring Models or Human Review: Suitable for subjective tasks like summarization, polishing, and open-ended Q&A. Scoring models require separate calibration and should be sampled and compared against human scores to ensure consistency.
2. Response Latency
Latency should be split into two metrics. Time to first token (TTFT) determines the perceived wait time in streaming output scenarios, while overall completion time affects the throughput of batch tasks. Interactive products should prioritize TTFT, while offline tasks should focus on overall duration and concurrency capabilities.
Latency data must be collected under concurrency and network conditions similar to the production environment. Measurements from a single request have no reference value.
3. Unit Cost
The cost of a single request is calculated as follows:
Cost per request = Input token count × Input price + Output token count × Output price
Two points should be noted during calculation. First, output tokens are typically priced higher than input tokens; the longer the output, the larger its share of the total cost. Second, a lower-priced model might actually result in a higher total cost if it generates verbose outputs or requires multiple retries. Therefore, the comparison should be based on the “cost per task that passes the quality threshold,” rather than simply comparing the price per 1,000 tokens.
Prices should be based on the latest pricing tables published by service providers, and the collection date should be recorded in the solution documentation.
4. Stability and Availability
Stability includes the following aspects:
- Request error rate and timeout rate;
- Rate limiting frequency and retry success rate;
- Output format compliance rate, especially for structured outputs;
- Behavior drift after version updates, meaning changes in performance on the same prompt across new versions.
Behavior drift is the easiest to overlook. After a service provider updates a model, the effectiveness of existing prompts may change, making regular regression testing necessary.
III. Building a Custom Evaluation Dataset
The evaluation dataset determines whether the conclusions are trustworthy. It is recommended to build it following these steps:
- Collect Real Samples: Extract requests from production logs or business processes, and anonymize them by removing personal and sensitive information.
- Stratified Sampling: Stratify by scenario, difficulty, and input length to ensure coverage of simple, complex, and edge cases.
- Define Scoring Rules: Clearly state the scoring criteria for each task type, and provide reference answers or scoring rubrics.
- Control Scale: For the first round, 200 to 500 samples are recommended. With a sample size that is too small, score differences might just be random fluctuations.
- Maintain Version Records: Record the evaluation time, model version, prompt version, and parameter settings to facilitate future reproduction and comparison.
Below is an example of a general evaluation framework. The inference call function is implemented by the user and does not rely on any vendor-specific API.
import timefrom statistics import meandef evaluate_model(model_name, cases, call_model, judge, price_in, price_out):"""Evaluate a single model and return aggregated metrics.cases: List of evaluation samples, each containing prompt, reference, and check_format fields.call_model: The inference function implemented by the user, returning (output text, input token count, output token count).judge: The scoring function, returning a score between 0 and 1.price_in / price_out: Input and output price per 1,000 tokens, based on the provider's published rates."""scores, latencies, costs, format_ok = [], [], [], []for case in cases:start = time.perf_counter()text, in_tok, out_tok = call_model(model_name, case["prompt"])latencies.append(time.perf_counter() - start)scores.append(judge(text, case["reference"]))costs.append((in_tok * price_in + out_tok * price_out) / 1000)format_ok.append(case["check_format"](text))return {"model": model_name,"quality": round(mean(scores), 4),"avg_latency_s": round(mean(latencies), 3),"avg_cost": round(mean(costs), 6),"format_pass_rate": round(mean(format_ok), 4),}
After running the same evaluation across multiple candidate models, you can generate a horizontal comparison table. This table serves as the basis for subsequent decision-making.
IV. Translating Evaluation Results into Decisions
A two-stage rule of “threshold first, then cost comparison” is recommended:
- Set Quality Thresholds: The business team determines the minimum quality score based on fault tolerance requirements, such as a minimum scoring accuracy threshold. Models below the threshold are eliminated directly.
- Compare Comprehensive Costs Among Qualified Models: Consider unit cost, latency, and stability comprehensively. If the business is latency-sensitive, a hard limit can be set for latency, and models exceeding the limit are also eliminated.
If multiple metrics are equally important, a weighted scoring system can be used. Weights must be determined by the business team before evaluation and should not be adjusted after seeing the results; otherwise, it is easy to draw preconceived conclusions.
V. Common Pitfalls
- Changing the Model Without Tuning Prompts: The same prompt performs differently across different models. A safer approach is to tune prompts separately for each candidate model before comparing them.
- Ignoring Version Drift: After a service provider updates a model, previous conclusions may become invalid. Regression testing should be integrated into the release process.
- Equating Low Unit Price with Low Total Cost: Total costs will rise when outputs are longer, retries are needed, or manual review is required.
- Overlooking Data Compliance: When dealing with user data, it is necessary to verify the service provider’s data processing methods, storage locations, and retention periods, and compare them against internal security policies.
- Over-reliance on a Single Metric: Focusing only on quality scores ignores latency and cost, while focusing only on cost ignores the business impact of failure cases.
VI. Implementation Recommendations
Adopt Tiered Routing: Classify requests into simple, medium, and complex categories based on complexity. Route simple requests to lower-cost models and escalate complex requests to more capable models. Routing rules should be based on observable features, such as input length, task type, and historical failure rate, and their accuracy should be verified through evaluation.
Adopt Canary Releases: Before fully launching a new model, route a small amount of traffic to it (e.g., 5%) while logging quality, latency, and error rates. Gradually expand the scope once metrics meet the standards, and quickly roll back to the original model if anomalies occur.
Establish Cost Monitoring: Track daily call volumes and expenses by model and by business line, and set budget alerts. Using logging services and monitoring components to record the token usage of each request can help promptly identify issues such as prompt bloat or uncontrolled outputs.
Preserve Evaluation Assets: Incorporate evaluation datasets, scoring rules, and evaluation scripts into version control. After every model or prompt change, automatically run regression evaluations to ensure that modifications do not introduce new quality issues.
VII. Conclusion
LLM selection is an ongoing engineering effort, not a one-time decision. Public leaderboards can be used to narrow down options, but the final conclusion must come from evaluations on proprietary data. Readers can follow the workflow of “building an evaluation dataset, measuring four dimensions, setting quality thresholds, and comparing comprehensive costs,” and integrate evaluation scripts and monitoring systems into daily development workflows to keep selection decisions updated as business needs and model versions evolve.
