How to Choose and Evaluate Large Language Models: A Practical Methodology
This article presents a reusable methodology for selecting and evaluating large language models under real constraints such as latency, context length, tool calling, cost per task, and data compliance. It breaks evaluation into measurable metrics, shows how to build an automated evaluation pipeline, and explains how to interpret results beyond the overall score by looking at domain-level differences, the decoupling of latency and cost, and evaluation bias. It also offers scenario-based selection advice and a practical checklist for avoiding common mistakes.
1. Background: Model Selection Under Cost Pressure
Over the past two years, large language models have improved rapidly, but the API and subscription prices of top-tier closed-source models remain high. This puts small and mid-sized teams, individual developers, and enterprises running large-scale batch workloads under real budget pressure. As a result, “Is there a more cost-effective alternative?” has become a recurring question in engineering practice.
The key point is that this is not a question of “which model is better,” but of “which model is more suitable under given constraints.” Constraints typically include acceptable latency per request, context length requirements, the stability of tool calling and structured output, cost per task, and data compliance requirements. Making these constraints explicit is what makes selection discussable in the first place.
2. Evaluation Dimensions: From Vendor Claims to Verifiable Metrics
When vendors release a new version, they usually highlight a few improvement areas, such as a larger context window, better adaptation to coding scenarios, tool calling during reasoning, stronger agentic task performance, or writing styles closer to human preferences. These descriptions help set expectations, but they cannot serve as a direct basis for selection and must be translated into measurable items.
At a minimum, cover the following five categories of metrics:
- Accuracy: Pass rate on a fixed question set, observed per domain so that a total score does not hide weak areas.
- Response latency: End-to-end average time, with attention to the long tail (P95/P99), because averages easily hide timeouts.
- Token consumption: Average input and output tokens per call, which directly determines cost and throughput.
- Cost per unit: Cost per thousand calls, determined jointly by token consumption and unit price.
- Stability and consistency: Variance across repeated samples of the same input, and the parse success rate of structured output (such as JSON).
Any specific numbers must be measured by the user in the target scenario. Public data from different vendors and versions cannot be compared directly, because question sets, sampling parameters, system prompts, and network conditions all significantly affect results.
3. Building a Reusable Automated Evaluation Pipeline
Manual spot checks cannot support continuous selection, so it is recommended to build a repeatable pipeline. The core idea is: fixed question set + fixed parameters + unified parsing + metrics stored in a database.
Illustrative code (pseudocode, expressing the flow only):
# 1. Fix the evaluation configuration to ensure cross-version comparabilityCONFIG = {"temperature": 0.0, # disable randomness during evaluation"max_tokens": 2048,"timeout": 120,"retry": 2,}def run_eval(model_client, dataset, config=CONFIG):records = []for case in dataset: # case: {prompt, expect, domain}t0 = time.time()resp = model_client.chat(case["prompt"], **config)cost_ms = (time.time() - t0) * 1000ok, parsed = judge(case["expect"], resp) # rule-based or model reviewrecords.append({"domain": case["domain"],"correct": ok,"latency_ms": cost_ms,"in_tokens": resp.usage.prompt_tokens,"out_tokens": resp.usage.completion_tokens,"raw": parsed,})return aggregate(records) # aggregate accuracy/latency/cost by domain
Three engineering points also matter. First, the question set must be large enough; only tens of thousands of samples make domain-level differences statistically meaningful. Second, the scoring function should distinguish between questions that can be judged automatically and those that require human or model review, to avoid scoring noise. Third, all raw responses should be retained to make it easier to review failure cases.
4. Interpreting Results: Three Angles Beyond the Total Score
Suppose a new version improves accuracy from about 66% to about 69% on a question set of tens of thousands of items, moves up clearly in the ranking, reduces average time from nearly a hundred seconds to about sixty seconds, and slightly lowers token consumption and cost per thousand calls. Such results are usually read as “across-the-board improvement,” but a rigorous interpretation should have three layers.
Layer one: look at domain divergence. A total score improvement is often driven by a few domains. A common pattern is noticeable gains in areas such as law and administrative affairs, education, finance, healthcare and mental health, and reasoning and mathematical computation, alongside slight declines in language and instruction following, and agentic and tool calling. This contrasts with the vendor’s emphasis on “stronger agentic capabilities,” indicating that version iterations involve capability trade-offs rather than monotonic improvement.
Layer two: look at the decoupling of latency and cost. A roughly 40% drop in latency is a clear experience-level improvement, but it does not necessarily reduce cost; a real cost reduction depends on token consumption falling at the same time. If outputs become longer, the gains from latency optimization will be offset.
Layer three: look at bias in the evaluation method itself. An accuracy improvement sometimes comes from a more “pleasing” output style rather than more correct facts, so a human spot-check step should be kept in addition to automatic scoring.
5. Scenario-Based Selection Advice
- Long documents and knowledge base Q&A: Prioritize verifying effective utilization under long context rather than the nominal window size. A “key information insertion” test can assess the model’s ability to locate details in long inputs.
- Code and AI coding tool integration: Focus on multi-turn modification, cross-file understanding, and tool calling success rate, and watch the parse failure rate of structured output.
- Agentic and search-type tasks: Examine multi-step planning, correct tool selection, and fallback ability on failure; these capabilities are more sensitive to latency.
- High-concurrency batch processing: Use cost per thousand calls as the primary metric, and evaluate real throughput together with rate limiting and retry strategies.
For cloud deployment, general-purpose capability combinations can carry both evaluation and online serving: object storage holds question sets and response logs, a message queue smooths traffic peaks, a container platform hosts inference services and elastic scaling, and logging and monitoring with alerting handle latency and failure-rate observation. General-purpose capabilities from cloud vendors such as Baidu AI Cloud can serve as the underlying foundation, but the specific selection should still be based on your own load test results.
6. Common Mistakes and a Practical Checklist
Common mistakes include: looking only at the total score and not at domains; using averages instead of long-tail metrics; not fixing sampling parameters when comparing versions; treating nominal context length as effective context; and ignoring the error in the scoring function itself.
Practical checklist: fix the question set and configuration; build a metrics dashboard; run the same regression suite on every version upgrade; retain failure samples for root-cause analysis; and tie the cost model to business call volume to form a predictable budget.
