LLM Selection Guide: A Systematic Evaluation Approach from Requirements to Deployment
Selecting an LLM requires more than choosing the top model on a public leaderboard. This guide presents a systematic process from task definition to production evaluation: clarify input/output formats, latency, accuracy, concurrency, and compliance requirements; build a representative evaluation set from real business data; combine automated checks with blind human review; and track quality together with latency, failure rate, and stability. It also includes a compact Python harness for batch-testing candidate models.
1. Why Model Selection Is Getting Harder
Over the past year or two, the number of usable large models has increased noticeably. Open-source communities, cloud platforms, and model inference services continue to release new versions, and there are clear differences between different sizes and versions from the same provider. As the choice set grows, the cost of making a decision rises.
A common approach is to open public leaderboards and pick the top-ranked model. This can narrow the field quickly, but it has three limitations. First, leaderboards measure general capabilities, which may not match a specific business task. Second, leaderboard scores are usually based on fixed prompts and fixed test sets; in real use, changes in prompt wording, context length, and input distribution can change the result. Third, models iterate quickly, so a ranking from six months ago may not apply today.
A more reliable approach is to use leaderboards as a screening tool for the candidate pool and base the final decision on your own data.
2. Define the Task Before Discussing Models
Selection starts with task definition. Text summarization, structured information extraction, code generation, multi-turn customer service, and complex reasoning place very different demands on a model, and they cannot be measured with the same yardstick.
It is worth answering the following questions first:
- What are the input and output formats? Is it free-form text, or does it require stable structured output such as JSON?
- What are the average and maximum input lengths per request? Does the task need to handle long documents?
- How high is the requirement for factual accuracy? Would an incorrect answer have a minor impact or cause direct loss?
- What is the latency budget? What time to first token and full response time can users accept?
- What are the concurrency and peak traffic levels? How many calls are expected per day?
- Does the task involve sensitive data, personal information, or regulated industry scenarios?
Answering these questions clearly usually reduces the candidate set by more than half. For example, in a latency-sensitive scenario, even the most capable model may not be suitable. In that case, a smaller model combined with retrieval augmentation is often a more reasonable option.
3. Build an Evaluation Set
The evaluation set is the core asset in model selection. It should come from real business data and cover the main task types and edge cases.
In practice, it can be built as follows:
- Sample from business logs or business systems. Use no fewer than 50 samples per task type, with a total usually between 200 and 500.
- Stratify the samples to ensure coverage of high-frequency scenarios, low-frequency but high-risk scenarios, and anomalous inputs.
- Write a reference answer or scoring criteria for each sample. For open-ended tasks, a rubric is more practical than a single standard answer; it can be divided into sub-items such as accuracy, completeness, format compliance, and tone/style.
- Hold out some samples from any tuning and use them as the final validation set, so the evaluation results are not overfitted.
- Record sample sources and de-identification status to ensure the evaluation data itself meets compliance requirements.
As the business changes, old samples become less representative, so the evaluation set needs to be updated periodically.
4. Evaluation Methods and Metrics
Evaluation can be divided into automated evaluation and human evaluation.
Automated evaluation is suitable for tasks with clear answers, such as classification, extraction, and numerical calculation. Common metrics include accuracy, recall, F1 score, and format compliance rate. For structured output, a parser can directly validate whether the returned content passes rule checks.
Human evaluation is suitable for open-ended generation tasks. A blind review approach is recommended: reviewers do not know which model produced the output and score it on a unified scale. To reduce subjective bias, each sample should be scored independently by at least two reviewers, and inter-rater agreement should be calculated.
In addition to quality metrics, engineering metrics should also be recorded:
- Time to first token and full response latency, reported as P50 and P95 separately;
- Input and output token counts per request;
- Failure rate, including timeouts, rate limiting, and abnormal responses;
- Stability of results when the same input is called multiple times.
Below is a simplified evaluation script framework for batch-calling candidate models and aggregating results. The model call function needs to be replaced with the actual service integration logic.
import timeimport statisticsfrom dataclasses import dataclass@dataclassclass EvalResult:model: strsample_id: stroutput: strlatency_ms: floatscore: floatdef call_model(model_name: str, prompt: str) -> str:# Replace with the actual model call logic, such as calling a unified inference APIraise NotImplementedErrordef score_output(output: str, reference: dict) -> float:# Implement scoring by task type: exact match, rule validation, or reviewer scorereturn 0.0def run_eval(models: list[str], samples: list[dict]) -> dict:results: list[EvalResult] = []for model in models:for sample in samples:start = time.perf_counter()try:output = call_model(model, sample["prompt"])except Exception:output = "" # Record failed samples as empty output and include them in the failure ratelatency = (time.perf_counter() - start) * 1000score = score_output(output, sample["reference"])results.append(EvalResult(model, sample["id"], output, latency, score))summary = {}for model in models:rows = [r for r in results if r.model == model]if not rows:continuesummary[model] = {"avg_score": statistics.mean(r.score for r in rows),"avg_latency_ms": statistics.mean(r.latency_ms for r in rows),"failure_rate": sum(1 for r in rows if r.output == "") / len(rows),}return summary
