LLM Selection Guide: Building a Reproducible Evaluation Framework
Learn how to evaluate large language models against real business tasks rather than aggregate rankings. This guide covers capability dimensions, reproducible test sets, a minimal Python evaluation framework, result interpretation, and the cost, security, and reliability considerations needed for deployment.
1. Why Aggregate Rankings Are Not Enough
Many model comparison articles conclude with an overall score or leaderboard ranking. The problem is that an aggregate score compresses several different capabilities into a single number. It does not tell readers where a model will perform well—or poorly—in their own applications.
A model that excels at mathematical reasoning may produce unremarkable marketing copy. Another may score highly on general question answering but make substantially more errors when interpreting contracts packed with industry terminology. The first step in model selection is therefore to break “overall capability” down into specific tasks and evaluate each one separately.
Published scores also often lack essential testing details: dataset size, question sources, scoring criteria, and prompt templates. Without this information, results cannot be reproduced or compared reliably. Engineering teams should treat reproducibility as a basic requirement for a credible evaluation.
2. Define the Capability Dimensions
LLM capabilities can be divided into several relatively independent dimensions. Each should have a clear definition, relevant business scenarios, and measurable indicators.
2.1 Chinese-Language Understanding
Chinese-language understanding measures a model’s ability to interpret meaning, context, and implied intent. Typical tests include:
- Coreference resolution: Identifying which person a pronoun refers to in a long passage.
- Syntactic ambiguity: Interpreting a phrase that, depending on its structure, could describe a dog that killed a hunter or a hunter’s dog that was killed.
- Idioms and classical language: Correctly interpreting and using idioms, sayings, and classical Chinese.
- Informal and online language: Recognizing abbreviations, homophones, and sentences with omitted subjects.
An evaluation should cover these subcategories and report accuracy for each. A single question type should not stand in for overall Chinese-language capability.
2.2 Logical Reasoning
Logical reasoning is the ability to apply rules through multiple steps. It is relevant to mathematical word problems, conditional judgments, causal analysis, and code debugging.
Test questions should be grouped by difficulty and ask the model to provide an explanation of its solution. Checking only the final answer does not distinguish between a sound method with an arithmetic mistake and a fundamentally incorrect approach. These failures require different remedies.
2.3 Creative Generation
Creative generation is particularly difficult to evaluate because judgments of quality are subjective. Three methods can reduce that subjectivity:
- Set explicit constraints. Specify length, style, audience, and required elements, then check whether the output satisfies them.
- Use pairwise comparisons. Ask reviewers to choose the better of two outputs rather than assign absolute scores.
- Sample each prompt multiple times. Examine both output diversity and consistency.
2.4 Long-Context Processing
Long-context capabilities include information extraction, summarization, question answering, and reasoning across sections of lengthy documents.
Evaluation should address two questions:
- Can the model accurately locate key information in the context?
- Does output quality decline substantially as input length increases?
A common approach is to place the same fact at different positions in separate test versions of a long document and compare recall when it appears near the beginning, middle, or end.
2.5 Domain-Specific Capabilities
Fields such as law, medicine, finance, and education have higher accuracy requirements. General-purpose tests cannot replace domain-specific evaluation.
Domain experts should help write questions and score responses. Explicitly acknowledging uncertainty should be a separate scoring criterion. In high-risk settings such as medicine and law, declining to answer or recommending professional advice may be more appropriate than providing a confident but incorrect response.
2.6 Response Latency and Throughput
Report latency using percentiles, not just averages. Two services with similar average response times can have P95 or P99 latencies that differ severalfold, directly affecting user experience.
Throughput matters for capacity planning under concurrent workloads. Tests should use input lengths and concurrency levels that match production conditions; otherwise, the results offer little practical guidance.
2.7 Cost and Stability
Cost includes usage-based pricing, average token consumption per task, and hidden expenses caused by retries and failures.
Stability covers output consistency for the same input across different times, as well as service availability. These factors are often overlooked, yet they frequently determine whether a project can operate sustainably.
3. Build a Reproducible Evaluation Dataset
The evaluation dataset is the foundation of model selection. A useful dataset should meet the following requirements.
3.1 Data Sources and Difficulty Levels
Use real business data wherever possible, after removing sensitive information. Within each capability dimension, group questions into difficulty levels—for example, easy, medium, and hard—and retain enough samples in each group.
With too few samples, random variation on a single question can determine the final result.
3.2 Separation from Training Data
If evaluation questions already appear in public datasets, a high score may reflect memorization rather than capability.
Keep a portion of the test set private and update it periodically to reduce the impact of data contamination.
3.3 Standardized Prompt Templates
For the same task, use identical prompts across models, including system instructions, examples, and output-format requirements.
Prompts can substantially influence results. If different models receive different prompts, the comparison no longer isolates model performance. Keep templates under version control and record the template version used in every evaluation.
3.4 Written Scoring Criteria
Define each question’s scoring rules before testing. Objective questions can be scored automatically. Subjective tasks require a written rubric, independent scoring by at least two reviewers, and a measure of inter-rater agreement.
If agreement is too low, revise the scoring criteria or remove the question.
3.5 Blind Review
Reviewers should not know which model produced an output. Remove model identifiers and standardize presentation to reduce preconceived judgments.
4. A Minimal Python Evaluation Framework
The following example demonstrates a minimal evaluation framework. call_model is a model-calling function implemented by the team, and judge is the scoring function. Both must be adapted to the actual interfaces and evaluation requirements.
The example uses only the Python standard library for portability.
import timeimport statisticsfrom dataclasses import dataclassfrom typing import Callable, Dict, List@dataclassclass EvalCase:case_id: strdimension: str # Capability dimension, such as "logical reasoning"difficulty: str # Difficulty level: "easy" / "medium" / "hard"prompt: strreference: str # Reference answer or scoring criteriadef run_eval(cases: List[EvalCase],call_model: Callable[[str], str],judge: Callable[[EvalCase, str], float],) -> List[dict]:"""Call the model for each case and record its score and latency."""records = []for case in cases:start = time.perf_counter()output = call_model(case.prompt)latency = time.perf_counter() - startscore = judge(case, output)records.append({"id": case.case_id,"dimension": case.dimension,"difficulty": case.difficulty,"score": score,"latency": latency,})return recordsdef summarize(records: List[dict]) -> Dict[str, dict]:"""Summarize scores by dimension and report latency percentiles."""grouped: Dict[str, List[float]] = {}for r in records:grouped.setdefault(r["dimension"], []).append(r["score"])report = {dim: {"n": len(scores),"mean": round(statistics.mean(scores), 2),"stdev": round(statistics.pstdev(scores), 2),}for dim, scores in grouped.items()}latencies = sorted(r["latency"] for r in records)n = len(latencies)report["latency"] = {"p50": round(latencies[n // 2], 3),"p95": round(latencies[min(n - 1, int(n * 0.95))], 3),}return report
Two points matter when using this framework.
First, run the same batch of questions once for every candidate model, using the same network environment and comparable testing windows. Otherwise, latency measurements may not be comparable.
Second, when the sample size is small, report variability or confidence intervals rather than treating random fluctuations as meaningful performance differences.
5. Interpret the Results Carefully
Once the report is available, avoid the following common mistakes.
5.1 Treating Small Score Differences as Meaningful
A two-point difference in average scores may not be meaningful when score variability is much larger—for example, when the standard deviation is ten points.
Consider both standard deviation and sample size before deciding whether a difference deserves attention. The difference in means alone is not sufficient to establish statistical significance.
5.2 Letting Averages Hide Failure Modes
A high average score does not rule out serious failures. Track the proportion of low-scoring cases separately and review those outputs manually.
For example, a model may perform well on most questions but repeatedly fail at numerical unit conversion. That weakness can be difficult to see in the overall average.
5.3 Ignoring the Quality–Latency Trade-Off
Larger models often deliver higher quality at the cost of longer response times. Whether that trade-off is worthwhile depends on the application.
Real-time conversational products are usually latency-sensitive, while offline batch-processing tasks can tolerate longer execution times.
5.4 Applying Conclusions Beyond Their Scope
Evaluation findings apply only to the tested model version, prompts, and data distribution. Revalidate them after a model update.
6. A Practical Model Selection Process
Use the following steps to move from requirements to deployment:
- Define business objectives. List core tasks, expected user volume, latency requirements, and data sensitivity.
- Choose evaluation dimensions. Select three to five dimensions directly relevant to the application and assign weights.
- Build the evaluation dataset. Prepare questions using the methods above and finalize the scoring criteria.
- Run a small pilot. Compare models on a small portion of real traffic and observe production metrics.
- Estimate costs. Calculate monthly expenses from expected call volume, including retries and failures.
- Roll out gradually. Begin with noncritical use cases, retain a rollback option, and expand incrementally.
- Monitor continuously. Track sampled quality assessments, latency percentiles, and cost changes. Reevaluate quarterly.
7. Engineering Considerations for Deployment
7.1 Data Security and Compliance
Inputs may contain personal information or confidential business data. Before deployment, review the data-processing terms, including whether inputs are used for model training, retention periods, and cross-border transfer requirements.
Remove or mask sensitive fields before sending data to the model.
7.2 Prompt Version Control
Prompts are part of system behavior. Track their revision history as you would source code, and associate every prompt version with its evaluation results so that problems can be traced.
7.3 Fallbacks and Fault Tolerance
Model services can time out or impose rate limits. Design fallback strategies such as switching to a backup model, returning cached results, or routing the task to a human.
Set timeout thresholds according to how long users can reasonably wait rather than relying on defaults.
7.4 Output Validation
Validate structured outputs in application code. For example, check whether JSON can be parsed, required fields are present, and numerical values fall within reasonable ranges.
If validation fails, trigger a retry or log the failure.
7.5 Caching and Cost Control
For frequently repeated queries, application-level caching can reduce model calls.
Cache keys should include both prompt and model versions to prevent a new deployment from returning results generated by an older configuration.
8. Conclusion
Effective LLM selection replaces “Which model is best?” with a more useful question: “For which tasks, at what cost, and at what level of quality?”
Start by separating capability dimensions, then build a reproducible evaluation dataset. Interpret results using latency percentiles, score variability, and sample size, and make the final decision in light of security, cost, and engineering constraints.
This approach does not depend on any particular leaderboard. It remains useful when the candidate models or business requirements change.
