Long-Horizon Coding Benchmarks: How to Read Pass Rates and Cost Tradeoffs
This article explains how to interpret long-horizon coding benchmarks—evaluations where AI agents complete real, multi-file engineering tasks rather than isolated algorithm problems. It breaks down the four core metrics that leaderboards report (pass rate, average completion degree, average wall-clock time, and cost per run), then derives the ratios that actually matter for tool selection, such as cost per passed task. It explains why high completion often comes with long runtimes and high cost, offers decision rules for different scenarios, and walks through building a trustworthy in-house benchmark with a task set, environment isolation, budget guardrails, repeated runs, and blind acceptance. It closes with engineering practices for integrating coding agents safely and four common ways these benchmarks get misread.
1. Why Long-Horizon Task Benchmarks Matter More Than General Coding Problems
A recent update to an AI coding benchmark for a mobile-app development scenario drew a batch of models competing in agent form, each with public scores. The results themselves aren’t the main point. What deserves a developer’s attention is the evaluation method: the competing models don’t solve an isolated algorithm problem—they complete real engineering tasks from scratch in an isolated environment, such as creating an app, building features, migrating code, and porting across platforms. The agents are allowed to read and write files, run build commands, execute tests, observe errors, and iteratively fix them on their own.
Long-horizon benchmarks differ fundamentally from traditional code-completion evaluations (single-function generation, unit-test-driven first-pass rates, and so on):
| Dimension | Traditional code generation eval | Long-horizon engineering benchmark |
|---|---|---|
| Task granularity | Single function / single file | Complete project across multiple modules and files |
| Interaction rounds | 1 to a few rounds | Dozens to hundreds of tool calls |
| Context | Provided in the prompt | Must explore the repo and build a dependency graph yourself |
| Success criterion | Whether test cases pass | Whether the app builds and its features are accepted |
| Main bottleneck | Syntax and algorithmic correctness | Planning, tool use, error recovery, context management |
The value of long-horizon benchmarks is that they approximate a simple question: “Hand a requirement to a junior engineer—how far can they get without intervention?” On today’s public leaderboards, the pass rate for long-horizon tasks is generally low. Even the top-ranked solutions fall far short of being able to run unattended. That number is itself the most important engineering signal.
2. Four Core Metrics: Definitions, Distractors, and Derived Metrics
Leaderboards typically report four metrics at once, and they answer entirely different questions.
1. Pass Rate
The share of tasks in a given set (say, 30 long-horizon tasks) that fully meet the acceptance criteria. It’s a binary acceptance metric: an app that compiles but is missing features, or fails acceptance cases, counts as a fail. Pass rate measures “can it be delivered,” which is why it tracks business value more closely than any process metric.
2. Average Completion Degree
A continuous score for tasks that don’t fully pass, based on implementation progress (for example, “UI done, data layer missing” = 70%). It measures “how far it got.” Note that completion degree is a soft metric produced by the scoring model; different evaluators may score the same state on different scales, so confirm that definitions match before comparing across leaderboards.
3. Average Wall-Clock Time
The full wall-clock time from task start to when the agent stops, including thinking, tool calls, builds, tests, and failed retries. It’s the direct source of engineering-process blocking time: a task measured in “tens of hours” can’t go into a normal CI pipeline—it can only sit in a nightly batch job.
4. Cost per Run
The model-invocation cost of running the full task set. Cost = Σ(input tokens × price + output tokens × price) + retries and wasted calls. Long-horizon tasks have a counterintuitive cost structure: input tokens usually dominate the bill, because every round re-carries the system prompt, tool definitions, and conversation history, and failed retries add duplicate-prefix overhead.
Derived metrics (leaderboards often don’t give these, but you must compute them when choosing):
Average cost per task = cost per run / number of tasksCost per passed task = cost per run / number of passed tasks ← most decision-relevantThroughput per unit time = 1 / average wall-clock timeCost-effectiveness ratio = pass rate / cost per run
“Cost per passed task” exposes a fact that leaderboard summaries hide: a solution with a slightly lower pass rate but a cost an order of magnitude lower may actually have a better effective cost per task—especially when failed tasks only need a human to finish them off.
3. What “High Completion + Long Duration” Actually Reveals About Engineering Tradeoffs
The combination most easily misread on a leaderboard is high average completion degree paired with long runtime and high cost. On the surface it looks like “low efficiency,” but it’s actually an inevitable behavioral trait of agents on long-horizon tasks, and it comes down to three layers of tradeoff.
Layer 1: Exploration depth trades for success rate, with diminishing returns.
When facing an unfamiliar repo, an agent typically explores the structure first (listing directories, reading configs, inferring the build system), then implements, then enters a “build–test–fix” loop. Runtime correlates with completion degree because more iterations raise the probability of hitting the right solution—but iterations relate to success logarithmically, not linearly. The first 20% of exploration may capture most of the gains, while the last 30% of the time often buys only marginal improvement. Long runtime is both a sign of capability and the price of “no early-stopping strategy.”
Layer 2: Failures usually aren’t in implementation, but in the finishing stage.
The most common failure mode on long-horizon tasks isn’t “can’t write the code,” but rather: missing dependency declarations that break the build, generated test assertions that don’t match real behavior, migrations that omit resource files and permission declarations, and acceptance cases covering branches the agent never touched. These tasks show the classic shape of high completion with zero pass rate—completion rewards “looks done,” while pass rate only credits “actually runs.” That gap is exactly where human intervention has the highest payoff.
Layer 3: The impossible triangle of capability, latency, and cost.
Given the same task set, raising completion almost inevitably means more reasoning rounds, a larger context, and stronger planning and self-check mechanisms—which necessarily pushes up runtime and cost. Conversely, solutions chasing low cost and low latency (say, a lightweight model with a minimal toolchain) usually give ground on pass rate. There’s no engineering choice that’s simultaneously best on all three; there’s only the choice that matches your team’s constraints.
Decision rules you can apply directly:
- Nightly batch migration / long-cycle refactoring: Tasks can queue and run unattended, so prioritize pass rate and completion, cap cost against a “per-night budget,” and treat runtime as a soft constraint.
- Interactive daily coding: Runtime drives the experience, so favor solutions with fast first-token response, streaming output, and incremental editing; long-horizon benchmark scores are only a reference here.
- Cost-sensitive teams and education: Prioritize “cost per passed task,” and accept a collaboration model of “model does 70%, humans finish the last 30%.”
- Strong compliance / private code: Your model options are constrained by deployment form, so re-weigh the value of a self-built eval set and internal knowledge base rather than relying on public leaderboard rank.
4. How to Build Your Own Trustworthy Comparison
The participating configurations on public leaderboards (agent framework, toolset, budget caps) often differ, and differences in the agent scaffold frequently exceed differences in the model itself. For conclusions to hold for your team, you must build your own eval set. A minimum viable approach has five parts:
- Task set: Pull 15–30 real tasks from your own repo’s issues, covering “new feature / bug fix / dependency upgrade / platform migration,” and pin down an automatically executable acceptance command for each.
- Environment isolation: Run each task in a separate container or working copy to avoid state contamination; control network egress and lock dependency versions.
- Budget and timeout guardrails: Set three limits—max rounds, max tokens, max wall-clock time—to prevent runaway spend.
- Multiple repetitions: Repeat each task 3–5 times and report mean and variance. Single runs on long-horizon tasks have high variance; one score isn’t enough to support a conclusion.
- Blind evaluation and anti-contamination: Acceptance is done by script, not model self-assessment; the task set never enters the model’s training or prompt context.
The aggregation script can be simple:
from dataclasses import dataclassimport statistics@dataclassclass Run:task_id: strpassed: bool # Judged by the acceptance script, not self-reported by the modelcompletion: float # 0.0 ~ 1.0seconds: floatusd: floatdef report(runs: list[Run], n_repeats: int) -> dict:n_tasks = len({r.task_id for r in runs})passed = sum(r.passed for r in runs)return {"pass_rate": round(passed / len(runs), 4),"avg_completion": round(statistics.mean(r.completion for r in runs), 4),"avg_hours": round(statistics.mean(r.seconds for r in runs) / 3600, 2),"p90_hours": round(sorted(r.seconds for r in runs)[int(len(runs) * 0.9)] / 3600, 2),"cost_per_run": round(sum(r.usd for r in runs), 2),"cost_per_pass": round(sum(r.usd for r in runs) / max(passed, 1), 2),"pass_rate_std": round(statistics.pstdev([sum(x.passed for x in runs if x.task_id == t) / n_repeatsfor t in {r.task_id for r in runs}]), 4),}
At the config layer, make the budget guardrails explicit so that cost and runtime become auditable parameters rather than after-the-fact surprises:
agent:max_steps: 120 # Tool call round limitcontext_strategy: rolling_summary # Context compression strategyharness:timeout_seconds: 14400retries: 1 # Failure retries; note cost doublessandbox: container # Isolate from the local environmentbudget:max_tokens_per_task: 2_000_000max_usd_per_task: 5.0acceptance:- command: "./gradlew assembleDebug"- command: "./gradlew testDebugUnitTest"artifacts:keep_logs: true # Keep traces for failure-attribution analysis
5. Five Engineering Practices for Integrating Coding Agents into Your Workflow
Scores are only the starting point of tool selection. What really determines the payoff is how you integrate the tool.
1. Context engineering before switching models.
Most long-horizon failures trace back to “a key constraint never made it into the context.” Baking coding standards, directory conventions, a dependency allowlist, and acceptance commands into in-repo documentation and automated checks usually delivers steadier gains than swapping models.
2. Hard budget guardrails.
At the gateway layer, cap tokens and spend per session, and automatically trip the breaker on abnormally long sessions while preserving the trace. Guardrails must act on the calling side, not rely on the model’s self-discipline.
3. Least privilege and sandboxed execution.
Generated code goes only into an isolated working copy; builds and tests run in containers; production credentials, release permissions, and secrets stay out of anything the agent can reach. Human review remains a mandatory gate before merging to the main branch.
4. Full-chain observability.
Collect at least four kinds of data: per-task success rate, runtime distribution (P50/P90), token and cost breakdown, and failure-attribution categories. On Baidu AI Cloud, these can be assembled from general-purpose capabilities such as model inference services, logging, monitoring and alerting, and object storage, forming a traceable evaluation loop.
5. Divide human–machine labor by the “completion–acceptance” gap.
Since failures cluster at the finishing stage, place human effort precisely at acceptance and repair: let the agent produce patch drafts and verification scripts, and have humans make the correctness judgment and merge decision. This division turns a “high completion, low pass rate” solution into real capacity.
6. Four Common Misreadings
- Misreading 1: A low pass rate means the model can’t code. A long-horizon pass rate is a strict metric for “runs through on the first try without intervention,” which isn’t equivalent to real coding ability.
- Misreading 2: High completion means the task is nearly done. Completion is a process score; build failures in the finishing stage and mismatched acceptance can leave it badly detached from the actual delivery state.
- Misreading 3: Short runtime means high efficiency. Short runtime may come from less exploration and shallower iteration—or from early stopping. It must be read together with pass rate.
- Misreading 4: One score run settles it. Long-horizon tasks have high variance; any change in configuration, toolchain, or budget caps can reorder the rankings. Conclusions should rest on repeated runs with fixed guardrails.
7. Conclusion
The real point of these long-horizon coding benchmarks isn’t to hand out a model ranking. It’s to move the evaluation of AI coding ability from “can it write a correct snippet” to “can it make an explainable engineering tradeoff among budget, latency, and success rate.” For a team, the right approach is: first build a small eval set from your own repo and acceptance criteria, compute “cost per passed task” and P90 runtime, then select tools separately for nightly batch jobs, interactive coding, and cost-sensitive scenarios; and use sandboxes, least privilege, budget guardrails, and an observability system to keep the risks caged. Leaderboards will keep updating, but once the method is in place, it can be reused continuously.
