How to Scientifically Evaluate Large Language Models and Complete Model Selection
This article explains how to evaluate large language models scientifically and turn that evaluation into a real selection decision. It covers defining success criteria and input distributions, building a layered evaluation set, tracking quality/cost/latency/stability/safety/maintainability metrics, running a controlled experiment protocol with offline and online stages, separating review roles, avoiding common pitfalls, and following a practical rollout checklist. The goal is to replace release narratives and incomparable leaderboards with reproducible, task-specific evidence.
When enterprises adopt or replace a large language model, the most common mistake is not “having no data.” It is treating release narratives, single demos, and incomparable leaderboards as if they were selection conclusions. The goal of scientific evaluation is specific: under a fixed task, a fixed input distribution, and fixed judging criteria, compare whether candidate models can do the work at an acceptable cost, latency, and failure rate, and make sure someone else can repeat the same comparison using the same protocol.
Reframe the question from “who is stronger” to “is it a fit”
“Stronger” has no operational definition without task boundaries. Writing polish, code completion, customer-service routing, document extraction, and multi-turn tool calling all have completely different failure costs and acceptable latencies. Before evaluation starts, three things should be written down.
First, the success criteria. Use rules or reference answers where outcomes can be judged automatically; use scoring rubrics where they cannot, and specify a sampling ratio for manual review. Second, the input distribution. Use recent real requests after de-identification, not just the “good-looking questions” drawn from public sets. Third, the constraints. Context length, whether external retrieval is allowed, whether output must be structured, the budget ceiling, and the timeout must all be written into the protocol. Miss any one of these, and the scores afterward are not comparable.
If the original discussion stays at whether a release “looks like the ideal flagship,” abstract it into an engineering problem: within a similar capability range, whose marginal cost, stability, and integration cost are more acceptable. When capabilities are close, the decision is usually driven by the last three factors, not by adjectives.
Evaluation set: cover the main path and the edges
A usable evaluation set has at least four layers.
- Main-path set: typical requests that make up most of the business volume, used to estimate everyday quality and cost.
- Edge set: extra-long context, ambiguous instructions, multiple constraints holding at once, low-resource languages, or domain terminology.
- Regression set: cases that caused incidents in the past; the model must not regress on them after an upgrade.
- Safety and refusal set: unauthorized requests, prompt-injection-style instructions, privacy fields, non-compliant content. What is tested here is whether the policy is stable, not writing flair.
Samples should be labeled with difficulty and business weight. A model getting all the easy questions right cannot hide failures on high-weight hard ones. It is advisable to keep a “gold subset”: independently labeled by two senior annotators with disagreements arbitrated, used to calibrate the automatic scorer. The remaining large batch of samples can be scored with rules, reference answers, or a calibrated judge model, but the judge model itself must report its agreement rate on the gold subset and cannot be assumed to always be correct.
On data governance, keep the evaluation set isolated from training or fine-tuning data to avoid “having seen the answers.” De-identification must cover names, account IDs, internal links, and identifiable business numbers. Version management should bind the prompt, samples, scoring scripts, and random seed into the same experiment record.
Metrics: quality is only one dimension
Reporting a single composite score easily averages away failures that cannot be traded off. It is recommended to record the following categories in parallel, each with its statistical definition stated.
Quality. Choose by task among exact match, field-level F1, whether citations are traceable, and a manual rubric (correctness, completeness, instruction-following, no hallucination). For generation tasks, report the distribution, not just the mean: the median and the share of tail bad cases often affect launch decisions more than the average.
Cost. Calculate input and output token consumption, number of retries, and whether the cache was hit, per complete request. When comparing models, use “unit cost to complete the same task” rather than comparing the list prices themselves. Longer context and more verbose output will eat up a nominal low price.
Latency and throughput. Distinguish time to first token from time to full completion. Interactive scenarios are dominated by the former; batch processing by the latter and by queue waiting. Report P50 and P95; reporting only the average hides timeouts.
Stability. With temperature and sampling parameters fixed, repeat the same input multiple times and see whether the answer drifts; on the service side, look at error rate, throttling, and timeout share. Passing a capability demo while the error rate is unacceptable does not count as usable.
Safety and compliance. Whether it refuses what it should, whether it wrongly refuses what it should not, and whether it leaks evaluation instructions or internal material. Safety failures are best treated as a veto or a separate gate, not folded into the composite score to be “smoothed out by excellent writing.”
Maintainability. Whether the interface is stable, whether structured output is parseable, whether failure messages are diagnosable, and whether prompt migration is costly. These do not produce leaderboard scores, but they determine whether the team can still change requirements two weeks later.
Experiment protocol: make the comparison hold up
Comparisons must control variables. Keep the system prompt, tool definitions, decoding parameters, retry strategy, and truncation rules consistent; if a model can only work with a different prompt, record the “prompt engineering cost” as integration cost, rather than quietly swapping in a stronger prompt and then claiming the model won.
Sample size should be drawn in a stratified way by business weight. For automatic metrics, give a confidence interval or at least state the sample size; when the gap is smaller than the noise, the conclusion should read “no stable difference observed.” Run multiple times and take the median to avoid a single lucky seed.
Offline evaluation answers “who is better on the historical distribution”; it does not answer “whether users will be more satisfied after launch.” So the protocol reserves an online stage: a small-traffic control, random splitting on the same task, changing only the model and not the product logic, observing task completion rate, human-takeover rate, complaints, and unit cost. When online and offline metrics conflict, defer to the online business result and go back to check whether the evaluation set has drifted from the real distribution.
The illustrative aggregation logic can be plain; what matters is that the gates are explicit and auditable:
for each case in eval_set:pred = call_model(case.prompt, config.frozen)q = score_quality(pred, case.gold, rubric)c = estimate_cost(usage)lat = measure_latency()record(case.id, q, c, lat, safety_flags(pred))pass = (weighted_quality >= Q_min andp95_latency <= L_max andunit_cost <= C_max andsafety_fail_rate == 0 andregression_fail_count == 0)
The gates Q_min, L_max, and C_max come from the business side, not from the evaluators’ preferences. On failure, output the failing slices (which task type, which error type) rather than just a rejection verdict.
Review process and roles
Separate the roles to avoid “writing the questions, scoring, and making the call all by the same person.” The business side defines the tasks and gates; R&D fixes the call configuration and collects usage and latency; the annotation side maintains the gold set and rubrics; the security side signs off separately on refusal and privacy items. A judge model can speed things up, but the gold-set sampling ratio must be stated in advance, and if the spot check disagrees, pause the automatic scoring and fix the rubric first.
Record for each candidate: the model version or service version, the date, the prompt hash, the evaluation set version, the parameters, the summary table, and the bad cases. Artifacts can go to object storage, and the error rate and latency of the run can be wired into monitoring and alerting. If you use general capabilities such as the log service, object storage, and monitoring and alerting on Baidu AI Cloud, treat them only as infrastructure for experiment records and regression; the evaluation conclusion is still determined by the task protocol and the data, not by the platform narrative.
Common pitfalls
Treating a single long-form demo as the capability ceiling. A demo can pick the most favorable prompt and examples; an evaluation must lock the distribution.
“Proving” a cost advantage with incomparable settings. Turning off safety policies, shortening output, or switching to an easier subset all manufacture a false performance-cost ratio.
Ignoring the tail. Average quality goes up while high-weight ticket failures also go up, which shows after launch as more human takeovers.
Folding safety items into a weighted total score. Low-frequency but high-harm mistakes get diluted by a large number of easy questions.
Not updating the evaluation set for a long time. Business phrasing and attack methods change, so the regression set should keep growing from incident tickets and periodically retire leaked or outdated samples.
Treating “open source or deployable” itself as a quality conclusion. Deployability affects data boundaries, capacity planning, and operational responsibility; it still needs validation with the same set of task metrics.
Rollout checklist
- Write clear success criteria with ten to twenty real main-path cases, then expand the sample, rather than picking a model first and finding reasons afterward.
- Freeze the prompt, parameters, tools, and timeout, and record the versions.
- Look at quality, unit cost, P95 latency, error rate, safety failures, and regression failures at the same time.
- Calibrate automatic scoring with the gold set and report the agreement rate.
- After passing offline, run a small-traffic control; on conflict, recheck the distribution.
- Keep the bad cases and the experiment package, so the next upgrade only reruns the protocol and does not rewrite the conclusion narrative.
With this method, the discussion moves from “what does today’s release mean” back to “on our task, is the evidence sufficient.” If the evidence is sufficient, selection has a stopping condition; if it is not, keep adding to the evaluation set and the online control, rather than filling the gap with narrative.
