A Practical Guide to LLM Selection, Evaluation, and Usage Governance

    Choosing a large language model (LLM) is easy to get wrong. Many teams trust general leaderboards only to see disappointing results on their own tasks after launch, while others manage model quotas loosely and end up wasting resources. This guide reframes LLM evaluation as a quantifiable, reproducible, and continuously improvable engineering problem. It walks through building a reproducible evaluation set, examining key capability dimensions such as instruction following, long context, reasoning, and multi-turn consistency, and tracking the engineering metrics that determine whether a model can be used stably. It then covers selection and routing strategies and practical usage-governance techniques—measuring effective cost, compressing context, caching requests, and batching asynchronously—to help teams turn model capability into real business value.

    Many teams run into two recurring problems when choosing a large language model. The first is relying only on general leaderboard rankings, then discovering after launch that a model’s performance on their own tasks falls far short of expectations. The second is loose resource management: purchased quotas have no corresponding business plan, and as expiration approaches, teams worry about waste and end up “running extra rounds whenever they get a chance.” Worse still, heavy queuing during peak hours and elevated single-call failure rates leave the real experience far behind the advertised specifications.

    This article treats “how to evaluate an LLM” as a quantifiable, reproducible, and continuously improvable engineering problem, and lays out a systematic approach spanning capability evaluation, engineering metrics, and usage governance.

    1. First, What Are We Actually Evaluating?

    1.1 General Leaderboards Are Only for Initial Screening

    Scores from public evaluation leaderboards can only give a rough sense of a model’s overall “capability tier.” There are three reasons for this:

    • Data contamination: Public benchmark questions circulate widely, and some may have already entered training corpora, pushing scores higher than they should be;
    • Distribution shift: Benchmark questions differ substantially from a company’s real business distribution;
    • Time decay: Models iterate quickly, so conclusions about older versions become outdated fast.

    For this reason, leaderboards are useful for narrowing down candidates but cannot replace evaluation tailored to your own scenarios.

    1.2 A Three-Layer Evaluation Framework

    It helps to build the evaluation system across three layers:

    Evaluation Layer Core Question Typical Metrics
    Capability Layer Can the model “get it right”? Accuracy, pass rate, human-review win rate
    Task Layer Does it “do well” on real business? Business metrics, human adoption rate, rework rate
    Engineering Layer Can it be used “stably and economically”? Latency, queue time, success rate, effective cost

    2. Building a Reproducible Evaluation Set

    2.1 Collection and Stratification

    The evaluation set should come from real business and cover typical scenarios. Start by taking desensitized samples from production logs, then have domain experts organize them into a “golden dataset.” Stratify by task type, difficulty, and input length so that samples don’t cluster around easy cases:

    1. Example evaluation set structure (start with ~300-500 items)
    2. ├─ Information extraction 30% mostly short inputs, testing format stability
    3. ├─ Text generation 25% testing factuality, style, and completeness
    4. ├─ Code 20% testing runnability and edge-case handling
    5. ├─ Long-document QA 15% testing information location within long context
    6. └─ Edge/exception cases 10% ambiguity, missing info, adversarial prompts, etc.

    2.2 Scoring Must Be Quantifiable

    • Tasks with a single correct answer: use automatic metrics such as accuracy, exact match, and execution pass rate;
    • Open-ended tasks: define scoring rubrics and have multiple reviewers score independently, using a consistency coefficient (such as Cohen’s Kappa) to check whether the criteria are clear;
    • Tasks involving subjective preference: use blind testing and pairwise comparison (A/B win rate) to reduce bias from brand and version preconceptions.

    2.3 Key Points of the Evaluation Process

    1. Fix the decoding parameters: during evaluation, typically set temperature to 0 (or close to 0) and fix the maximum output length to keep results reproducible;
    2. Control confounding variables: let each model use its own official prompt template and default parameters, so that “unequal tuning” doesn’t skew the conclusions;
    3. Sample multiple times to check stability: repeatedly sample key cases and measure the range of variation in accuracy;
    4. Include business metrics: human review should focus on high-impact defects such as factual errors, hallucinations, and format errors, with veto items in place;
    5. Track versions: record the model version, prompt version, and evaluation-set version so that conclusions stay traceable.

    2.4 Example Evaluation Script

    1. def evaluate_model(model_client, dataset, temperature=0.0):
    2. results = []
    3. for case in dataset:
    4. resp = model_client.generate(
    5. messages=build_messages(case),
    6. temperature=temperature, # disable sampling randomness during evaluation
    7. stream=False,
    8. )
    9. # grade picks a scoring function based on case.metric (exact match / execution / review)
    10. results.append({
    11. "case_id": case.id,
    12. "score": grade(resp.text, case.expected),
    13. "input_tokens": resp.usage.input_tokens,
    14. "output_tokens": resp.usage.output_tokens,
    15. "latency_ms": resp.latency_ms,
    16. "format_ok": is_valid_schema(resp.text, case.schema),
    17. })
    18. return aggregate(results) # scores, per-dimension pass rates, average consumption

    3. How to Read the Key Capability Dimensions

    3.1 Instruction Following and Structured Output

    In production systems, LLM output often needs to be consumed directly by programs. During evaluation, specify a clear output format (such as a JSON Schema) in the prompt, measure the format validity rate and field completeness, and check how well the model follows multiple simultaneous constraints.

    3.2 Long Context

    Context length determines the scale of both input and billing cost. Evaluating long-context capability means looking beyond “how much can fit” to “does it still work once it’s stuffed in.” A common approach is the “needle in a haystack” test: bury key information at different positions within a long document and observe how the recall rate changes with position. At the same time, record the average input length—long context can reduce the need for chunking and retrieval, but cost rises linearly with length.

    3.3 Reasoning and Code

    • Math and logic reasoning: use real calculation and multi-step reasoning problems from your business, and check whether the intermediate steps are correct;
    • Code capability: evaluate through the closed loop of “generate → compile → run test cases,” using the execution pass rate rather than human impression as the primary metric, while also tracking security and boundary defects.

    3.4 Multi-turn and Context Retention

    In long conversations, check whether the model forgets earlier constraints or gets led astray by irrelevant information. You can accumulate the message history step by step and observe how quickly retention of key constraints degrades per turn.

    4. Engineering Metrics: Whether It Can Be Used Stably

    No matter how high the capability scores, the real value drops sharply if the service queues heavily or fails frequently. The engineering layer should measure the following:

    • Time to first token and end-to-end latency: measure time to first token (TTFT) and full response time separately, and pay attention to P95/P99 rather than the average;
    • Queue time: the gap between when a request is sent and when the first token arrives, which directly reflects concurrency pressure;
    • Call success rate and error distribution: distinguish rate limiting, timeouts, server-side errors, content moderation blocks, and other types, and devise countermeasures for each;
    • Throughput and rate limits: understand the account’s QPS (requests per second), TPM (tokens per minute), and other quotas, and verify the behavior when limits are exceeded;
    • Benefits of streaming output: for interactive scenarios, streaming responses can significantly reduce perceived wait time, and TTFT often affects the experience more than total latency.

    4.1 High-Concurrency Call Example

    1. import random, time
    2. from tenacity import retry, stop_after_attempt, wait_exponential_jitter, retry_if_exception_type
    3. @retry(
    4. stop=stop_after_attempt(5),
    5. # exponential backoff + random jitter, to avoid secondary congestion from many requests retrying at once
    6. wait=wait_exponential_jitter(initial=1, max=30),
    7. retry=retry_if_exception_type(TransientServiceError),
    8. )
    9. def call_with_backoff(client, messages, **kwargs):
    10. # for async concurrency, always set a semaphore to keep concurrency within quota limits
    11. return client.chat(messages, **kwargs)

    5. From Evaluation to Deployment: Selection and Routing Strategy

    1. Split work by task: route simple classification and extraction tasks to small models or rule engines, and complex reasoning and long-document understanding to large models;
    2. Primary and backup dual paths: prepare candidate models for each task type, switch to a preset rule when the primary model fails, and isolate the differences through a unified abstraction layer;
    3. Canary and A/B testing: roll out a new version to a small traffic slice first, compare task success rate and human adoption rate, then gradually scale up;
    4. Build a continuous regression mechanism: online failure cases should periodically flow back into the evaluation set, forming a closed loop of “evaluate → deploy → feedback → re-evaluate.”

    6. Usage Governance: Making Every Dollar of Investment Count

    The “quota not used up, yet afraid of wasting it” dilemma in the original scenario is, at its core, a disconnect between resources and business goals. The heart of governance is shifting the cost lens from “how much quota was used” to “how much each successful task cost”:

    1. Effective cost = (input tokens × input unit price + output tokens × output unit price) / task success rate
    1. Set budgets per scenario: allocate quotas by business line and configure threshold alerts so that a single task doesn’t crowd out the overall quota;
    2. Compress context: streamline prompts, deduplicate message history, and retrieve before inputting long documents to directly reduce input tokens;
    3. Cache repeated requests: use exact caching for high-frequency, stable requests and semantic caching for semantically similar ones;
    4. Batch asynchronously: use message queues for non-real-time batch jobs to level out peaks and fill valleys, consuming them during off-peak periods and smoothing out queue pressure;
    5. Invest at high value near quota expiry: put remaining resources into building evaluation sets, running regression tests, or doing offline data analysis—far more valuable than “running a few extra rounds.”

    For enterprises that need to manage many kinds of models, model services, data, and applications in a unified way, cloud platforms such as Baidu AI Cloud allow model invocation, evaluation, and application orchestration to be done in one place. With cloud monitoring and logging services providing unified visibility into call volume, latency, and failure rates, teams get a solid data foundation for usage governance.

    7. Common Pitfalls

    • Leaderboard-only thinking: a high score doesn’t mean a good fit for your business;
    • One-time evaluation for good: both models and business change, so evaluation has to be ongoing;
    • Ignoring non-determinism: not fixing parameters and not sampling multiple times leaves conclusions unconvincing;
    • Looking only at the nominal unit price: failing to account for rework and retry costs easily underestimates the total investment;
    • The long-context panacea view: being able to fit everything doesn’t mean being able to use it well, and long inputs often push costs up substantially.

    Conclusion

    Evaluating a language model is, at bottom, answering three questions: is it good enough on your own tasks, is it stable under engineering constraints, and is it cost-effective within budget. Anchored on a real evaluation set, held to engineering metrics as the baseline, and backed by usage governance, model capability can genuinely be turned into business value.