Large Language Model Evaluation: Methods and Practices Guide

    This article explains why building an evaluation system is harder than choosing a model, and how to design one that supports real engineering decisions. It covers defining evaluation goals, structuring layered metrics across correctness, completeness, efficiency, robustness, and safety, building datasets where distribution matters more than raw volume, and combining rule-based checks, model-assisted scoring, and human review. It also outlines how to turn evaluation into a repeatable pipeline and lists common pitfalls such as sample leakage, relying on averages, and over-constraining safety policies.

    1. Why Evaluation Is Harder Than Model Selection

    In practice, teams tend to spend most of their effort on model selection while neglecting the evaluation system itself. A common pattern: the same model produces opposite conclusions in different teams. The cause is rarely fluctuating model capability; it is inconsistent evaluation criteria. The difficulty concentrates in three areas: capability dimensions are hard to enumerate exhaustively, sample distributions drift from real business distributions, and open-ended generation has no single correct answer.

    Evaluation is therefore a systems engineering effort first and a scoring exercise second. Treating it as a one-off activity usually yields conclusions that only support short-term decisions; running it as a sustainable pipeline is what supports long-term iteration.

    2. Define the Goal First: What Question Should Evaluation Answer

    Before writing the first line of evaluation code, clarify how the conclusion will be used. Different scenarios call for different designs:

    • Selection decisions: focus on relative differences between candidate models; smaller sample sizes are acceptable, but core scenarios must be covered.
    • Version regression: focus on whether capability degrades across versions of the same model; repeatability and stability matter most.
    • Launch gating: focus on safety, compliance, and refusal behavior; emphasize boundary cases and red-line scenarios.
    • Effect attribution: focus on gains from prompts, retrieval strategies, and post-processing; variables must be controlled.

    Different goals change sample ratios, metric weights, and decision thresholds. Skipping this step produces the most common failure: metrics all look good, but the conclusions guide no action.

    3. Metrics: Breaking “Good” into Measurable Dimensions

    A single aggregate score easily hides problems. A layered metric structure is recommended:

    1. Correctness: factual consistency, instruction following, format compliance, numerical and unit accuracy.
    2. Completeness: recall of key points, whether constraints are dropped, state retention across multi-turn tasks.
    3. Efficiency: time to first token, end-to-end latency, resource consumption and throughput per request.
    4. Robustness: tolerance to prompt perturbations, noisy input, very long context, and adversarial samples.
    5. Safety: harmful content interception rate, privacy leakage rate, over-refusal rate (being overly conservative is also a defect).

    Efficiency and safety metrics must be reviewed with the same weight as effectiveness metrics. An evaluation report covering only effectiveness will almost certainly be overturned during engineering rollout.

    4. Dataset Construction: Distribution Matters More Than Volume

    The dataset sets the ceiling on how trustworthy the conclusions are. Four principles are recommended:

    • Layered sources: mix desensitized real business logs, manually constructed boundary cases, and public general benchmarks in a set proportion.
    • Layered difficulty: define easy, medium, and hard tiers so samples do not all sit in the comfort zone, which would reduce discriminative power.
    • Annotation guidelines: provide decidable scoring rules with positive and negative examples for each dimension, and run a small-scale consistency check before annotation.
    • Version freezing: put the dataset under version control together with the evaluation scripts, and record the reason for every change.

    An illustrative sample structure (field names are for explanation only):

    1. {
    2. "id": "case-0421",
    3. "category": "multi_turn_instruction",
    4. "difficulty": "hard",
    5. "input": "……user input……",
    6. "constraints": ["must include three points", "must not output speculative conclusions"],
    7. "rubric": {"instruction_follow": 0.4, "factuality": 0.4, "format": 0.2}
    8. }

    5. Judging Responses: Dividing Work Between Automation and Humans

    Open-ended generation cannot rely fully on string matching. In practice, three judging methods are combined:

    • Rule-based checks: for hard constraints such as format, length, required fields, and numeric ranges; low cost and stable.
    • Model-assisted judging: another model scores against the rubric; human calibration is required first, with periodic spot checks on its consistency.
    • Human review: handles high-value, high-dispute, and red-line samples; results flow back into the calibration set.

    An easily overlooked detail is the judging order: run rule-based checks first to filter obviously failing responses, then model-assisted scoring, and have humans review only the gray-zone samples. This significantly reduces overall cost.

    1. def evaluate(case, response):
    2. hard = rule_check(case["constraints"], response) # hard constraints, filter first
    3. if hard["passed"] is False:
    4. return {"score": 0.0, "reason": hard["reason"]}
    5. soft = rubric_score(case["rubric"], case["input"], response) # soft dimensions
    6. return {"score": soft["total"], "need_human": 0.6 < soft["total"] < 0.8}

    6. Pipeline Engineering: Repeatability Is the Baseline

    Evaluation must be repeatable to have regression value. Split the flow into fixed stages: sample loading, batch inference, result persistence, metric computation, and report generation. Engineering considerations:

    • Apply concurrency control and failure retries in the inference stage so individual timeouts do not pollute the overall conclusion.
    • Store raw outputs separately from judging results, so the judging strategy can be swapped and recomputed without re-running inference.
    • Fix randomness-related parameters and record runtime environment information.
    • Reports should include at least per-dimension scores, per-difficulty scores, and clustering of failed samples, not just one aggregate score.

    On the cloud, this can be assembled from object storage for samples and artifacts, a container platform for batch inference jobs, a message queue to decouple stages, and logging plus monitoring and alerting to track job health. General product categories from Baidu AI Cloud can serve as one way to host this kind of architecture.

    7. Common Pitfalls

    1. Sample leakage: heavy overlap between evaluation samples and training data inflates results.
    2. Looking only at averages: averages hide the long tail; always check percentiles and the worst-performing range.
    3. Ignoring over-refusal: overly strict safety policies significantly hurt usability.
    4. Prompt overfitting: repeatedly tuning prompts for a single model breaks cross-model comparability.
    5. One-off evaluation: both models and business change, so evaluation must be periodic.
    6. Overreaching conclusions: applying general benchmark results directly to vertical business scenarios.

    8. Conclusion

    The value of evaluation is not a nice-looking score, but turning a vague “is this model good” into trackable, reproducible, comparable engineering metrics. Define the decision goal first, then design metrics and datasets in layers, split judging across rules, model assistance, and humans, and finally solidify the process as a pipeline. Only then can evaluation conclusions genuinely support selection, iteration, and launch gating decisions.