Long-Horizon Coding Benchmarks: How to Read Pass Rates, Latency, and Cost

    Long-horizon coding tasks are becoming a key benchmark for evaluating AI coding agents. This article explains how to interpret pass rate, average completion, average latency, and per-run cost; why pass rate and completion can diverge; how to normalize cost per passed task; and how to design tiered routing and internal evaluation pipelines.

    1. Why long-horizon tasks have become the new capability divide

    Past code-generation benchmarks focused on short-horizon tasks: completing a function, fixing a localized defect, or explaining a code snippet. These tasks have small context windows, short feedback loops, and simple scoring criteria, making it difficult for models to show meaningful separation.

    Real engineering work is different. A requirement often spans multiple modules and involves build configuration, dependency versions, test fixtures, and existing conventions. The solver must decompose the task, read code repeatedly, run commands, inspect errors, and correct course. Such tasks often require dozens of consecutive steps with sparse feedback and may take hours or even days.

    Long-horizon tasks expose capability differences that short-horizon benchmarks miss:

    • State management: keeping key constraints within a limited context instead of forgetting the original goal midway through a long chain of steps.
    • Verification loops: actively building, running, and checking results instead of declaring completion after writing code.
    • Failure recovery: continuing to try and converge when environments are missing or approaches fail, rather than getting stuck in repeated loops.

    Therefore, as the industry shifts evaluation from short-horizon questions to multi-step tasks on large real repositories, the meaning of metrics changes. These benchmarks no longer measure only whether a model can write code, but whether it can independently complete a task.

    2. Reading a long-horizon benchmark: four core metrics and their boundaries

    A rigorous long-horizon evaluation usually reports four types of numbers, each answering a different question:

    1. Pass rate: whether a task is judged as completed end to end, typically by executable tests, build results, or strict review. This is the closest signal to production readiness and the strictest metric. Any failure in hidden cases, edge inputs, or regression checks counts as failure.

    2. Average completion: progress scoring for unfinished tasks, reflecting how far a solution is from the endpoint. It answers not whether the result is usable, but how much work a human must add before taking over.

    3. Average latency: wall-clock time from task submission to judged completion. It determines the rhythm of human-machine collaboration and whether an agent can fit within CI time budgets.

    4. Cost per benchmark run: model invocation cost for one complete evaluation. This is not per-token pricing; it covers the entire task set and already includes retries, tool-call round trips, and the amplifying effect of long context.

    Three meta-metrics are often overlooked but equally important for selection:

    • Variance: whether the same task passes consistently across repeated runs.
    • Reproducibility: whether environment snapshots, dependency locks, and random seeds are fixed.
    • Framework coupling: how much of the score comes from agent scaffolding orchestration versus the model itself.

    The same model can show significant long-horizon pass-rate changes under different orchestration frameworks. Directly comparing raw scores without considering framework coupling can easily lead to incorrect conclusions.

    3. Why pass rate and completion often diverge

    Long-horizon evaluations often show a pattern: average completion is high, around or above 80%, while pass rate is around 20%.

    This gap is not contradictory; it reflects the structural nature of long-horizon tasks. Completion is usually scored by stage: requirement discovery, solution design, code placement, and initial self-checks all contribute. Strong executors can often handle these early stages. The real threshold is at the end: hidden edge cases, implicit contracts between modules, and regression risks introduced by changes. The final ten-odd percentage points often require global consistency reasoning across files and can be as difficult as all previous steps combined.

    This leads to two engineering conclusions:

    First, do not use completion as a substitute for pass rate when making delivery commitments. An 80% completion rate may sound close to delivery, but it may actually mean “the scaffolding is done but the change is not mergeable.” Manual rework may not be lower than implementing from scratch.

    Second, do not use pass rate alone for procurement decisions. If average completion is high across a task set, most failures are likely “partial results” that engineers can converge within a short time. That value should be explicitly counted in cost analysis rather than treated as zero. Conversely, if failed samples generally stop early and completion is low, low pass rate is a hard capability constraint; adding more people only increases cost.

    The correct approach is to read them as a pair: pass rate measures the boundary of autonomous closure, while completion measures the leverage ratio of human-machine collaboration. Pass rate determines which tasks can be handed to the system unattended; completion determines which tasks are worth doing together with the system.

    4. Cost cannot be judged by unit price alone: normalize to cost per passed task

    In long-horizon tasks, per-run cost often does not align with final economic efficiency. The reason is that pass rate enters the denominator: a cheaper solution with a noticeably lower pass rate requires more retries to produce the same number of usable artifacts.

    A simple normalization model can align the comparison:

    1. def cost_per_passed_task(per_run_cost, pass_rate, review_hours, human_hourly_cost):
    2. """Convert per-run cost into total cost per passed task.
    3. per_run_cost: cost of one complete run
    4. pass_rate: pass rate of the selected tier on the target task set (0-1)
    5. review_hours: average human convergence hours per candidate artifact
    6. """
    7. if pass_rate <= 0:
    8. return float("inf")
    9. expected_runs = 1.0 / pass_rate # expected number of runs
    10. ai_cost = per_run_cost * expected_runs # model-side cost
    11. human_cost = review_hours * human_hourly_cost # human convergence cost
    12. return ai_cost + human_cost

    The following hypothetical illustrative data is only used to demonstrate the calculation; it does not represent any real product:

    Tier Cost per run Pass rate Expected runs Model cost Human review (2h at CNY 200/hour) Total
    High-completion tier CNY 2,000 24% 4.17 CNY 8,340 CNY 400 CNY 8,740
    Lightweight high-speed tier CNY 66 17% 5.78 CNY 382 CNY 400 CNY 782

    Under this calculation, the high-cost option with a roughly seven-percentage-point higher pass rate has a per-task cost one order of magnitude higher. The difference comes from total compute consumed per additional passed task, not from unit price. This also explains why budget-sensitive, latency-sensitive teams may prefer lightweight high-speed tiers: they are often more cost-effective after normalization, provided the task difficulty distribution falls within their capability range.

    The model must be honest about three omitted factors: merge risk from failed artifacts, attention fatigue in human review, and the non-negotiability of quality floors on high-value tasks. For changes involving permissions, data migration, payment, and billing paths, quality should be a hard gate. Filter out unqualified tiers by pass rate first, then compare cost among qualified tiers—not the other way around.

    5. Latency is an undervalued first-class concern

    Wall-clock time is often treated as secondary in model selection, but it affects four areas:

    Human-machine collaboration rhythm. Hour-level tasks effectively change the interaction mode from “conversation” to “delegation.” Developers need a way to inspect progress, correct course, and avoid interrupting execution. Asynchronous task queues with progress logs fit this rhythm better than synchronous waiting.

    Pipeline time budgets. Build and release pipelines usually have timeout limits. An execution option with several times the average latency and higher variance can cause more timeout reruns, and rerun costs are often not listed separately in total cost tables.

    Resource occupancy and queuing. Long-running tasks occupy sandboxes, containers, and build quotas for extended periods. Under concurrent team usage, queuing occurs, and actual delivery time can exceed the single-run latency.

    Cost coupling. Long latency usually comes with long context and multiple tool round trips, causing token consumption to grow nonlinearly. In long-horizon tasks, latency and cost are not independent dimensions; they are two sides of the same coin.

    The engineering response is to treat latency as a programmable constraint: set different timeouts and maximum step budgets for different difficulty tiers, downgrade or escalate to humans on timeout, and log steps, round trips, and failure categories for each task as a basis for tuning.

    6. Selection methodology: tiered routing and fallback strategies

    There is no single “best execution option,” only the best combination under a given task distribution and budget constraint. A practical approach is tiered routing: classify tasks by difficulty, map execution tiers to capability-cost curves, and allow upgrades step by step.

    1. # Tier definition: (tier, timeout budget in minutes, max steps, budget)
    2. TIERS = [
    3. ("lightweight", 30, 40, "low"),
    4. ("standard", 120, 120, "medium"),
    5. ("flagship", 1440, 400, "high"),
    6. ]
    7. def route(task, tiers=TIERS):
    8. """Select an execution tier based on task complexity and escalate on failure."""
    9. if task.touched_modules <= 2 and task.has_executable_tests:
    10. start = 0
    11. elif task.touched_modules <= 8:
    12. start = 1
    13. else:
    14. start = 2
    15. for idx in range(start, len(tiers)):
    16. name, timeout, max_steps, budget = tiers[idx]
    17. result = run(task, tier=name, timeout_min=timeout,
    18. max_steps=max_steps, budget=budget)
    19. if result.passed:
    20. return result
    21. record_failure(task, tier=name, reason=result.failure_class)
    22. return escalate_to_human(task)

    Three supporting rules are more important than the routing table itself:

    • Escalation must converge. Limit escalation to at most two tiers to avoid repeatedly retrying the same failed sample on expensive tiers. For reproducible environment-related failures, escalate to humans directly instead of consuming high-cost budget.
    • Failures must be categorized. Classify failures into categories such as missing environment, requirement misunderstanding, cross-file consistency errors, introduced regressions, and loop stalls. Category statistics indicate improvement directions better than overall pass rate: environment failures are solved by sandbox snapshots and dependency locking, while consistency errors are addressed by context engineering and review rules.
    • Regressions must leave a trace. Add every missed failure sample to an internal regression set. This creates evaluation assets that only grow and prevents hidden regressions when upgrading models or changing configurations.

    7. Six engineering principles for building an internal long-horizon evaluation set

    External leaderboards are useful for calibrating direction, while internal evaluation sets are used for day-to-day decisions. To be trustworthy, they should meet at least these requirements:

    1. Tasks come from a real requirement queue and are desensitized, rather than manually constructed toy problems for evaluation.
    2. Judgment is executable and unambiguous, based on tests and build results, with review criteria written as checkable lists.
    3. Hidden test cases are retained to prevent overfitting-style implementations that target only visible assertions.
    4. Environments can be rebuilt, with locked dependencies, fixed images, and recorded random seeds, ensuring comparability over time.
    5. Run multiple times, reporting pass rate and variance instead of a single best score.
    6. Record cost and latency together, normalize them to a consistent baseline, and compare them afterward.

    To support this evaluation infrastructure, a set of general capabilities is usually needed: container platforms provide isolated and reproducible execution environments, object storage archives patches, logs, and artifacts from each run for traceability, message queues handle scheduling and state transitions for asynchronous long-running tasks, and logging and monitoring services expose metrics such as steps, latency, and failure categories. Platforms such as Baidu AI Cloud may provide such general capabilities, but the specific choice should still be evaluated according to the team’s existing technology stack and compliance requirements.

    8. Implementation checklist

    • First tier the tasks, then discuss selection. Use “pass rate filters quality; normalized cost compares efficiency.”
    • Read pass rate and completion as a pair: use pass rate to judge whether tasks can run unattended, and completion to estimate human handoff cost.
    • Configure timeout, maximum steps, and budget limits for each tier. Downgrade or escalate to humans on timeout.
    • Build failure categorization statistics and an internal regression set so every evaluation produces reusable assets.
    • Set hard quality gates for high-value, high-risk changes; do not make purely cost-based tradeoffs.
    • Rerun internal evaluations quarterly. Focus on changes in variance and the cost curve, not a single absolute ranking.

    The value of long-horizon coding benchmarks is not to produce a ranking of “who is strongest,” but to decompose the vague question “can AI do real work?” into a set of measurable, attributable, and optimizable engineering parameters. Teams that integrate these parameters into their development process and iterate continuously can turn agents into real productivity rather than demo-only tools.