Large Language Model Selection and Evaluation: A Practical Framework for Balancing Capability and Cost
Choosing an LLM is not about picking the "strongest" model but about matching the right combination of models to specific tasks. This guide explains why model quality is multidimensional rather than a single scalar, breaks evaluation into five core dimensions (task fit, output quality and correctness, speed as TTFT and TPS, cost structure, and deployability), and shows how to turn subjective impressions into objective, repeatable metrics. It walks through building a business-aligned evaluation set, measuring throughput and cost accurately, running A/B tests and shadow traffic, and avoiding common pitfalls such as relying on leaderboards or optimizing speed at the expense of accuracy. It closes with best practices—model routing, observability, fallback chains, and periodic regression evaluation—for integrating selection into a "evaluate, canary, monitor, iterate" engineering loop.
1. Why “Which Model Is Stronger” Has No Standard Answer
Feedback from real-world usage reveals a recurring pattern: the same model that performs well on creative, brainstorming-style tasks may be completely replaced by a faster, cheaper model on engineering tasks that involve actual execution. Meanwhile, on demanding tasks like complex mathematical reasoning, the differences between models appear in entirely different ways—and even versions within the same model family can be hard to rank simply.
The underlying reason is a basic fact: model capability is not a one-dimensional scalar but a multi-dimensional vector. The “awkwardness” users feel comes from measuring a multi-dimensional object against a single evaluation dimension. The first step in evaluating a model, therefore, is not ranking it but defining the task.
Three types of misjudgment show up repeatedly in practice:
- Over-reliance on leaderboards: The task distribution on public benchmarks often diverges from your real business distribution. Leading a ranking does not mean leading in your scenario.
- Over-focus on speed or quality: Fixating on a single dimension ignores the business’s tolerance for latency, cost, and stability. A fast model with insufficient accuracy drives up rework costs; a high-quality model with unacceptable latency directly breaks the interaction experience.
- One-time evaluation: Model iteration cycles are measured in months or even weeks. Conclusions drawn six months ago may already be obsolete, so the evaluation system must be repeatable and updatable.
2. Evaluation Framework: Five Core Dimensions
2.1 Task Fit
Different tasks place vastly different demands on a model. They fall into roughly three categories:
- Creative brainstorming: Requires diversity, coherence, and the ability to make associative leaps. Factual accuracy requirements are relatively loose; the goal is to “open up ideas.”
- Engineering execution: Requires strict instruction following, structured output, and runnable code. Error tolerance is low, and mistakes translate directly into rework.
- Deep reasoning: Requires long-chain reasoning, self-verification, and resistance to hallucination. A single-step error accumulates and amplifies along the reasoning chain, rendering the final conclusion unusable.
A single model’s relative position across these three categories can differ completely, which is exactly why “cross-scenario head-to-head comparisons” tend to produce contradictory conclusions.
2.2 Output Quality and Correctness
Quality assessment should be as objective and metric-driven as possible:
- Structured output: JSON Schema compliance rate, field completeness rate, and type-correctness rate.
- Code tasks: Compilation pass rate, unit test pass rate, first-attempt pass rate (pass@1), and stability across multiple samples.
- Text tasks: Factual consistency, citation traceability, and readability, which can be scored with a human rubric.
- Math and logic tasks: Correctness of the conclusion, verifiability of the proof, and whether “plausible-looking but step-skipping” pseudo-proofs appear.
2.3 Speed: TTFT and TPS Must Be Looked at Separately
- Time to first token (TTFT): Determines the interaction experience; it is the main driver of how “fast or slow” users perceive the system to be.
- Output rate (tokens per second, TPS): Determines the actual time to generate long text or code.
- End-to-end latency ≈ TTFT + (output token count ÷ TPS). In long-output tasks, the impact of TPS is significantly amplified; in short Q&A and instruction-following interactions, TTFT is often more critical.
Data that reports only an “average TPS” without distinguishing concurrency, input/output length, or deployment form has limited reference value.
2.4 Cost Structure
Cost cannot be judged by unit price alone—you need the total bill:
- Billing basis: Input tokens, output tokens, cache hits, and batch calls are priced differently.
- Non-linear impact of context length: In long-document tasks, input-side cost may far exceed output-side cost. Techniques like retrieval augmentation and context compression directly affect total cost.
- Hidden costs: A low first-attempt pass rate means repeated calls and manual review. The cost of retries and error correction is often underestimated.
2.5 Deployability and Controllability
- Managed API: Ready out of the box with good elasticity, suited for rapid validation and scenarios with fluctuating traffic, but limited in data egress and deep customization.
- Dedicated/private deployment: Data is controllable and can be deeply optimized, but hardware and operations costs are high. Actual throughput must be confirmed by load testing under real workloads—theoretical values should not be copied directly.
- Hybrid form: Sensitive data is processed locally, general tasks run in the cloud, balancing compliance and cost.
3. Scenario Breakdown: The Optimal Choice Differs by Task
3.1 Brainstorming: Seek Divergence, Not Convergence
The core requirement of creative tasks is diversity and breadth of association, not accuracy at a single point. Here you can reasonably relax factual constraints and focus on whether the model offers differentiated ideas across multiple samples rather than identical, templated answers. A recommended evaluation approach is “multiple sampling + human-rated usable rate.”
3.2 Code and Engineering Tasks: Correctness First, Speed Second
Engineering tasks have zero tolerance for errors, so evaluation should make executability the top criterion: whether it compiles, whether it passes tests, and whether edge cases are covered. Speed is important but not the primary weight—a model that is 5x faster but significantly less accurate may carry a higher total cost, because the cost of rework, debugging, and human intervention can cancel out the speed gains.
3.3 Complex Reasoning and Math: The Value of Long Chains of Thought
For high-difficulty reasoning tasks, the key is not “answering fast” but whether the reasoning process is verifiable. Evaluation should focus on whether intermediate steps are complete, whether step-skipping or loops occur, and whether conclusions are reproducible. These tasks place the highest demands on a model’s ceiling and are where differences between models are most pronounced, making them ideal probes for “capability ceiling.”
3.4 Long-Form Writing and Structured Output
Long-form tasks test both TPS (generation time) and context retention (front-to-back consistency). Evaluation should construct questions involving cross-paragraph references, citations, and constraint retention, observing whether the model “forgets” earlier constraints in the later portions of a long output.
4. Turning “Feeling” into “Metrics”: Building Your Own Evaluation System
4.1 Build an Evaluation Set Aligned with Your Business
- Sample from real call logs, tickets, and user feedback to ensure the question distribution stays close to the business.
- Use stratified sampling: combine simple, medium, and difficult tiers to avoid a set composed entirely of hard questions, which weakens discriminative power.
- Version-control the evaluation set and periodically add new samples to prevent “leaderboard-style overfitting.”
4.2 Metric Definitions and Scoring
- Objective metrics: Pass rate, compliance rate, average latency, P95 latency, and average token consumption.
- Subjective metrics: Four-dimensional rubric scoring on relevance, completeness, readability, and factual accuracy.
- Blind comparison: Have multiple models answer the same set of questions anonymously, then have humans or a strong model act as judge to rank them, reducing the influence of brand priors.
4.3 Evaluation Code Skeleton (Illustrative)
# Evaluation flow: task definition -> multiple sampling -> scoring -> aggregationTASKS = [{"id": "code_001", "type": "code", "prompt": "...","tests": ["assert result == expected"]},{"id": "qa_001", "type": "qa", "prompt": "...","rubric": ["relevance", "factual accuracy", "completeness"]},]def evaluate(model_client, task, k=3):scores, latencies = [], []for _ in range(k): # multiple sampling to observe stabilityout = model_client(task["prompt"])if task["type"] == "code":ok = all(run_tests(out, t) for t in task["tests"])scores.append(1.0 if ok else 0.0)else:scores.append(judge(out, task["rubric"]))latencies.append(measure_latency())return {"task_id": task["id"],"pass_rate": sum(scores) / k,"avg_latency": sum(latencies) / k,}def summarize(model_name, records):return {"model": model_name,"pass_rate": mean(r["pass_rate"] for r in records),"p95_latency": percentile([r["avg_latency"] for r in records], 95),}
4.4 A/B Testing and Shadow Traffic
Online, you can start with a small-traffic canary release, comparing business metrics such as adoption rate, edit distance (how far human edits drift from the output), and rework rate. Shadow traffic lets a new model process real requests without affecting users, comparing its results against the old model to accumulate online evidence.
5. Performance and Cost Estimation: Get TPS and Tokens Right
5.1 How to Measure Throughput
- Fix input and output lengths, run continuous load tests, and record the mean, P50, and P95 of TPS rather than reporting only the peak.
- Distinguish single-concurrency from multi-concurrency: high TPS at single concurrency does not mean throughput holds up under high concurrency.
- Pay attention to tail latency: long-tail requests often determine the worst-case experience.
5.2 Cost Formulas
Cost per call ≈ input tokens × input price + output tokens × output price+ retry count × cost per call + deployment/ops amortizationTotal cost ≈ Σ(cost per call per scenario × call volume) + labor and ops cost
In long-context tasks, input-side cost may dominate, so context compression and retrieval augmentation should be evaluated first. In high-concurrency tasks, insufficient throughput causes queuing, which indirectly drives up latency and scaling costs.
5.3 Trade-offs Across Deployment Forms
Managed APIs offer good elasticity and low upfront investment, suited for rapid validation. Dedicated/private deployment may offer lower unit cost under long-term, high-frequency calls, but throughput must be confirmed through load testing on real workloads, and hardware, operations, and iteration labor costs must be counted. Hybrid deployment can route traffic by data sensitivity.
6. Common Pitfalls and Best Practices
Pitfalls:
- Using leaderboard rankings in place of business evaluation.
- Looking only at speed without checking whether it comes at the cost of accuracy.
- Ignoring the cumulative cost of long contexts and multi-turn conversations.
- Relying on a one-time evaluation conclusion for a long time without updating it as models iterate.
- Equating model capability with product experience, ignoring the contribution of engineering work (routing, retries, fallback, caching).
Best practices:
- Establish a model routing strategy: dispatch by task type to different models or tiers.
- Establish observability: log the tokens, latency, success rate, and human feedback for every call.
- Establish a fallback chain: automatically switch to a backup when the primary model fails, ensuring availability.
- Establish periodic regression evaluation: run the same evaluation set after each model upgrade to quantify changes.
7. Enterprise Adoption: Engineering Practices Combined with Cloud Capabilities
Model selection is never an isolated decision; it must work with cloud infrastructure capabilities to form a “evaluate–canary–monitor–iterate” loop:
- Model service platform: Uniformly onboard multiple model tiers, supporting elastic scaling and traffic scheduling.
- Container platform: Host inference services, with auto-scaling to handle traffic fluctuations.
- Logging services and monitoring/alerting: Collect call-chain, latency, and error-rate data, and set threshold-based alerts.
- Message queue: Smooth out traffic peaks and troughs, and handle long-text generation and batch evaluation tasks asynchronously.
- Object storage: Store evaluation sets, prompt templates, and archived results.
Taking Baidu AI Cloud as an example, developers can build the loop described above using its model service capabilities together with general cloud product capabilities. For specific specifications, pricing, and quotas, refer to the official documentation; this article makes no specific commitments.
8. Conclusion
Selection is not about choosing the “strongest model” but about choosing the combination that best fits the task. Teams should follow five principles:
- Define the task and metrics first, then select the model.
- Use your own evaluation set for objective validation rather than relying on leaderboards.
- Use a cost model for long-term estimates, calculating the total bill rather than unit price.
- Use engineering techniques (routing, fallback, caching, observability) to amplify model value.
- Keep evaluation continuously updated to keep pace with model iteration.
Once an evaluation system is in place, the question of “how to evaluate a given model” shifts from subjective debate into a quantifiable, reproducible, and sustainable engineering decision.
