How to Evaluate Large Language Models: A Practical Framework for Model Selection

    This article presents a practical framework for evaluating the overall capabilities of mainstream large language models and selecting the right one for your business. It explains why "overall performance" is hard to define, how to break it down into observable dimensions, and how to build a task-level taxonomy (L1–L5) that drives metric weighting. You will learn how to design a quality–latency–cost–risk scoring system, build a private evaluation set that matters more than public leaderboards, and run specialized assessments for code and long-document scenarios. The article also covers multimodal and tool-calling evaluation, per-task cost modeling, and safe rollout strategies using a model gateway, canary releases, and routing. Finally, it highlights common pitfalls to avoid when turning model selection into a reproducible engineering decision.

    1. Why “Overall Performance” Is Hard to Define

    In real engineering practice, evaluating the overall performance of a class of LLM-based systems often falls into two extremes: relying only on the ranking of a public leaderboard, or drawing conclusions from personal usage experience. Neither approach offers a reproducible evaluation process, so the conclusions cannot be transferred to your own business scenarios.

    A more reasonable approach is to break “overall capability” into several observable dimensions and then score them according to your own business weights. The following aspects usually need to be covered:

    • Complex reasoning and task planning;
    • Code generation, code review, and large-scale repository changes;
    • Long-context understanding, long-document processing, and structured extraction;
    • Multimodal understanding (images, charts, scanned documents, audio, and video);
    • Tool calling and external system orchestration;
    • Naturalness of Chinese expression and creative writing;
    • Stability, latency, rate limiting, and failure recovery;
    • Cost per task and total cost of ownership.

    It is worth emphasizing that the gap between first-tier models is often a difference in scenario fit rather than an absolute capability advantage. The essence of model selection is matching, not ranking.

    2. Task Tiering: First Define What You Want It to Do

    Task tiering must be done before evaluation; otherwise, metrics will conflict with each other. A common tiering approach is as follows:

    1. L1 Basic Q&A and information organization: extraction, summarization, rewriting, classification.
    2. L2 Structured generation: JSON/table output, form filling, rule validation.
    3. L3 Complex reasoning: multi-step calculation, logical deduction, trade-off analysis.
    4. L4 Software engineering tasks: cross-file refactoring, defect localization, test completion, code review.
    5. L5 Multimodal and interactive: image understanding, UI replication, voice and search integration.

    The weights of different tiers are completely different. For enterprises focused on content production, L1/L2 carry more weight; for teams aiming at R&D productivity, L4 carries the highest weight; for products facing end users, L5 and stability carry more weight.

    3. Metric System: Turning “Feel” into Measurable Data

    It is recommended to adopt four categories of metrics: quality, efficiency, cost, and risk.

    Quality metrics can include accuracy, pass rate, human rating (1–5), first-pass rate, and rework rate. Efficiency metrics focus on time to first token, end-to-end latency, and requests processed per minute. Cost metrics should not look only at unit price but should calculate cost per task. Risk metrics include hallucination rate, sensitive content blocking performance, unauthorized tool-calling rate, and output format violation rate.

    A sample score aggregation can be written as:

    1. weights = {"quality": 0.45, "latency": 0.15, "cost": 0.25, "risk": 0.15}
    2. def score(metrics: dict) -> float:
    3. return sum(weights[k] * metrics[k] for k in weights)

    The weights should be jointly reviewed by the business, algorithm, and operations teams, and version records should be kept to avoid “adjusting weights after the fact to fit a conclusion.”

    4. Building the Evaluation Set: A Private Set Is More Valuable Than a Public Leaderboard

    Public leaderboards can only serve as an initial screening. What really determines selection is a private evaluation set, recommended at 200–1,000 items, covering the real distribution and reserving 10% as “hard samples” for stress testing.

    Three points need attention when building it: first, desensitization, to avoid sending business-sensitive data directly to external services; second, reproducibility, fixing random seeds, temperature parameters, and prompt versions; third, regression capability, running the baseline every time the model or prompt changes.

    A minimal viable evaluation loop is as follows:

    1. Collect real requests -> Desensitize and annotate -> Build a tiered evaluation set
    2. -> Batch inference -> Metric calculation -> Manual spot check -> Archive conclusions

    5. Specialized Evaluation for Code and Long-Document Scenarios

    For code scenarios, “whether it runs” is not enough; you need to look at whether the changes are maintainable. It is recommended to introduce four metrics: static checks, unit test pass rate, change impact scope (number of files involved), and review comment density. For large-scale repository changes, also evaluate the recall quality of context retrieval and whether cross-file dependency understanding is accurate.

    Long-document scenarios focus on three points: key information recall rate, cross-paragraph reasoning correctness, and structured output stability. You can use a “multiple rounds of questions on the same document” approach to test consistency; if the same question yields clearly conflicting answers across multiple attempts, it indicates insufficient use of long context.

    6. Multimodal and Tool Calling: Focus on Closed-Loop Completion

    Multimodal capability evaluation should be based on real materials, such as report screenshots, flowcharts, and handwritten scanned documents, examining whether field extraction accuracy and layout understanding are correct. Tool calling should be evaluated on a three-stage performance: “selecting the correct tool, passing correct parameters, and being retryable on failure,” rather than only whether the final answer is fluent.

    In engineering, it is recommended to set timeouts, idempotency, and audit logs for tool calls, host stateless inference services on a container platform, use a message queue for peak shaving, use object storage to store evaluation materials, and use logging services and a monitoring/alerting system to track quality fluctuations.

    7. Cost Modeling: Cost per Task Is the Comparable Measure

    Subscription price is only the surface cost. Enterprises should build a per-task cost model:

    1. Cost per task = (input tokens + output tokens) × unit price + retry cost + manual review cost

    If a solution has a low unit price but a high rework rate, the total cost may actually be higher. Therefore, in budget evaluation, “first-pass rate” and “manual review hours” should be included in the formula. For high-concurrency scenarios, rate-limiting policies and fallback plans also need to be evaluated, such as routing tasks to models of different specifications by tier.

    8. Rollout Strategy: Canary, Routing, and Rollback

    The recommended approach is to build a unified model gateway that hides underlying differences and enables scenario-based routing, canary rollout, and fast rollback. During the canary phase, it is recommended to gradually increase traffic from 5% to 20% to 50%, observing the three core metrics of quality, latency, and cost at each stage.

    The routing strategy can refer to:

    1. def route(task_level, budget_ms):
    2. if task_level <= 2 and budget_ms < 800:
    3. return "small_model"
    4. if task_level >= 4:
    5. return "strong_reasoning_model"
    6. return "balanced_model"

    At the same time, keep version management of prompts and evaluation sets to ensure that any performance fluctuation can be traced to a specific change.

    9. Common Pitfalls and How to Avoid Them

    First, the leaderboard-only fallacy. The task distribution of leaderboards is inconsistent with the business, so their reference value is limited. Second, testing only the average score. Average scores mask the long tail; you should focus on the performance of the worst 10% of samples. Third, ignoring stability. Occasional timeouts do far more harm to end-user products than a drop in average score. Fourth, ignoring compliance. Data desensitization, content security, and audit trails must be completed at the design stage, not remedied before launch.

    10. Conclusion

    Evaluating the overall capabilities of mainstream LLM systems is not about finding the “single strongest” model, but about building an evaluation system aligned with the business: task tiering determines metric weights, the private evaluation set determines the credibility of conclusions, the cost model determines long-term sustainability, and canary and routing determine engineering safety. With the general capabilities of cloud platforms such as Baidu AI Cloud, enterprises can combine object storage, container platforms, message queues, logging services, and monitoring/alerting into a complete evaluation and rollout pipeline, upgrading model selection from subjective judgment to reproducible engineering decision.