How to Build a Trustworthy LLM Evaluation System: Benchmarks, Agentic Coding, Hallucination, and Cost

    A recent Chinese LLM benchmark showed top models separated by less than one point overall, while their per-category profiles diverged sharply. This article explains how to read and build a credible evaluation system across four dimensions: layered capability definitions, agentic coding benchmark design, measurable hallucination scoring, and comparable cost per task. It includes a sandbox-based evaluation loop, a three-state hallucination score, and an effective-cost model that factors in retries and pass rate, plus a practical checklist for technical teams.

    The Technical Logic Behind Chinese LLM Benchmarks

    A recent round of Chinese general-capability testing drew attention: several mainstream LLMs ended up within one point of each other in total score, and under a rule that treats gaps under one point as a tie, the top models effectively landed in the same tier. That convergence in total scores contrasts with what happened at the category level, where differences were magnified—complex reasoning, agentic coding, hallucination control, and cost per unit of task each traced a different curve.

    For developers and enterprise technical decision-makers, a leaderboard is only an outcome. The real value lies in the evaluation methodology behind it and what that methodology means for engineering. Setting aside specific product attributes, this article focuses on how to read and build a credible LLM capability evaluation system, covering four key dimensions: defining capability layers, designing agentic coding evaluations, quantifying hallucinations, and establishing a comparable basis for inference cost.

    1. Similar Total Scores Do Not Mean Similar Capabilities: Evaluation Needs Layers

    When the total-score gap among top models is compressed to under one point, the information content of the total score decays quickly. The reason is simple: a total score is a weighted average of multiple sub-items, and once the weights are fixed, structural differences between models get averaged away. A model that is strong at engineering development but weaker on long context can easily finish with nearly the same total as one that excels at long context but is mediocre at code.

    The more reliable engineering approach is a layered evaluation:

    • Base language layer: Chinese semantic understanding, commonsense and factual QA, long-document information extraction and summarization;
    • Reasoning layer: multi-step logical inference, math and constraint-satisfaction problems, reading comprehension that requires integrating information across passages;
    • Agentic layer: completing tasks given a toolset and environment, including planning, tool invocation, error correction, and termination decisions;
    • Engineering layer: code generation, bug fixing, refactoring, and runnability verification;
    • Reliability layer: hallucination rate, appropriateness of refusals, instruction following, and format stability;
    • Economics layer: cost per unit of task, latency distribution, and timeout rate.

    Once evaluation is layered, the selection question shifts from “who scores higher” to “who is more stable on my scenario distribution.” A practical technique is to sample real business requests into a private acceptance set of a few hundred items, run it under a unified measurement standard, and cross-check the results against public leaderboards. When the two disagree, trust the private set that mirrors your own distribution first.

    2. Agentic Coding: From “Writing Code” to “Finishing the Task”

    One notable change in this round of testing was the timeout rate dropping from a high level to zero, meaning every model under test completed all tasks within the time limit. This metric deserves more attention than the scores, because it measures task completability rather than the quality of isolated snippets.

    Agentic coding evaluation differs fundamentally from traditional code-completion evaluation. The latter assesses the correctness of local snippets; the former assesses the ability to close the loop on a task within a limited number of steps, limited time, and limited context. A reusable evaluation framework typically includes:

    1. Environment isolation: each task runs in a separate sandbox with pinned dependency versions, so environment drift does not contaminate results;
    2. Verifiable acceptance criteria: unit tests, static checks, or end-to-end output comparison serve as the sole basis for judgment;
    3. Step and budget constraints: limits on tool calls, total latency, and context length approximate real production conditions;
    4. Failure attribution: separating “planning error,” “tool invocation error,” “compilation failure,” “test failure,” and “timeout” makes it easier to pinpoint weaknesses.

    The evaluation driver logic can be sketched as the following pseudocode; the emphasis is on treating runnability as a hard gate:

    1. def evaluate(task, agent, budget):
    2. env = Sandbox(image=task.image, timeout=budget.wall_clock)
    3. trace = []
    4. for step in range(budget.max_steps):
    5. action = agent.next_action(task.prompt, trace)
    6. if action.type == "submit":
    7. break
    8. obs = env.call(action.tool, action.args) # unified entry point for tool calls
    9. trace.append((action, obs))
    10. if env.exceeded(budget):
    11. return Result(status="timeout", trace=trace)
    12. report = env.run_tests() # the sole acceptance criterion
    13. return Result(status="pass" if report.ok else "fail",
    14. score=report.coverage, trace=trace)

    The value of this design is that timeout rate, first-pass rate, average step count, and average tool-invocation failure rate together form a more dimensional picture than a single score. When the timeout rate falls to zero, it indicates the models’ planning and termination decisions have reached engineering usability, and the remaining differences show up in pass rate and step efficiency.

    3. Hallucination Control: Turning “Making Things Up” into a Measurable Metric

    Hallucination is the core metric of the reliability layer. To make it measurable, the key is to construct questions with a single, verifiable answer and to distinguish three error types:

    • Factual errors: conflicting with authoritative sources;
    • Ungrounded generation: the task requires answering from given material, but the model introduces content outside it;
    • Overconfidence: failing to express uncertainty when information is insufficient.

    A common quantification approach introduces an interpretable scoring function that scores correct answers, errors, and appropriate abstentions separately:

    1. score = (N_correct * 1.0 + N_abstain * 0.5 - N_wrong * 0.5) / N_total

    Here N_abstain is the number of samples where the model correctly abstained or flagged uncertainty when evidence was insufficient. This design encourages models to “answer when they know and admit when they don’t,” rather than guessing to inflate surface accuracy. In production, you can also add citation constraints and consistency checks on the generation side: require every conclusion to carry a source snippet, then run a lightweight check on whether the conclusion is supported by that source, triggering a rewrite or a downgrade to “insufficient information” when it is not.

    4. Comparable Cost: Cost per Task Is the Decision Metric

    A conclusion like “average cost per question dropped by roughly 80%” is essentially a normalized metric: token consumption multiplied by unit price, divided by the number of tasks. It is closer to the real bill than “price per million tokens,” because the token volume different models need to complete the same task can differ by several times.

    To make cost comparable, four things must be aligned:

    1. Consistent task definition: the same question set, the same acceptance criteria, the same time limit;
    2. Consistent token accounting: whether input, output, and cache hits are metered separately must be declared in advance;
    3. Failure costs included: compute consumed by timeouts and retries must be counted in total cost, or the expense of unstable models will be underestimated;
    4. Consistent latency constraints: compare under the same latency ceiling to avoid trading “slow but cheap” for a low price.

    A simplified cost model looks like this:

    1. cost_per_task = (in_tokens * p_in + out_tokens * p_out) * (1 + r_retry)
    2. latency_p95 constraint: must be <= the acceptable limit for the business

    Here r_retry is the average retry rate. Viewing it alongside pass rate yields effective cost, the average price actually paid to complete a task:

    1. effective_cost = cost_per_task / pass_rate

    This metric exposes a common trap: a model with a lower unit price can have a higher effective cost if its pass rate is markedly lower.

    5. A General Path for Capability Upgrades: Reasoning, Multimodality, and Agents

    The capability gains reflected in this round of testing concentrate on three general paths, which also apply to technical planning for in-house or fine-tuned solutions:

    • Strengthening complex reasoning while optimizing reasoning overhead: through more thorough reasoning-chain training and inference-time compute allocation strategies, invest more compute on harder questions and converge promptly on easy ones, reducing average overhead without sacrificing accuracy;
    • Adding native visual understanding and human-machine interface operation: bringing screen captures, interface elements, and text instructions into a unified representation so the model can complete cross-application workflow tasks, which is clearly valuable for process automation;
    • Strengthening long context and agentic planning: the value of long context lies not in “fitting more in” but in “finding it and using it,” which requires retrieval and segmented summarization strategies to keep key information from being diluted; planning ability shows up in task decomposition, dependency ordering, and failure fallback.

    6. A Practical Checklist for Technical Teams

    • Build a layered evaluation set; treat public leaderboards as reference only and use a private acceptance set as the decision basis;
    • Make timeout rate, first-pass rate, and effective cost first-class metrics, weighted equally with accuracy;
    • Score hallucination evaluation on a three-state basis (correct/abstain/wrong) and add source constraints on the generation side;
    • Unify token accounting in cost calculations, include retries, and use p95 latency as a constraint;
    • Keep the model integration layer replaceable: a unified inference interface, unified logging and monitoring alerts, unified quotas and fallback policies, avoiding tight coupling to a single vendor;
    • After launch, continuously sample real requests through logging services and monitoring alerts, and run regression evaluations periodically to prevent capability drift from version updates.

    If you need a validation environment close to your own business, you can build an isolated sandbox and evaluation pipeline on general-purpose capabilities such as the container platform, object storage, logging service, and monitoring alerts offered by Baidu AI Cloud, chaining evaluation, cost accounting, and production monitoring into a closed loop.

    Conclusion

    A one-point gap on a leaderboard often translates, in engineering terms, into stability differences across scenarios. What truly determines the quality of a model choice is not the ranking in any single evaluation, but whether you have a layered, verifiable, cost-comparable evaluation system. Put timeout rate, pass rate, hallucination rate, and effective cost on the same table, and model capability turns from an abstract score into an engineering metric you can manage and optimize.