How to Choose an LLM: From Leaderboard Rankings to Scenario-Based Testing

    Public leaderboards offer a cheap way to shortlist candidate models, but they answer "who is better on average," not "who is right for you." This guide explains why to move from rankings to your own scenario-based testing, and how to do it in practice. It covers the shift from picking a static model to connecting a configurable endpoint, a six-dimension scorecard for structured evaluation, how to build a stratified real-traffic test set with machine-verifiable assertions, scoring methods that combine automated checks with model and human review, a decomposition model for latency and cost sensitivity analysis, and a production checklist for a replaceable architecture and governance. The goal is a repeatable selection process that turns model choice into an engineering metric.

    1. Start With the Leaderboard: It Answers “Who Is Better on Average,” Not “Who Is Right for Me”

    Public leaderboards provide a low-cost coarse-filtering funnel, but they carry three types of systematic distortion you need to keep in mind when making a selection.

    The first is data contamination. Once leaderboard questions become public, they may enter the pre-training or post-training stages of later models along with the training corpus. A model’s performance on “questions it has already seen” gets systematically inflated, and that has no necessary connection to its performance under a real business distribution.

    The second is task-distribution mismatch. Leaderboards tend to test tasks that are easy to score automatically—general code generation, reasoning chains, math, or knowledge Q&A. But the hard part of real business often lies elsewhere: whether the output is strictly parseable, whether tool-call parameters are valid, whether the middle of a long context can still be recalled, whether the model asks back when an instruction is ambiguous. These capabilities are almost invisible in a composite ranking.

    The third is inconsistent evaluation conditions. Sampling temperature, context window length, whether a reasoning budget is enabled, whether multiple attempts are allowed, and whether scoring is strict matching or model-as-judge—all of these settings change the results significantly. The same model’s ranking can vary widely under different constraints, and production gives you exactly one fixed set of constraints.

    The conclusion is direct: use leaderboards to generate a candidate list (usually 3–5 models), and make the final decision with a test set tailored to your own traffic distribution.

    2. A Shift in Mental Model: From “Choosing a Model” to “Connecting to an Endpoint”

    The infrastructure changes of the past year or two are worth noting: more and more inference capability is no longer delivered as “download the weights and deploy it yourself,” but is hosted on inference microservice platforms—platforms that are essentially a catalog of model services, converging model repositories, a unified inference API, auto-scaling, version switching, and quota management into one standardized set of capabilities.

    The implication of this shift for selection is: you are not choosing a static model, but a configurable, switchable, gradually-rollable service endpoint. This leads to two engineering conclusions.

    First, the convergence of interfaces creates an opportunity for decoupling. Most mainstream hosted services expose chat-style inference APIs with similar shapes (a request body with a messages array, supporting streaming responses, stop conditions, and sampling parameters). As long as you add a thin adapter layer between the business logic and the model, the model becomes a configuration item rather than a constant in the code.

    Second, version drift becomes a new risk item. Models on hosted services may be silently upgraded or deprecated by the vendor, and their behavior changes accordingly. The adapter layer must explicitly record and validate the model version identifier, and the test set must be able to run periodic regression in CI—not just once at project kickoff.

    A minimal adapter layer looks like this; the key idea is to extract “model name,” “timeout,” “retry,” and “scoring” so that business code depends only on an abstract interface:

    1. import json
    2. import time
    3. import urllib.request
    4. from dataclasses import dataclass
    5. @dataclass
    6. class ModelEndpoint:
    7. name: str
    8. base_url: str # delivered by the config center, not hardcoded in code
    9. token: str # injected via environment variables or a secrets manager
    10. timeout_s: float = 30.0
    11. max_retries: int = 2
    12. def chat(ep: ModelEndpoint, messages, *, temperature=0.2, max_tokens=1024):
    13. """Unified chat-style inference call: the business side is unaware of the specific service form."""
    14. body = {
    15. "messages": messages,
    16. "temperature": temperature,
    17. "max_tokens": max_tokens,
    18. "stream": False,
    19. }
    20. req = urllib.request.Request(
    21. ep.base_url,
    22. data=json.dumps(body).encode("utf-8"),
    23. headers={
    24. "Content-Type": "application/json",
    25. "Authorization": f"Bearer {ep.token}",
    26. },
    27. )
    28. last_err = None
    29. for attempt in range(ep.max_retries + 1):
    30. try:
    31. t0 = time.perf_counter()
    32. with urllib.request.urlopen(req, timeout=ep.timeout_s) as resp:
    33. data = json.loads(resp.read().decode("utf-8"))
    34. return data, time.perf_counter() - t0
    35. except Exception as err: # a production implementation should distinguish rate limiting / timeout / server errors
    36. last_err = err
    37. time.sleep(0.2 * (2 ** attempt)) # exponential backoff
    38. raise RuntimeError(f"call failed after retries: {last_err}")

    3. A Six-Dimension Evaluation Framework: Breaking “Usable” Into Measurable Quantities

    I recommend organizing the selection discussion around a fixed-weight scorecard, adjusting the weights to the nature of the business (user-facing real-time scenarios weight latency more heavily; offline batch scenarios weight cost and throughput more heavily).

    Dimension Key Metrics Description
    Task Capability Score on your own test set, structured-output validity rate The only irreplaceable basis for the decision
    Stability Error rate, rate-limit trigger rate, context-limit behavior Whether oversized requests error out or are silently truncated must be tested in practice
    Latency Time to first token (TTFT), time per output token (TPOT), end-to-end P95 In streaming scenarios, TTFT determines the perceived experience
    Cost Input/output unit price, cache-hit savings, batch discounts Must be estimated from the real token distribution, not from averages
    Migration & Ecosystem API compatibility, observability integration, private-deployment feasibility Determines long-term maintenance cost
    Compliance & Data Data residency location, log-retention policy, content-safety capabilities Usually a veto item rather than a bonus

    The weighted total score:

    1. S = 0.40*Capability + 0.20*Stability + 0.15*Latency + 0.15*Cost + 0.10*Ecosystem & Migration

    Here “Compliance & Data” is a gate item: if a candidate fails it, the candidate is excluded outright and does not participate in the weighting.

    4. Building Your Own Test Set: This Is Where the Real Work of Selection Lies

    Stratified sampling. Stratify the real request logs of the past three months by business intent (for example Q&A, extraction, rewriting, code modification, tool calling, multi-turn follow-up), and sample 50–200 items from each stratum so the total stays in the hundreds. Stratification matters more than raw volume: a test set containing only Q&A and code cannot support a “best overall” conclusion.

    Each sample should carry at least three things: the input context, a reference answer or scoring rubric, and several machine-verifiable assertions. Assertions are the most efficient part—JSON Schema validity, presence of required fields, numerical consistency with the source text, whether generated code passes unit tests, whether a regex matches. The higher the share that can be machine-scored, the lower the regression cost.

    You must include adversarial and boundary samples. Ambiguous instructions (to see whether the model clarifies rather than guessing hard), overly long contexts (put key evidence in the middle to test recall decay), format traps (demand strict JSON and forbid explanatory text), privilege-escalation and sensitive requests (to test refusal and safety policies), and mixed languages.

    Manage it as a data asset. Version the test set, prompt templates, and scoring scripts together; write artifacts (model outputs, scoring details) to object storage; and dispatch batch evaluation jobs to a message queue for asynchronous execution so they don’t block the main flow. Every model or prompt change triggers regression in CI, and if the score drops beyond a threshold, block the release.

    5. Scoring Methods: Machine First, Model-Assisted, Human Fallback

    Scoring reliability, from high to low: unit tests and assertion checks > rule/regex checks > human blind evaluation > model-as-judge.

    Model scoring is efficient but has known biases: position preference (favoring candidates earlier or later in the list), length preference (favoring longer answers), and same-source preference (favoring output from the same model family). Mitigations include shuffling the candidate order and scoring several times to take the majority, hiding model identity, providing clear anchored scoring rubrics, and requiring the model to output its reasoning before scoring. At the same time, keep a small set of human blind evaluations as a calibration set, and regularly check agreement between model scoring and human scoring; when agreement drops to an unacceptable level, recalibrate.

    1. def auto_score(case, out_text):
    2. """Returns (score, details). Scores are normalized to 0~1 for easy cross-sample weighting."""
    3. detail = {}
    4. ok = 0
    5. checks = []
    6. # 1) Whether the structured output is parseable
    7. if case.require_json:
    8. try:
    9. parsed = json.loads(out_text)
    10. checks.append(("json_valid", 1.0))
    11. checks.append(("schema_ok", 1.0 if case.validate(parsed) else 0.0))
    12. except Exception:
    13. checks.append(("json_valid", 0.0))
    14. checks.append(("schema_ok", 0.0))
    15. else:
    16. checks.append(("json_valid", None))
    17. # 2) Keyword / key-point coverage rate
    18. hits = [k for k in case.key_points if k in out_text]
    19. checks.append(("key_point_coverage", len(hits) / max(len(case.key_points), 1)))
    20. # 3) Executable assertions (e.g., unit tests for generated code)
    21. if case.exec_check is not None:
    22. checks.append(("exec_check", 1.0 if case.exec_check(out_text) else 0.0))
    23. # 4) Redundancy penalty, to avoid the "longer is better" bias
    24. ratio = len(out_text) / max(case.ref_len, 1)
    25. checks.append(("verbosity_penalty", max(0.0, 1.0 - max(0.0, ratio - 1.5))))
    26. valid = [s for _, s in checks if s is not None]
    27. score = sum(valid) / len(valid) if valid else 0.0
    28. detail["checks"] = dict(checks)
    29. return round(score, 4), detail

    6. Latency and Cost: Sensitivity Analysis With a Decomposition Model

    Look at latency in two parts. Time to first token (TTFT) is mainly determined by input length and current concurrency, and belongs to the prefill phase; time per output token (TPOT) is mainly determined by output length, and belongs to the decode phase. So the optimization paths differ: shortening the prompt, compressing retrieval snippets, and enabling context caching are effective for TTFT; limiting output length, streaming responses, and lowering the maximum generation cap are more effective for TPOT and the perceived experience. When testing, always fix the concurrency level and measure each separately—latency measured with a single request often degrades noticeably at 20 concurrent requests, and this is the most commonly underestimated item in selection.

    Estimate cost from the real token distribution. Say a single request has an input of p_in tokens and an output of p_out tokens, with input unit price c_in and output unit price c_out; the cache-hit ratio is h, the cached portion is billed at a discount d, and the batch discount is b:

    1. Cost per request = b * ( p_in * c_in * (h*d + (1-h)) + p_out * c_out )
    2. Monthly cost = Cost per request * monthly request volume

    I don’t cite any specific prices here—unit prices change with commercial policy, and hardcoding numbers would only distort the model. The genuinely valuable action is sensitivity analysis: in most conversational workloads, output tokens dominate cost, so “writing shorter, more accurate answers” often cuts cost more than “switching to a cheaper model”; while in extraction, classification, and rewriting workloads, input dominates, and the gains from context compression and a higher cache-hit rate are greater.

    General ways to reduce load, ranked by cost-effectiveness:

    • Trim and deduplicate context, keeping only snippets relevant to the question rather than stuffing in the whole document;
    • Use a stable prefix plus prefix caching, placing the system prompt and fixed knowledge at the front to raise the cache-hit rate;
    • Route and cascade models: a low-cost model answers first and escalates to a large model when confidence is insufficient or risk control is triggered;
    • Separate offline batch jobs from online real-time requests, choosing different model tiers and quotas for each;
    • Pair streaming output with a first-token latency budget, so the perceived-experience metric—rather than total duration—becomes the constraint.
    1. def monthly_cost(p_in, p_out, c_in, c_out, reqs_per_month,
    2. cache_hit=0.0, cache_discount=0.3, batch_discount=1.0):
    3. per_req = batch_discount * (
    4. p_in * c_in * (cache_hit * cache_discount + (1 - cache_hit))
    5. + p_out * c_out
    6. )
    7. return per_req * reqs_per_month
    8. # Sensitivity example: impact of output-length changes on monthly cost (fill c_in/c_out from procurement prices in the config)
    9. base = monthly_cost(p_in=1800, p_out=200, c_in=C_IN, c_out=C_OUT, reqs_per_month=3_000_000)
    10. long = monthly_cost(p_in=1800, p_out=600, c_in=C_IN, c_out=C_OUT, reqs_per_month=3_000_000)
    11. print(f"Cost increase from +400 output tokens: {(long / base - 1) * 100:.1f}%")

    7. Production Deployment: A Replaceable Architecture and a Governance Checklist

    Selection conclusions only matter when they land in the architecture. I recommend implementing along the following lines:

    • Configuration-driven routing. Put the model name, timeout, retry count, temperature, and maximum output in a configuration center, supporting traffic splitting by environment (dev / staging / prod) and by traffic proportion; forbid hardcoding them in business logic.
    • Timeout, retry, and idempotency. Distinguish retryable errors (timeout, rate limiting, 5xx) from non-retryable errors (invalid parameters, content interception); add idempotency keys to write-style calls to avoid duplicate side effects from retries.
    • Circuit breaking and degradation. When the primary model fails repeatedly, switch to a backup endpoint, or degrade to rule/template replies with a clear notice, so the whole system doesn’t become unavailable.
    • A closed observability loop. For each call, record the request ID, the model identifier and version, token usage, the two-part latency, the error code, and user-feedback signals; feed metrics and logs into monitoring and alerting, with threshold alerts on error rate, P95 latency, and daily cost.
    • Canary and A/B. Start with small traffic and compare online metrics rather than offline scores: first-pass rate, human adoption rate, rewrite and rework rate, average cost per task. Offline evaluation is responsible for “can it be used”; online metrics are responsible for “is it worth it.”
    • A data and compliance gate. Define data residency and retention policies, desensitization scope, log-retention periods, and access auditing; for scenarios involving personal information or sensitive industry data, assess private deployment or dedicated inference resources as a prerequisite.

    8. Decision Checklist

    1. Use leaderboards to shortlist 3–5 candidates; don’t trust a single ranking.
    2. Build a 300–1000 item stratified real-traffic test set, with as high a coverage of machine-verifiable assertions as possible.
    3. Fix the temperature and context length, and measure TTFT / TPOT / error rate at the same concurrency level.
    4. Do cost estimation and sensitivity analysis from the real token distribution, rather than judging by unit-price intuition.
    5. Pass the compliance gate, then compute the weighted total score.
    6. Before launch, complete four items: adapter-layer abstraction, timeout and retry, circuit breaking and degradation, and monitoring and alerting.
    7. Split traffic in a canary, use the online adoption rate and rework rate to calibrate the offline conclusions, and bring the test set into CI regression.

    In one sentence: model capability decides whether you can do it, the maturity of endpoint engineering decides whether you can do it stably, and your own test set decides whether you still know why you chose the way you did six months later. Turn these three things into a repeatable process, and “which model should we pick” stops being a question answered by gut feeling and becomes an engineering metric that yields an answer automatically every quarter.