LLM Selection: A Four-Dimensional Evaluation Framework and Practical Deployment Guide

    This guide explains how to evaluate and choose a large language model (LLM) based on your real use case rather than public leaderboard scores. It presents a four-dimensional evaluation framework covering capability, cost, stability, and engineering integration, along with practical advice on building representative test sets, estimating true per-task cost, load-testing latency, and assessing integration effort and vendor lock-in. It also provides a reproducible six-step evaluation workflow with example Python code, common pitfalls to avoid, and an FAQ to help teams make selection decisions that hold up under production traffic.

    1. Evaluation Starts with the Scenario, Not the Score

    When evaluating LLMs for selection, many teams’ first instinct is to open public leaderboards and pick whoever scores highest. That approach is only a preliminary reference and should never be the sole basis for a decision. Public leaderboards typically measure general-purpose capability, while real business use cases usually come with specific constraints. The same model may perform well on general Q&A yet behave very differently on structured extraction, long-document Q&A, code generation, or a customer-service knowledge base.

    So when it comes to how to evaluate LLMs and how to choose one, the first principle is: define the use case first, then design the evaluation. The final output of an evaluation should not be just a table of scores, but an actionable conclusion: given your current business scenario, which model can meet quality, security, stability, and engineering-integration requirements at the lowest overall cost.

    This also means “leaderboard-only” thinking is not viable. Leaderboards are useful for shortlisting candidate models, but the decision should be driven by evaluation results built on your own business data.

    2. A Four-Dimensional Evaluation Framework: From “Does It Work” to “Can We Rely on It Long-Term”

    2.1 Capability: How Do You Set the Standard?

    Capability evaluation should not simply copy public benchmarks; it should be built around real tasks. It is recommended to sample from actual online requests and to anonymize (de-identify) user privacy data before sampling, confirming that the data source is compliant.

    Sampling should use stratified sampling rather than picking a few cases at random. You can split cases into core, long-tail, and edge scenarios. For example:

    • Core scenarios: high-frequency business questions;
    • Long-tail scenarios: low-frequency but important complex questions;
    • Edge scenarios: very long text, multi-turn dialogue, code generation, structured output, malformed inputs, and so on.

    For a quick initial screening, a test set of 100–200 cases is feasible. If you need a more robust error-rate estimate, you can increase the sample size. For instance, at a 95% confidence level, estimating a proportion with a ±10% margin of error requires roughly 96 samples, and ±5% requires roughly 384 samples. For formal procurement or high-value business scenarios, it is recommended to expand the test set to 300–400 cases and to sample with weights based on business importance.

    For scoring, it is recommended to combine “rule-based checks + human review.”

    Rule-based checks are suited to hard requirements, for example:

    • Whether JSON can be parsed reliably;
    • Whether fields are complete;
    • Whether the format matches;
    • Whether sensitive content is triggered;
    • Whether obviously unacceptable content is present.

    Human review is suited to soft quality, for example whether an answer matches intent, is factually consistent, and is usable in expression. You can use a 1–5 scale or a binary decision. For key business scenarios, it is recommended to clearly define a “first-pass rate”: the proportion of first outputs that meet the hard threshold. For example, a first pass can be defined as simultaneously satisfying all of the following:

    • Correct format;
    • All key fields complete;
    • No serious factual errors;
    • Security and compliance checks passed;
    • Human review score not below the set threshold.

    To improve the credibility of the evaluation, it is recommended that at least two reviewers annotate the same set of results and that annotation agreement be computed, such as simple agreement rate or the Kappa coefficient. If agreement is too low, first align on scoring criteria, then re-run the evaluation.

    Capability evaluation should also include security and compliance checks, such as prompt injection, jailbreak attempts, refusal of sensitive content, unauthorized access, and privacy leakage. For services that face the public or handle sensitive data, security and compliance should be treated as a veto criterion (pass/fail gate).

    Key capability points to focus on include:

    • Instruction following: whether it strictly outputs in the required format and constraints;
    • Factual consistency: whether obvious hallucinations are present;
    • Long-context handling: whether key information in long documents is effectively recalled;
    • Structured-output stability: whether JSON, tables, XML, and similar formats can be parsed reliably;
    • Security and compliance: whether it can refuse high-risk requests and protect user privacy.

    2.2 Cost: How Do You Calculate It Without Losing Money?

    Model cost cannot be judged by unit price alone. Whether billing is per token or via a subscription quota, it must ultimately be converted into the “overall cost to complete a single business task.” A model with a lower unit price that frequently gives off-target answers and needs multiple retries may cost more in practice than a higher-priced model that gets it right the first time.

    The following is a per-task cost estimation example:

    1. # Illustrative: per-task overall cost estimation
    2. # price_in_per_1k / price_out_per_1k units are recommended as CNY per 1K tokens
    3. # quality_pass_rate: first-pass rate, range 0~1
    4. # max_attempts: configurable maximum attempts, used to cap cost amplification from extreme retries
    5. def task_cost(input_tokens, output_tokens, price_in_per_1k, price_out_per_1k,
    6. quality_pass_rate, max_attempts=5):
    7. # Cost of a single call
    8. one_call = (
    9. input_tokens / 1000 * price_in_per_1k
    10. + output_tokens / 1000 * price_out_per_1k
    11. )
    12. # Guard the first-pass rate to avoid division by zero
    13. p = min(max(quality_pass_rate, 1e-6), 1.0)
    14. # Expected number of attempts: a higher first-pass rate approaches 1 attempt
    15. expected_attempts = min(max_attempts, 1 / p)
    16. # Expected overall cost: already includes the amplification from failed retries
    17. return one_call * expected_attempts

    The key here is to incorporate “quality” into the cost calculation. A higher first-pass rate means a lower cost per effective result; a lower first-pass rate means a higher expected number of attempts, and the overall cost rises accordingly.

    Note that the unit price must be dimensionally consistent with the token count. For example, if the price unit is “CNY per 1K tokens,” then input_tokens and output_tokens must first be divided by 1000 before calculation. If the price unit is “CNY per token,” you can multiply directly.

    Beyond API fees, you should also account for the following hidden costs:

    • Human review and rework costs;
    • User-experience loss caused by excessive latency;
    • Business disruption risk caused by insufficient stability;
    • Engineering integration and later maintenance costs.

    Therefore, cost evaluation should not compare only “how much per call,” but “how much per successfully completed task.”

    2.3 Stability: Is Average Latency Enough?

    Stability evaluation cannot rely on average response time alone. Averages easily mask tail-latency problems. In production systems, what users perceive often depends on P95 and P99 latency, not the average.

    It is recommended to load test across different concurrency levels. For example:

    • Concurrency 1: observe the single-request baseline;
    • Concurrency 10: observe low-concurrency stability;
    • Concurrency 50: observe mid-concurrency scalability;
    • Concurrency 100: observe rate limiting and error rate under high concurrency.

    For each level, it is recommended to send at least 1,000 requests with a measurement window of no less than 10 minutes. You should record:

    • P50, P95, P99 latency;
    • Error rate;
    • Timeout rate;
    • Number of rate-limit triggers;
    • Throughput;
    • Time to first response;
    • Token output speed in streaming scenarios.

    For production systems, you should also confirm:

    • Whether the service has an explicit rate-limiting policy;
    • Whether there is a retry mechanism on request failure;
    • Whether there is a fallback (degradation) strategy;
    • Whether streaming output is supported to reduce perceived wait time;
    • Whether there are observability capabilities such as logging, monitoring, and alerting.

    The SLA provided by a vendor is usually a service commitment and should not be taken as equivalent to real performance in your business environment. SLAs need to be cross-validated with actual load-test results, especially under peak traffic, burst traffic, long-text inputs, and complex tasks—don’t rely only on the default promise.

    2.4 Engineering Integration: How Do You Avoid “It Runs but Is Hard to Use”?

    No matter how strong a model is, if it is hard to integrate, it becomes an engineering burden. Engineering-integration evaluation should focus on whether the model can be smoothly integrated into existing systems, including API compatibility, SDK maturity, streaming output, authentication methods, log tracing, containerized deployment, object storage, message queues, and related infrastructure.

    Evaluation should also consider migration cost and vendor lock-in. For example:

    • Whether the output format is generic;
    • Whether private (on-premises) or dedicated-cloud deployment is supported;
    • Whether you can switch to a backup model;
    • Whether a unified gateway and multi-model routing are supported;
    • Whether business data can be easily exported and migrated;
    • Whether it depends on a vendor’s proprietary format.

    You can build an indicator table like the following:

    Dimension Example metric Example threshold / note
    Capability Business-task first-pass rate Core scenarios ≥ 85%
    Capability JSON parse success rate ≥ 99%
    Capability Serious factual error rate ≤ 1%
    Cost Expected cost per task Within business budget
    Cost Retry rate ≤ 10%
    Stability P95 latency Set per business, e.g., ≤ 2s
    Stability P99 latency Set per business, e.g., ≤ 5s
    Stability Error rate ≤ 0.5%
    Engineering Streaming support Supported, or can be compensated via engineering
    Engineering Observability Complete logs, monitoring, and alerting
    Compliance Sensitive-content refusal High-risk requests must be blocked

    Weights should not be distributed evenly; they should be set according to business goals. For example:

    • Compliance-sensitive businesses such as finance and healthcare: higher weight on security/compliance, factual consistency, and stability;
    • Fast-launch MVPs: higher weight on engineering integration, stability, and delivery speed;
    • High-concurrency customer service: higher weight on P95 latency, error rate, and cost.

    For high-risk businesses, it is recommended to set veto items. For example, if security/compliance fails, privacy protection is insufficient, or structured output is consistently unparseable, the model should not enter the final candidate pool.

    3. A Reproducible Evaluation Workflow

    Only by turning evaluation into a fixed process can you avoid “choosing a model by gut feeling.” The following six steps are recommended:

    1. Requirements definition: clarify the business scenario, quality red lines, cost budget, latency requirements, and compliance requirements;
    2. Test-set construction: sample from real data using stratification, de-identify, and annotate the expected results;
    3. Candidate shortlisting: select 3–5 candidate models for comparison;
    4. Automated testing: use unified inputs, invoke models in batches, and record outputs, latency, and cost;
    5. Multi-dimensional scoring: aggregate weighted scores across capability, cost, stability, and integration;
    6. Canary validation: roll out to a small traffic share and calibrate evaluation conclusions with real feedback.

    Below is a skeleton of a reproducible evaluation workflow:

    1. # Illustrative: evaluation pipeline skeleton
    2. # First define model configs, including price, max attempts, etc.
    3. model_cfg = {
    4. "model_a": {
    5. "price_in_per_1k": 0.002,
    6. "price_out_per_1k": 0.006,
    7. "max_attempts": 5,
    8. },
    9. "model_b": {
    10. "price_in_per_1k": 0.004,
    11. "price_out_per_1k": 0.012,
    12. "max_attempts": 5,
    13. },
    14. "model_c": {
    15. "price_in_per_1k": 0.008,
    16. "price_out_per_1k": 0.024,
    17. "max_attempts": 3,
    18. },
    19. }
    20. # Cost estimation function, reusing task_cost
    21. def estimate_cost(resp, cfg, pass_rate):
    22. return task_cost(
    23. input_tokens=resp.usage.input_tokens,
    24. output_tokens=resp.usage.output_tokens,
    25. price_in_per_1k=cfg["price_in_per_1k"],
    26. price_out_per_1k=cfg["price_out_per_1k"],
    27. quality_pass_rate=pass_rate,
    28. max_attempts=cfg.get("max_attempts", 5),
    29. )
    30. # First pass: invoke uniformly and record quality and latency
    31. quality = {}
    32. for model in candidates:
    33. quality[model] = []
    34. for case in test_set:
    35. resp = call_model(model, case.input)
    36. score = evaluate(case.expected, resp)
    37. quality[model].append({
    38. "case": case,
    39. "resp": resp,
    40. "score": score,
    41. })
    42. # Compute the first-pass rate for each model
    43. pass_rate = {}
    44. for model in candidates:
    45. passed = sum(
    46. 1 for item in quality[model]
    47. if item["score"] >= item["case"].pass_threshold
    48. )
    49. pass_rate[model] = passed / len(test_set)
    50. # Second pass: aggregate cost, latency, and score
    51. results = []
    52. for model in candidates:
    53. for item in quality[model]:
    54. resp = item["resp"]
    55. results.append({
    56. "model": model,
    57. "score": item["score"],
    58. "latency": resp.latency,
    59. "cost": estimate_cost(resp, model_cfg[model], pass_rate[model]),
    60. })
    61. # Weighted aggregation, output the selection report
    62. report = aggregate(results)

    Two things to note in the workflow:

    First, evaluation inputs must be unified. Using different prompts, different parameters, or an uncleaned test set across models will all distort the conclusions.

    Second, evaluation results must be reviewable. Each request should retain its input, output, latency, token usage, quality score, cost estimate, and any error reasons, making it easier to locate problems later.

    4. Common Pitfalls and How to Improve

    Pitfall 1: Leaderboard-only thinking. Leaderboards can serve as a screening tool, but they cannot replace business evaluation. The final decision should be based on performance on your own test set.

    Pitfall 2: Lowest-price-only thinking. A low unit price does not mean a low overall cost. If a model’s first-pass rate is low, retries, rework, and human review will all push up the real cost.

    Pitfall 3: One-off evaluation. LLM versions iterate quickly, and pricing may change. Evaluation should not be a one-time activity; instead, you should build a periodic regression mechanism.

    Pitfall 4: Ignoring migration cost and vendor lock-in. When selecting a model, don’t look only at current performance; also consider whether you can switch models in the future. You should assess API compatibility, data formats, on-premises capability, multi-model routing, and alternative vendors.

    It is recommended that teams make evaluation automated and routine. Whenever a model version updates, the billing method changes, the business scenario changes, or a major launch is approaching, you should run the regression test set to ensure the selection conclusion still holds.

    5. FAQ: Common Questions About LLM Selection and Evaluation

    Q1: How do you evaluate an LLM?

    LLM evaluation should be built around real business scenarios and carried out across four dimensions: capability, cost, stability, and engineering integration. You should not look only at leaderboard scores, nor only at price.

    Q2: What does each of the four dimensions include?

    The capability dimension focuses on task fit, instruction following, factual consistency, structured output, and security/compliance; the cost dimension focuses on overall cost per task; the stability dimension focuses on P95/P99 latency, error rate, rate limiting, and fallback; the engineering-integration dimension focuses on API, SDK, streaming output, observability, and migration cost.

    Q3: How many people and how much time does evaluation take?

    For a quick initial screening, 1–2 engineers and 1 business expert can build an initial evaluation set and automation scripts in 1–3 days. For a formal selection, it is recommended to add annotators and a security/compliance reviewer, and the cycle may take 1–2 weeks. Later, automated regression can lower the ongoing evaluation cost.

    Q4: How long until evaluation conclusions become outdated?

    When the model version updates, prices change, the business scenario changes, compliance requirements change, or obvious quality fluctuations appear in production, the original conclusions may become invalid. In general, it is recommended to regress at least once a month; for fast-changing businesses, every two weeks; and after a major version update, re-evaluate immediately.

    Conclusion

    Evaluating an LLM is not about finding the “strongest” one, but the “best fit.” With the four-dimensional framework of capability, cost, stability, and engineering integration—combined with a reproducible evaluation workflow, automated regression, and canary validation—developers can break free from marketing hype and leaderboard myths and make selection decisions that hold up in production. Evaluation conclusions also need to be reviewed periodically as model versions, business goals, and cost structures change, and continuously calibrated.