Practical LLM Selection: A Systematic Evaluation Method from Scenarios to Costs
Selecting the right Large Language Model (LLM) requires shifting focus from "the most powerful" to "the most suitable." This article introduces a systematic evaluation method for LLM selection, covering how to translate business requirements into measurable metrics, build custom evaluation datasets, and implement a unified evaluation pipeline to balance task quality, latency, compliance, and cost.
I. The Essence of Selection: From “The Strongest” to “The Most Suitable”
The capability differences among large language models can no longer be summarized by a single ranking. A model that excels at code generation may not perform stably in long-document summarization or specific industry terminology. Therefore, model selection is primarily an engineering decision: finding a solution with the lowest overall cost and controllable risk under given task, budget, latency, and compliance constraints.
Many teams start by directly referring to public leaderboards and choose the highest-scoring model before considering integration. The problem with this approach is that the task distribution on public leaderboards often mismatches business data, meaning leaderboard scores cannot directly map to online performance. Leaderboards can be used to narrow down the candidate pool but cannot replace validation tailored to your specific business.
II. Translating Business Needs into Measurable Metrics
Before selection, you need to break down vague requirements into measurable metrics. Common breakdown dimensions are as follows:
| Dimension | Questions to Answer | Common Metrics |
|---|---|---|
| Task Quality | Is the output correct, complete, and compliant? | Accuracy, recall, manual pass rate |
| Format Reliability | Can it consistently output specified structures? | Structural validity rate, field completeness rate |
| Response Latency | Is the wait time acceptable to users? | Time to first token (TTFT), P95 total time |
| Throughput & Concurrency | Can it handle peak request volumes? | Requests per second (RPS), queuing time |
| Cost per Call | What is the expense per invocation? | Cost per 1,000 calls, monthly total cost |
| Compliance & Deployment | Can data leave the local environment or designated region? | Deployment method, data retention policy |
Once metrics are defined, passing thresholds must be set for each dimension. For example, a customer service Q&A scenario might require a factual error rate below a specific threshold, while a content moderation scenario might prioritize recall—preferring to flag more items for manual review. Without passing thresholds, evaluation results only yield a ranking and cannot support deployment decisions.
Priorities exist among these dimensions. Compliance is typically a veto factor; solutions that do not meet requirements are directly excluded and do not participate in weighted comparisons. Other dimensions can be weighted according to business importance. For instance, latency carries a higher weight in real-time interactive scenarios, while cost holds a higher weight in offline batch processing scenarios.
III. Building a Custom Evaluation Dataset
3.1 Sample Sources
Prioritize using desensitized samples from real business traffic, as they best represent the online distribution. If lacking data during the cold start phase, business experts can write questions covering typical scenarios and supplement them with boundary samples—such as incomplete input information, ambiguous expressions, or sensitive content. Boundary samples often best expose model differences.
3.2 Stratified Sampling and Sample Size
Perform stratified sampling based on intent type, task difficulty, and input length to ensure sufficient samples in each stratum. A few dozen samples only reveal general trends; supporting deployment decisions usually requires several hundred samples or more. Additionally, a portion of the samples should be retained and not used in any prompt tuning, serving as a final validation set to prevent evaluation results from being artificially high due to overfitting.
3.3 Scoring Methods
- Rule-based Scoring: Suitable for tasks with standard answers, such as field extraction, classification, and numerical calculation. Results are reproducible and cost-effective.
- Manual Scoring: Suitable for open-ended generation. Requires detailed scoring guidelines and calculating inter-annotator agreement through multiple reviewers. Low agreement indicates the guidelines need revision.
- Model-assisted Scoring: Another model scores the output according to specific rules. It is cost-effective and fast, but the reviewing model has its own biases—for example, a tendency to prefer longer, more eloquent responses. Therefore, regular manual spot-checks for calibration are necessary.
3.4 Evaluation Pipeline Illustration
The code below demonstrates a unified evaluation pipeline. Business code relies only on a unified calling interface, with provider-specific differences encapsulated in the client. When replacing candidate models, the evaluation script requires no modification.
import timedef evaluate_candidate(client, dataset, scorer):records = []for sample in dataset:start = time.perf_counter()try:# A lower temperature helps improve the reproducibility of resultsoutput = client.generate
