Model Evaluation for Long-Horizon Agent Tasks: A Practical Framework

    This article presents an engineering-oriented approach to evaluating large language models for long-horizon agent work instead of relying on chat quality, public leaderboard scores, or one-off demos. It explains how to separate conversational and agent workloads, define frozen acceptance criteria, measure task completion, token efficiency, unit cost, and hallucinations separately, run reproducible sandboxed trials, and make staged rollout decisions based on cost per successful task. It also covers decision rules, operational practices, and common evaluation pitfalls that can hide real costs or inflate apparent gains.

    When enterprises adopt a higher-tier large language model, a common misjudgment is to treat “it chats more intelligently” as a reason to upgrade. Fluent conversation and flat scores on knowledge Q&A do not automatically mean lower delivery cost for complex tasks. A safer approach is to split use cases first: short-turn writing and Q&A, and agent tasks that require continuous planning, tool calls, and multiple rounds of self-correction have completely different evaluation criteria. The following section describes a practical engineering method for comparison, not a product review or experience report for any specific model.

    Define the Problem First

    Before evaluation begins, write down three types of constraints so that results are not explained later by subjective impressions.

    The first is input and output modality. Many production pipelines only need text in and text out, with image understanding as a secondary capability. If the business depends heavily on multimodal generation, build a separate evaluation set; do not mix it with pure-text tasks in a single total score.

    The second is context and generation length. Long documents, long logs, and multi-file codebases consume context windows. Agents also need output budget for tool returns, intermediate plans, and failed retries. A larger window does not mean higher accuracy; it only means “more fits.” Whether the required artifacts fit should be tested with samples of real artifact lengths, not with advertised maximum values.

    The third is knowledge freshness. Facts, APIs, and regulations that appeared after training or knowledge cutoff will necessarily be incomplete in the model. For such questions, retrieval or human review should be mandatory. Do not treat the cutoff date itself as a quality metric.

    It is useful to divide tasks into two baskets:

    • Conversation basket: writing, summarization, concept explanation, and single-turn difficult questions. Success criteria include readability, factual-check pass rate, and human editing time.
    • Agent basket: tasks that require several hours of continuous execution, many steps, inspectable intermediate states, and work people do not want to do manually—for example, cross-module changes, batch data-cleaning pipelines, and specification-based code changes that are generated and self-tested. Success criteria include task completion, regression passing, and total spend.

    Scores from the two baskets should not be weighted into a single “general intelligence score” and then used for procurement decisions. Public leaderboards can provide background, but they cannot replace your own artifacts.

    Set Metrics That Are Not Distorted by Leaderboards

    Record at least four metrics. Omitting any one of them can lead to the opposite conclusion.

    1. Task completion rate. Define acceptance conditions in advance: tests pass, the diff conforms to the specification, and the output can be parsed by downstream systems. Partial completion should be counted as failure or scored by checkpoints, with the rules frozen before the run.
    2. Token efficiency. Under the same task framework, count total tokens for input, output, and tool round trips. For similar results, a lower total token count usually means less wasted planning and fewer repeated calls.
    3. Unit task cost. Use the pricing unit in your contract—per million tokens or an annual quota—to calculate the cost of a successful task, including failed retries. Comparing list-price multipliers alone ignores changes in the actual bill caused by shorter runs.
    4. Report hallucinations and accuracy separately. A lower hallucination rate accompanied by more refusals may mean less useful information. Higher accuracy accompanied by longer, more expensive generation may not be worthwhile. Knowledge questions should have traceable sources, and the evaluation should distinguish between “incorrect,” “unsupported,” and “correct refusal.”

    Do not turn a subjective score from one chat demonstration into a conclusion. The sample should cover at least simple, medium, and failure-prone categories, and random seeds, temperature, and tool permissions should be fixed. Otherwise, two runs cannot be compared.

    A simple record schema can be enough:

    1. task_id, basket, success, input_tokens, output_tokens,
    2. tool_rounds, wall_minutes, retry_count,
    3. hallucination_flag, factual_check, cost_units

    When aggregating, group by basket and report medians rather than only means. This prevents a few exceptionally long trajectories from pulling up cost.

    When It Is Worth Paying for Long-Horizon Execution

    In practice, upgrades are more meaningful for the agent basket than for the conversation basket.

    If the bottleneck is that the model must work continuously for a long time without a human adjusting prompts in the middle, focus on total tokens at the same completion rate, whether it can recover from checkpoints after failure, and whether cost per successful task is lower than the current solution. If it uses fewer tokens and retries less often, the weekly bill may still fall even when the nominal unit price is higher. In this case, run a time-boxed parallel trial rather than a full migration.

    If the main use is writing, chat, or difficult questions that can be completed in a single turn, and leaderboard scores are close while unit prices are clearly higher, it is usually not worth increasing the budget merely for a “stronger feel.” Spending that budget on retrieval, evaluation sets, and human spot checks often reduces errors more effectively than switching models.

    Knowledge tasks require separate analysis of hallucination behavior. If the candidate reduces unsupported statements on your question set and accuracy does not drop, it may serve as the default engine for high-risk answers. If the only improvement is a better conversational tone, keep the existing model and add citation verification for high-risk answers.

    A simple decision rule:

    • Conversation basket costs more and quality is flat: do not upgrade.
    • Agent basket completion is flat or better, and cost per successful task falls: run a small-traffic pilot.
    • Completion improves but cost rises sharply: route only the most expensive failing tasks to the candidate and keep the rest unchanged.
    • Either basket shows more silent failures—appearing complete but failing acceptance: fix the evaluation before discussing procurement.

    Run Evaluations That Approximate Real Bills

    Fix the execution framework. Agent results depend heavily on the planning loop, tool allowlist, retries, and context truncation. Changing the framework is equivalent to changing the test. When comparing models, lock the same runtime: the same step limit, the same tools, and the same logging granularity.

    Control permissions. Evaluation accounts should only access repository copies, de-identified data, and sandboxes. Long tasks can create larger side effects through tool calls, and the evaluation itself should not touch production.

    Log trajectories, not just final answers. Save the plan, a summary of each tool input and output, and failure classifications such as planning error, tool error, context overflow, and factual error. A token reduction caused by fewer invalid tool calls indicates better execution quality; one caused by giving up early means completion is being inflated.

    Examine latency by environment. First-token latency, queueing, and rate limits change the wall-clock time of agent tasks. Longer wall-clock time can delay a release window even if fewer tokens are used. Include “can people wait” in acceptance criteria rather than looking only at model-side billing.

    Questions after the knowledge cutoff should always go through retrieval. If retrieval misses, require the model to say explicitly that it does not know. Apply this policy uniformly to all models so that being more willing to fabricate is not mistaken for capability.

    Engineering Rollout, Not a One-Off Showcase

    A four-step process is recommended, with an exit condition at each step.

    1. From real tickets in the past month, sample 30 to 50 conversation examples and 10 to 20 long tasks. If there are too few long tasks, do not claim agent benefits.
    2. Run the existing solution and candidate models on the same framework, and produce the record table described above. Human reviewers should examine failures and spot-check successes, not rewrite every output.
    3. Calculate an interval for cost per successful task, not a point estimate. Include retries, cache hits, and fixed prompt overhead. Caching and prompt reuse often save more than switching models.
    4. Switch only the task types that pass the rules to the candidate, and set a one-week rollback period: if completion or serious hallucination worsens, revert. Leave other traffic unchanged.

    Integration with other cloud capabilities should remain generic: object storage for trajectories and artifacts, logging, monitoring, and alerting for failure rates and cost curves, and containers or job platforms to isolate long-running work. These are capability categories and do not need to be tied to one vendor’s proprietary API names. If you already run batch processing or log analysis on Baidu AI Cloud, evaluation data can be archived and thresholded in the same way. The focus should be on bills, success rates, and alerts, not on introducing another external leaderboard that cannot be audited.

    Version prompts and tool protocols. When a model changes, formatting assumptions in old prompts may fail. Define output constraints as a parsable structure and use validators to reject incomplete results. This is more effective than adding repeated instructions such as “please be correct” to the prompt.

    1. Checkpoint: every N steps, write a plan summary and a list of changed files
    2. Failure: if the validator fails, stop and mark the reason; do not exceed the retry limit silently
    3. Success: the acceptance script exits with code 0, and changes are within allowed paths

    Common Pitfalls

    • Treating a public aggregate score as a procurement score. The weighting of chat and agent tasks in an aggregate score has nothing to do with your ticket distribution.
    • Looking only at input and output prices. Actual cost equals price multiplied by the tokens on both successful and failed paths.
    • Sample leakage. Using the model to generate “reference answers” and then asking the same model to solve the task overestimates accuracy.
    • Ignoring human time. If an upgrade still requires engineers to read four hours of trajectories, saved tokens have not become saved person-hours, and the investment does not pay off.
    • Rolling out fully after one successful pass. Long tasks have high variance; repeat at least once across working days.

    Conclusion

    What deserves more budget is work that runs continuously, has automatically verifiable acceptance criteria, and uses fewer tokens or produces fewer hallucinations under the same framework. What does not deserve more budget is writing, chat, and single-turn Q&A that already work well enough. First build the baskets, freeze acceptance criteria, and record tokens and failure types. Then use cost per successful task to decide whether to make a limited-traffic switch. This produces a reversible engineering conclusion rather than an impression from a chat demonstration.