Evaluating Model Inference Performance for AI Agent Applications

    A practical framework for evaluating LLM inference performance in agent scenarios, covering a three-layer methodology across capability, workflow, and cost dimensions, with clear metric definitions, a cost model, reproducible engineering implementation, and guidance on avoiding common misreadings of benchmark results.

    1. Background: Why Aggregate Leaderboards Fail to Explain Agent Performance

    In enterprise applications and AI coding tools, a model is no longer just a component that answers questions. It acts as an execution entity that decomposes goals, selects tools, chains multiple actions together, and handles exceptions. This usage pattern is fundamentally different from traditional question answering: a single task often involves ten or even dozens of model invocations, and any deviation at one step is amplified along the chain. For this reason, using a single aggregate accuracy score to decide whether a model is “good for agents” is methodologically unsound.

    The original evaluation material shows a typical pattern. A new inference-optimized release raised its overall score in a general Chinese benchmark only from 71.0% to 71.5%, moving from 18th to 16th place. Language and instruction following rose from 67.6% to 69.3%, reasoning and math from 73.6% to 74.8%, while the agent and tool-calling dimension moved only from 64.2% to 64.5%. Looking at the total score alone, it is easy to conclude that the upgrade was insignificant. Yet the same release showed substantial gains on an agent benchmark designed for real workflows published at the same time. The two sets of data do not contradict each other; they measure different capability surfaces.

    2. Split Evaluation into Three Layers: Capability, Workflow, and Cost

    It is advisable to make the evaluation system explicitly layered so that different dimensions do not contaminate each other’s conclusions.

    The first layer is the single-turn capability surface, including language understanding, instruction following, and reasoning and computation. It measures whether a single invocation can produce a correct result. The second layer is the workflow surface, including tool selection accuracy, parameter-filling correctness, multi-step task completion rate, and failure recovery. It measures whether a task can be completed across dozens of consecutive invocations. The third layer is the cost surface, including per-invocation latency, average tokens consumed, and cost per thousand invocations. It measures whether the system can be deployed at scale.

    The key difference among the three layers lies in error propagation. Let the single-step success rate be p and a chain contain n steps that must all succeed; the end-to-end success rate is approximately p raised to the power of n. When p = 0.95 and n = 20, the end-to-end success rate is only about 0.36. This explains why a 0.3 percentage-point gain in a single-turn dimension can still produce a significant change in completion rate in a real workflow, provided the improvement occurs at a critical node of the chain.

    3. Define Metrics Precisely, or the Data Is Not Comparable

    Non-reproducible evaluation results usually stem from vague metric definitions. It is recommended to fix the following definitions in the evaluation document:

    1. task_success: end-to-end task completed with no unauthorized operations
    2. step_success: a single tool call with both correct parameters and correct semantics
    3. retry_budget: maximum retries per task, recommended 2~3
    4. latency: end-to-end wall-clock time, including real tool execution
    5. token_accounting: input + output + tool returns counted after truncation
    6. cost: measured separately by invocation count and token volume, not mixed

    Two points deserve special emphasis. First, latency must include the real execution time of tools; counting only model generation time severely underestimates production performance. Second, token accounting must include tool return content. In long-chain tasks, tool output is often the main source of token consumption rather than the model’s own reasoning text.

    4. Cost Model: Convert “Cost per Thousand Invocations” into a Business Unit Price

    The reference data given in the evaluation is about 15,000 questions, an average of 52 seconds per invocation, an average of 2,934 tokens consumed, and a cost of about 60.8 CNY per thousand invocations. These numbers only have decision-making value once converted into business terms.

    Assume a task requires 15 invocations on average. The cost per task is about 60.8 × 15 / 1000 ≈ 0.91 CNY, and the average time per task is about 52 × 15 ≈ 13 minutes in a serial case. If parallelization compresses the critical path to 5 serial invocations, latency can drop to about 4 minutes while cost stays roughly unchanged. This shows that optimizing the chain structure yields far greater benefits for latency than for cost, and the two should be optimized separately.

    5. Engineering Implementation of Reproducible Evaluation

    The evaluation framework itself should be treated as an engineering project that requires version control. It is recommended to include four modules: task set management, execution sandbox, result verification, and report generation.

    1. def run_task(task, model, sandbox, budget=3):
    2. history, cost, steps = [], 0, 0
    3. for _ in range(budget):
    4. resp = model.invoke(task, history) # record input and output tokens
    5. cost += resp.tokens
    6. if resp.action == "final":
    7. return sandbox.verify(resp.payload), cost, steps + 1
    8. obs = sandbox.execute(resp.tool, resp.args) # real execution with timing
    9. history.append((resp, obs))
    10. steps += 1
    11. return False, cost, steps

    The sandbox needs resource quotas, network isolation, and operation auditing. It can be built on common cloud capabilities such as container platforms, object storage, logging services, and monitoring and alerting, ensuring that the evaluation process is replayable and results are traceable. The verification step should use assertions that can be validated automatically (file contents, API returns, data consistency) as much as possible, reducing the variance introduced by manual scoring.

    6. Interpreting Results: Three Common Misjudgments

    The first is the aggregate-score misjudgment. The total score is a weighted average across dimensions; when the optimization direction is clear, changes in the total score are inevitably diluted, so one should return to per-dimension results to see structural changes. The second is benchmark mismatch. Agent benchmarks designed for real workflows emphasize tool-chain invocation and multi-step execution, which differs in focus from the agent dimension in general benchmarks; the two cannot substitute for each other. The third is the average misjudgment. Averages hide the long tail; for long-chain scenarios, one should focus on P90/P95 latency and the distribution of failed tasks rather than the average.

    7. Implementation Recommendations

    If the goal is to build a stable agent application, it is recommended to proceed in the following order. First, establish a per-dimension, reproducible internal evaluation set; it does not need to be large but must cover failure recovery and unauthorized-operation interception. Second, optimize the chain structure by reducing unnecessary serial invocations, compressing tool return content, and setting a retry budget. Finally, assess deployment feasibility with the cost model, using the cost per task and P95 latency as inputs for capacity planning. Model selection should serve the specific chain rather than leaderboard ranking. When the evaluation criteria align with the business chain, a 0.3 percentage-point improvement can be equivalent to a substantial improvement in the production completion rate.