LLM Agent Evaluation: Balancing Cost and Capability

    This article explains how engineering teams can independently evaluate LLM agents after new model releases. It covers three core dimensions—task completion quality, cost per task, and latency and stability—along with evaluation set design, cost accounting per successful task, specialized capability tests, common interpretation pitfalls, and gradual rollout practices.

    1. Why New Model Releases Need Independent Evaluation

    Every time a new LLM version is released, teams face the same question: is it suitable for our business? Vendors usually publish a set of benchmark scores, but those scores are based on tasks, prompt templates, and billing definitions chosen by the vendor. Applying them directly to your own system often does not produce the same conclusions.

    Engineering teams therefore need their own evaluation process. The goal is clear: compare candidate models in real scenarios using the same task set, the same judgment criteria, and the same cost calculation method. Only then can model selection conclusions be reproducible, and only then can regression comparisons be made after model upgrades.

    2. Three Core Dimensions

    When evaluating agentic applications, it is advisable to focus on at least the following three dimensions.

    1. Task completion quality. The criterion is whether the task is completed according to the specification, not whether the answer is fluent. For agents that need to call tools, read or write files, or perform multi-step operations, record the result of each step and judge success by the final state.
    2. Cost per task. Calculate the average cost to complete one task, not just the per-call unit price. Failures, retries, and fallback paths all increase actual cost and must be included.
    3. Latency and stability. This includes first-token latency, overall completion time, and consistency of results across multiple runs for the same input. Online services also need attention to rate limiting and timeout ratios.

    The three dimensions must be considered together. A model with a higher success rate may not be cost-effective at large scale if its cost per task is several times that of a competitor. Conversely, a model with a low unit price but a low success rate will create substantial manual review costs.

    3. Building an Evaluation Set

    The quality of the evaluation set determines the credibility of the conclusions. The following practices can be used when building it.

    • Stratify by business scenario. For example, document processing, code modification, data analysis, and customer service Q&A. Set independent sample counts for each stratum to avoid one task type dominating the average.
    • Sample sources. Prioritize de-identified real requests, then add boundary cases such as missing input fields, format errors, and conflicting instructions.
    • Fix judgment rules in advance. Use programmatic checks wherever possible, such as whether the output conforms to a structure, whether test cases pass, or whether file content hashes match. For parts that cannot be programmatic, use two-person annotation and calculate the agreement rate.
    • Prevent data contamination. Evaluation samples should not appear in model training materials. If this cannot be confirmed, periodically replace a portion of the samples and record the replacement time.

    The evaluation set should cover at least several hundred tasks. Maintain version numbers after each model or prompt change so that the source of conclusions can be traced.

    4. Cost Accounting

    The unit price table is only the starting point. Actual cost is determined by input and output token counts, tokens consumed by the reasoning process, number of tool calls, retries after failures, and fees from switching to a fallback model after the primary model fails.

    The example below shows how to calculate cost per successful task. The prices in the example are placeholders; replace them with actual billed prices when using the code.

    1. from dataclasses import dataclass
    2. @dataclass
    3. class TaskRecord:
    4. succeeded: bool
    5. input_tokens: int
    6. output_tokens: int
    7. retries: int # Number of retries; each retry counts the same token volume
    8. fallback_used: bool # Whether a fallback model was used
    9. def cost_per_success(records, price_in, price_out,
    10. include_fallback=True):
    11. """
    12. price_in / price_out: price per 1,000 tokens
    13. Returns: average cost per successful task; returns inf if no task succeeds
    14. """
    15. if not include_fallback:
    16. records = [r for r in records if not r.fallback_used]
    17. total_cost = 0.0
    18. successes = 0
    19. for r in records:
    20. attempts = 1 + r.retries
    21. unit_cost = (r.input_tokens * price_in
    22. + r.output_tokens * price_out) / 1000
    23. total_cost += unit_cost * attempts
    24. if r.succeeded:
    25. successes += 1
    26. if successes == 0:
    27. return float("inf")
    28. return total_cost / successes

    This code involves two accounting issues.

    First, whether to include the cost of the fallback model. Excluding tasks that switched models makes the result look better, but it hides reliance on fallback paths in real operations. It is recommended to output both sets of numbers and explain the sample scope in the report.

    Second, whether retries are billed exactly as repeated attempts. If the context is longer on retry, the actual cost will be higher than the example estimate. Recalculate using the actual token counts recorded in logs.

    5. Designing Tests for Specialized Capabilities

    General task scores cannot reflect capability differences in some professional scenarios. The following three capabilities are worth separate test design.

    5.1 3D Spatial Understanding

    The test target is the model’s ability to describe and reason about spatial relationships. For example, given a set of object coordinates and orientations, ask it to determine occlusion relationships, reachable paths, or assembly order. Use geometric calculation results as the ground truth rather than relying on subjective human scoring.

    5.2 Mechanical Modeling and Assembly

    Ask the model to list parts, assembly sequence, and constraints based on requirements, then use existing geometry validation programs to check interference and tolerances. The model’s output must be programmatically verifiable; otherwise its engineering value is difficult to judge.

    In simulation scenarios, the focus is on whether parameter settings are reasonable, such as whether units are consistent, boundary conditions are complete, and orders of magnitude are plausible. For computed results, compare against analytical solutions or verified numerical methods.

    These three types of tests should retain a manual review step. Before a model’s proposal enters the production process, an engineer needs to confirm it.

    6. Common Pitfalls in Interpreting Results

    • Looking only at a single leaderboard. The weights in a composite ranking are decided by the leaderboard designers and may not match your business weights.
    • Ignoring sample exclusions. If a report says some tasks were excluded from the comparison, ask why and how many. The excluded samples may be exactly the high-difficulty or high-failure tasks.
    • Treating small differences as significant. If two models’ success rates differ by only one or two percentage points and the sample size is only a few dozen, the conclusion may be random fluctuation. Calculate confidence intervals or run repeated experiments.
    • Ignoring frontline feedback. Feedback from early users often exposes issues such as prompt compatibility and output format changes. This feedback cannot replace benchmark tests, but it should be included in the risk list.

    7. Implementation Recommendations

    After evaluation, rollout should be gradual.

    1. Canary release. First switch a small amount of traffic to the new model and record results in parallel with the original model.
    2. Set rollback thresholds. For example, if the success rate drops beyond an agreed proportion, or if cost per task exceeds the budget cap, automatically switch back to the original model.
    3. Continuous monitoring. Build dashboards for success rate, average cost, timeout rate, and manual correction rate, and configure alerts.
    4. Periodic re-testing. Rerun the same evaluation set at intervals to observe whether server-side updates bring behavior changes.

    The evaluation process itself also needs version management. Each conclusion should record the evaluation set version, prompt version, model version, and billing data source to facilitate later audit and retrospective.