How to Evaluate and Choose LLMs for Inference: A Practical Framework

    This article presents a practical framework for evaluating large language model (LLM) inference capabilities and making model selection decisions. It explains why subjective impressions are insufficient, breaks model quality into six measurable dimensions, and shows how to build a layered test set across difficulty, input length, and noise. The article also covers scoring strategies that combine rule-based checks, model-based grading, and human review, separating engineering metrics from quality metrics, running reproducible experiments, avoiding common pitfalls, and rolling out an evaluation pipeline in stages.

    1. From Subjective Impressions to Verifiable Conclusions

    In real projects, developers often form a vague ranking in their heads: one model seems stronger at math, another is more reliable on long-document understanding, and another produces code that is closer to expectations. These impressions come from real usage, but they have three inherent weaknesses: small sample sizes, random question distribution, and no unified scoring standard. Subjective impressions are useful for forming hypotheses, but not for supporting procurement or architecture decisions.

    To reach reproducible conclusions, you need to turn “feel” into three verifiable objects: a fixed test set, explicit scoring rules, and a controlled runtime environment. Only when all three are fixed can comparisons across versions and parameter configurations be meaningful.

    2. Designing Evaluation Dimensions: Breaking “Smart” into Measurable Capabilities

    Judging a model as generally strong or weak has no engineering value. It is better to split evaluation into six dimensions and score each one:

    • Instruction following: whether output strictly adheres to the required format, fields, and length;
    • Reasoning and computation: multi-step derivation, numerical calculation, unit conversion;
    • Long-context handling: recall of key information, cross-paragraph association, resistance to noise;
    • Code ability: runnability, boundary-condition handling, dependency reasonableness;
    • Structured output stability: JSON validity, field-missing rate, enum-out-of-range rate;
    • Safety and compliance: refusal of sensitive content, recognition of unauthorized instructions.

    Each dimension should be bound to an automatically判定 metric, avoiding vague statements like “feels better overall” that cannot be regression-tested.

    3. Building a Layered Test Set: Stratifying by Difficulty, Length, and Noise

    The key to a high-quality test set is not the number of questions but a controllable distribution. Stratified sampling across three dimensions is recommended:

    1. Difficulty: basic, advanced, and competition-level, in a ratio of roughly 5:3:2;
    2. Length: short input (within 1K), medium (several K), and long input (close to the context limit);
    3. Noise: no distraction, containing irrelevant paragraphs, and containing conflicting information.

    A sample data structure is shown below (fields are illustrative and only express the stratification idea):

    1. {
    2. "case_id": "math-0231",
    3. "dimension": "reasoning",
    4. "difficulty": "advanced",
    5. "input_tokens": 3200,
    6. "noise": "conflicting",
    7. "reference": "42",
    8. "scorer": "exact_match"
    9. }

    After stratification, any change in the total score can be traced to a specific capability item rather than a vague “got stronger/weaker.”

    4. Scoring Strategy: Combining Rule-Based, Model-Based, and Human Review

    Any single scoring method introduces bias. A three-layer combination is recommended:

    • Rule-based judgment: numbers, regex, and JSON Schema validation; low cost and repeatable;
    • Model-based judgment: use another model to score against a rubric, with a fixed rubric and prompt template;
    • Human spot checks: review disputed samples at a fixed ratio to calibrate the first two.

    The key is to first validate the consistency between the scorer and human judgment on a small sample. If the agreement rate is too low, fix the scorer first rather than rushing to run the full set.

    5. Performance and Cost: Tracking Engineering Metrics Separately from Quality Metrics

    Beyond quality, the engineering side should record at least time to first token, overall latency, throughput, cost per task, and failure and retry rates. It is recommended to track the two categories of metrics in separate tables and then make a weighted decision, so that “slightly better quality at several times the cost” is not masked by an average score. If you rely on general-purpose cloud capabilities, you can use a container platform to run load tests, object storage to save samples and results, and logging and monitoring with alerting to observe stability. These are common industry categories and are not tied to a specific implementation.

    6. A Reproducible Experiment Workflow

    1. Fix version and parameters → fix test set and random seed → run concurrent load tests → persist raw outputs
    2. → three-layer scoring (rule/model/human) → aggregate by dimension → archive conclusions

    Raw outputs must be retained in full so that conclusions can be quickly traced back when questioned. Parameters (temperature, max output length, timeout and retry policy) must be archived together with the results.

    7. Common Pitfalls

    • Using a few “viral” questions to represent overall capability;
    • Ignoring false low scores caused by output-format failures;
    • Testing only short inputs and failing in long-document scenarios after launch;
    • Not fixing concurrency and timeouts, making latency data incomparable;
    • Reusing old conclusions after a version upgrade, with no regression testing.

    8. Implementation Recommendations

    First build a small-scale baseline on Baidu AI Cloud (on the order of a hundred questions), get the “test set–scoring–archiving” loop working end to end, then gradually scale to a thousand-question level and add continuous regression. Selection conclusions should be presented as a per-dimension radar chart plus a cost curve, not a single total score. An evaluation system built this way can both support model onboarding decisions and be reused across version iterations.