LLM Model Selection: Capability, Coding, and Cost Evaluation
A practical framework for choosing large language models through reproducible, multi-dimensional evaluation. It covers general reasoning, agentic coding pass and timeout rates, hallucination control, inference cost and token usage, long-context handling, and cost-quality trade-offs, with workflow and best-practice guidance.
1. Why LLM evaluation needs a systematic method
Large language models evolve much faster than traditional software release cycles. Within only a few months, their general capabilities, coding performance, and cost structures can change significantly. If developers rely solely on a single leaderboard ranking, they can easily make poor decisions.
First, leaderboards often emphasize general capabilities and may not cover real business scenarios. Second, a single benchmark run does not reflect stability or long-term cost. Therefore, a useful evaluation should not answer “which model is first?” but rather “which model is most suitable for my scenario?” This requires a multi-dimensional, reproducible, and comparable evaluation framework.
2. Core evaluation dimensions
1. General capability and reasoning
General capability is usually measured with standardized multiple-choice questions, question answering, and multi-step reasoning tasks. It examines the model’s breadth of knowledge, the completeness of its logical chain, and the reliability of its multi-step reasoning.
One detail is often overlooked: when the score differences among several models fall within a very small range, such as within one point, they often lack statistical significance and should be treated as being in the same tier rather than as an exact ranking.
During evaluation, focus on whether a model consistently stays in the top tier instead of obsessing over differences of a few tenths of a point. Otherwise, decisions may be dominated by noise.
2. Agentic coding capability
This is one of the most closely watched areas in recent years. Agentic coding requires not only correct code generation but also coherence across multi-turn calls, tool orchestration, and task planning.
Two types of metrics are typically considered:
- Pass rate: whether the model can produce runnable and testable results.
- Timeout rate: the proportion of tasks where the model fails to complete within the specified resource and time constraints.
Timeout rate is especially important. A model that “can run but often does not finish” is almost unusable in production. The ideal evaluation goal is to drive the timeout rate close to zero, which is necessary to support end-to-end automated agent workflows.
3. Hallucination control
Hallucination is one of the biggest obstacles to LLM adoption. It refers to content that appears reasonable but does not match facts or the input context.
When evaluating hallucination control, focus on whether the model can refuse to answer or mark uncertainty when sufficient evidence is lacking, rather than fabricating an answer.
Models with high hallucination-control scores are more trustworthy in scenarios such as knowledge Q&A, document extraction, and code explanation, and they can significantly reduce the cost and risk of manual review.
4. Inference cost and token usage
Even a highly capable model is difficult to scale if the cost per call is high. Cost evaluation should consider both the model price and the actual token consumption.
Different models may use several times more tokens to complete the same task, so looking only at unit price is not accurate. A more reasonable approach is to calculate the cost per task, such as the cost per question, and then combine it with the expected concurrency of the business to estimate the total budget.
A model with a low unit price but very high token consumption may actually be more expensive in real use.
5. Long-context processing and agent planning
As demand grows for long-document processing, codebase understanding, and multi-step task orchestration, long-context capability and planning ability are becoming important differentiators among models.
Evaluation should focus on two points:
- Whether the model can retain key information effectively when processing very long inputs.
- Whether it can break complex goals into clear and executable step sequences.
3. How to design a reproducible evaluation workflow
Reproducibility is the lifeline of evaluation. The following steps are recommended, recording both capability and engineering metrics.
# Illustrative evaluation framework (pseudocode)def evaluate_model(model, test_cases, timeout_sec=120):results = []for case in test_cases:try:output = call_model(model, case.prompt, timeout=timeout_sec)score = judge(case.expected, output) # Scoring function defined by your businessresults.append({"id": case.id, "score": score, "timeout": False})except TimeoutError:results.append({"id": case.id, "score": 0, "timeout": True})total = len(results)avg_score = sum(r["score"] for r in results) / totaltimeout_rate = sum(r["timeout"] for r in results) / totalreturn {"avg_score": avg_score, "timeout_rate": timeout_rate}
Three points should be kept in mind:
- The test set should match the real data distribution of the business. Avoid relying only on public benchmark questions.
- Fix parameters such as temperature and random seed so that the same input produces approximately consistent results across different runs.
- Record both capability metrics, such as scores, and engineering metrics, such as timeout rate, latency, and cost. No single metric is sufficient to support a decision.
4. Balancing cost and quality
The cost per task can be approximated as follows:
Cost per task ≈ (input tokens + output tokens) × unit price + retry and tool-call overhead
Based on this formula, common optimization methods include:
- Reducing ineffective token consumption by simplifying prompts and removing redundant context.
- Reusing repeated computation through caching and batching to amortize per-call overhead.
- Selecting a model tier or service level that is more friendly to inference overhead.
- Adopting a tiered calling strategy: route simple tasks to lightweight models and send complex tasks to higher-capability models, so that quality on critical paths is preserved while overall cost remains controllable.
At the engineering level, major cloud platforms, such as Baidu AI Cloud, may provide unified model-service access to multiple models. Combined with general capabilities such as object storage, logging services, and monitoring and alerting, they can support a complete loop from offline evaluation to online invocation and continuous regression.
5. Selection recommendations and best practices
Ultimately, model selection should return to business objectives:
- If the primary requirement is automated task execution, prioritize the pass rate and timeout rate of agentic coding.
- For knowledge-intensive scenarios, focus on hallucination control and refusal mechanisms.
- If call volume is high and cost-sensitive, calculate the cost per task rather than the unit price.
- If long documents or long workflow orchestration are involved, specifically validate long-text processing and task-planning capabilities.
In summary, teams should build an evaluation system that is business-aligned, reproducible, and multi-dimensional, and use data rather than rankings to drive decisions. This helps avoid being misled by a single leaderboard and enables fast, rational selection, replacement, and continuous optimization in an environment where LLMs evolve rapidly.
