AI Coding Benchmarks: Pass Rate, Cost, and Latency Explained
Long-horizon coding tasks—where an AI agent plans, edits files, runs builds, and iterates over hours—have become a focal point for evaluating coding agents. This article examines which metrics matter, how pass rate, latency, and cost must be read together, and how organizations can build a trustworthy, reproducible evaluation system. Drawing on public benchmark data (a new version reaching a 24.0% pass rate versus 12.0% for its predecessor, with per-run latency dropping from 66.2 to 27.4 hours and cost from $418.3 to $317.4), it explains derived metrics such as cost per successful task, pass@k, confidence intervals, and Pareto frontiers, along with the engineering practices—sandboxing, trajectory logging, budget limits, and task-set governance—needed for credible results.
1. Background: Why Long-Horizon Coding Tasks Took Center Stage
Early benchmarks of code intelligence mostly focused on function-level completion, single-file generation, or standalone algorithm problems. These tasks had short context and clear acceptance criteria, and a single inference pass often produced a result. As large language models evolved from “code completion tools” into coding agents that can plan autonomously, call tools, and iterate over multiple rounds, the evaluation target changed accordingly: the industry began handing agents tasks from real repositories—fixing a bug, implementing a feature, or refactoring a module—and letting them read code, retrieve context, modify files, run builds and tests, and keep correcting failures until acceptance conditions were met. The whole process can last hours or even longer.
The industry generally refers to tasks that require long autonomous progress and rely on multi-step decision-making and state management as “long-horizon tasks.” A public benchmark for a mobile app development ecosystem recently added a new model version. The data show a strict pass rate of 24.0% for the new version, an average task completion of 82.3%, and a sixth-place ranking on the long-horizon leaderboard; the previous generation had a 12.0% pass rate, so the new version is exactly double. Average per-run time dropped from 66.2 hours to 27.4 hours, and average cost dropped from $418.3 to $317.4. On the same leaderboard, a low-cost option had a pass rate of 17.3%, an average per-run time of only 12.0 hours, a cost of just $9.9, and ranked ninth; the top option had a pass rate of 40.0%. Another mainstream model ranked fifth on this leaderboard.
Behind these numbers is an easily overlooked fact: this kind of evaluation is itself a heavy compute task. A single complete run is a large-scale automated experiment lasting tens of hours and costing hundreds of dollars. Whether the methodology is sound directly determines whether the conclusions can guide technology selection and engineering decisions. This article does not target any specific product. Instead, it addresses three questions: which metrics should this kind of evaluation track? How should pass rate, latency, and cost be read together? And how can organizations build a trustworthy, reproducible, and continually evolving evaluation system?
2. Three Essential Characteristics of Long-Horizon Coding Tasks
Before understanding the metrics, it helps to distinguish long-horizon tasks from single-pass generation. They have three essential characteristics.
- State accumulation: Every action the agent takes changes the state of the codebase and enters subsequent context. Early mistakes do not disappear automatically as rounds increase; instead, they propagate and amplify, so “does it pass at the end” is a comprehensive test of quality across the whole process.
- Long processes: A single task may involve dozens of tool calls and hundreds or thousands of inference rounds. Any delay anywhere along the execution chain adds to the final elapsed time.
- High resource cost: Cost combines model inference fees and sandbox compute fees. If the task set contains hundreds of tasks, one evaluation round can already influence the technology-selection pace of a small or mid-sized team.
In addition, acceptance of long-horizon tasks depends on automated builds and tests, and results are affected by factors such as environment configuration, dependency versions, and test-case quality. This means variation in results may come from the object under test or from the evaluation itself, so environment control and statistical methods gain importance.
3. A Metric System: Four Dimensions and Derived Metrics
A reasonable metric system should cover four dimensions.
| Dimension | Metric | Focus |
|---|---|---|
| Capability | Task pass rate | End-to-end delivery quality |
| Quality | Average task completion | Partial progress toward success |
| Efficiency | Average per-run time | Efficiency of task decomposition, tool calls, and long-context handling |
| Economics | Average per-run cost | Barrier to commercial adoption |
Derived metrics matter just as much:
- First-pass rate and pass@k: The former measures one-shot delivery ability; the latter measures the achievable ceiling under multiple attempts. The gap between them reflects the “solvable difficulty” of tasks and the stability of results.
- Cost per successful task: The ratio of average cost to pass rate—the average spend needed to produce each successful task. It reflects actual investment better than pass rate alone.
- Average interaction steps and failed retries: A side view of planning and error-correction ability.
- Trajectory conformance: Whether dangerous behaviors such as infinite loops, out-of-scope operations, or repository destruction occur.
3.1 Pass Rate: Strict but Potentially Distorting
Pass rate is usually defined as “the number of tasks that pass all acceptance tests ÷ total number of tasks,” and it best represents what can be “delivered directly.” But it has two limitations:
- Binary judgment loses process information: A task that reaches 90% completion but fails is entirely equivalent to one at 10% completion under pass rate.
- Variation amplifies with scale: With a 100-task evaluation set, 12.0% corresponds to 12 successful tasks and 24.0% to 24. Any small change in the number of successful tasks makes the pass rate jump in percentage points.
3.2 Completion: Filling the Information Loss of Binary Judgment
Completion is usually calculated as “the proportion of passed acceptance items among all acceptance items,” and can also be scored by weighting sub-goals by importance. It captures partial progress toward success—for example, the code has been correctly modified and unit tests pass, but integration tests or compatibility checks still fail.
Take the new version as an example: its pass rate is only 24.0%, yet its completion reaches 82.3%, meaning nearly 60% of failed tasks actually completed most of the work. This shows that the bottleneck often concentrates in the last few critical steps, such as device-specific adaptation, edge-case handling, or performance constraints. For R&D teams, this information is more valuable than an isolated pass rate.
3.3 Latency: Sensitive to Both Cost and Experience
Latency directly affects sandbox compute fees and also determines how responsive the agent is in interactive development. A task taking tens of hours is only suitable for offline batch processing and is hard to fit into a developer’s daily coding workflow. Common directions for latency optimization include parallelizing independent sub-tasks, trimming tool return content, terminating unproductive exploration promptly, and compressing historical context.
3.4 Cost: From “Can It Be Used” to “Can We Afford It”
Cost typically combines model inference fees and sandbox running fees. Inference fees relate directly to the number of input, output, and cache-hit tokens. Mobile app builds, multi-round test execution, and simulator or physical-device verification also add extra compute overhead.
Comparing a low-cost option: its pass rate of 17.3% is only 6.7 percentage points lower than the new version, yet its cost is only about 3% of the latter, and its per-run time is more than half shorter. If you compare pass rates alone, “doubling” seems a decisive advantage; once cost is factored in, the conclusion becomes more nuanced.
4. Interpreting “Doubling the Pass Rate”: Derived Metrics and the Pareto Frontier
Based on public comparison data, we can calculate the change in key derived metrics between the two new versions (see Table 2).
| Metric | Previous Generation | New Version | Change |
|---|---|---|---|
| Task pass rate | 12.0% | 24.0% | +12.0 percentage points, 2x |
| Average task completion | Not disclosed | 82.3% | — |
| Average per-run time | 66.2 hours | 27.4 hours | About 59% shorter |
| Average per-run cost | $418.3 | $317.4 | About 24% lower |
| Cost per successful task (estimated) | ~$3,486 | ~$1,322 | About 62% lower |
| Time per successful task (estimated) | ~552 hours | ~114 hours | About 79% shorter |
Note: the last two rows are estimates by this article based on public data.
Three conclusions follow:
- “Doubling” is relative, not absolute. The previous generation’s 12.0% is a low base, and the new version still hasn’t broken a quarter, showing that long-horizon tasks remain largely unsolved. The new version’s 24.0% pass rate is also below the fifth-ranked option and 16 percentage points behind the 40.0% leader. Teams with hard requirements on long-horizon capability should judge based on task types and not make selection decisions on generational multiples alone.
- Capability gains have a compounding effect. Viewed as a static version iteration, doubling the pass rate is already remarkable. But the simultaneous reduction in latency and cost brings cost per successful task down to about 38% of before and time per successful task to about 21%. Shorter latency also means more iterations and retries can complete in the same time, forming a positive loop of “capability up → unit cost down → faster evaluation and R&D iteration.”
- Ranking is not cost-effectiveness. For scenarios with lower task complexity, sensitive budgets, and an emphasis on fast feedback, the low-cost option trades a tiny capability gap for an order-of-magnitude cost advantage. A more reasonable approach is to build the Pareto frontier of candidate options (Figure 1)—that is, on two-dimensional planes such as “pass rate–cost” and “pass rate–latency,” keep only candidates not simultaneously beaten by any other option.
Pass rate^ ● Leader 40.0%| ● New version 24.0% (cost $317.4)| ● Low-cost option 17.3% (cost $9.9)| ● Previous generation 12.0% (cost $418.3, fully dominated by new version)+------------------------------------------------> Average per-run costPareto frontier: low-cost option → new version → leader
On the “pass rate–cost” plane, the low-cost option, new version, and leader all lie on the frontier and suit users with different budgets and quality requirements. The previous generation has both higher cost and lower pass rate, fully dominated by the new version, so it is no longer a recommended option. Faced with multiple options on the frontier, organizations can combine task-difficulty distribution and budget constraints and choose through marginal-benefit analysis:
- Marginal pass-rate gain = (pass rate B − pass rate A) ÷ (cost B − cost A)
- Marginal change in cost per successful task = cost per successful task B ÷ cost per successful task A − 1
Take the low-cost option and the new version: their gap in average pass rate is 24.0% − 17.3% = 6.7 percentage points. But those extra passes come at the cost of about 32x the average cost and about 23x the cost per successful task. Whether this trade-off is worthwhile depends on whether tasks can tolerate failure and the cost of that failure.
5. Quantifying the Metrics: Formulas, Example Code, and Statistical Significance
5.1 Metric Calculation Example
The following code shows how to compute each metric from per-task records:
from statistics import meandef evaluate(records):"""records: one record per task{"passed": bool, # whether all acceptance tests passed"score": float, # task completion, in the range 0~1"hours": float, # actual time for this task (hours)"cost": float, # actual cost for this task (USD)}"""n = len(records)avg_hours = mean(r["hours"] for r in records)avg_cost = mean(r["cost"] for r in records)pass_rate = sum(r["passed"] for r in records) / nreturn {"pass_rate": pass_rate,"avg_score": mean(r["score"] for r in records),"avg_hours": avg_hours,"avg_cost": avg_cost,# average time and cost per successful task produced"hours_per_pass": avg_hours / pass_rate if pass_rate else float("inf"),"cost_per_pass": avg_cost / pass_rate if pass_rate else float("inf"),}
Note that if per-task time varies greatly—for example, a simple bug fix takes a few minutes while complex feature development takes hours—you should also report the median and percentiles of both time and cost, to avoid averages hiding the real cost of long-tail tasks.
5.2 Pass@k
If the same task allows k independent attempts, the unbiased estimate of pass@k is:
Pass@k = 1 − C(n − c, k) / C(n, k)
where n is the number of samples, c is the number of successes, and C(·,·) is the binomial coefficient. If there are many tasks and per-task sampling is too costly, you can also use the success ratio over n samples as an approximate estimate.
5.3 Confidence Intervals and Significance Testing
The following code uses a Wilson interval to estimate the 95% confidence range for the true pass rate:
import mathdef wilson_interval(success, total, z=1.96):"""For 95% confidence, z ≈ 1.96"""p = success / totaldenom = 1 + z * z / totalcenter = (p + z * z / (2 * total)) / denomhalf = z * math.sqrt(p * (1 - p) / total + z * z / (4 * total * total)) / denomreturn round(center - half, 4), round(center + half, 4)# Example: 24 out of 100 tasks passprint(wilson_interval(24, 100)) # about (0.1664, 0.3335)
Plugging in the public data:
- A 24.0% pass rate over 100 tasks has a 95% confidence interval of about [16.6%, 33.4%].
- A 12.0% pass rate at the same scale has a 95% confidence interval of about [6.8%, 20.0%].
The two intervals overlap only slightly, but the lower bound of the new version’s estimate is still below the previous generation’s point estimate. This shows that if the evaluation has fewer than 100 tasks, the statistical strength of the “doubling” conclusion weakens further.
Therefore, an evaluation report should at minimum state the task-set size, the number of repeated samples, and the confidence interval, and, when conditions allow, use a paired design—running different versions of the same model on the same task, same initial state, and same resource quota—to eliminate noise from task-difficulty differences.
6. Engineering the Evaluation Environment: Reproducibility Is the Prerequisite for Trust
No matter how refined the metrics, if the evaluation environment itself is uncontrolled, the conclusions cannot stand. Engineering implementation should focus on five points.
- Sandbox isolation: Each task runs in an independent container with a fixed base image and dependency versions. The sandbox should restrict network access to avoid the object under test directly obtaining answers or pulling in uncontrolled dependencies. Set limits on CPU, memory, disk, and execution time to prevent a task from falling into an infinite loop and dragging down the entire batch.
- Dangerous-operation interception: Intercept or require secondary confirmation for high-risk commands such as deleting the repository, force-pushing, modifying system configuration, or accessing credentials. Agent trajectories may also include behaviors like faking test results or skipping tests on their own. Detect these by mandatorily writing an audit report and re-running tests on mutated code.
- Full trajectory recording: Record each step’s input context, model output, tool calls, command execution results, time, and token consumption. This is both the basis for failure attribution and the foundation for fine-grained cost accounting.
- Idempotent scheduling and elastic resources: Distribute tasks via a message queue, combine with the container platform’s elastic scaling to stay stable under large-scale concurrency, and set a budget cap for each task.
- Data isolation and archival: Write evaluation logs, trajectories, and artifacts to object storage, isolated from production data. Set retention periods to meet audit and traceability needs.
The following code shows a minimal task-execution framework with timeout, budget, and repeated-command detection:
import hashlibdef run_task(task, agent, sandbox, budget, max_steps=100):sandbox.reset(task.image) # load fixed image to ensure consistent initial statehistory = []fingerprint = None # used to detect "spinning in place" loopsrepeats = 0for step in range(max_steps):if budget.elapsed() >= task.timeout or budget.spent() >= budget.cap:return {"status": "timeout_or_over_budget", "steps": step, "history": history}action = agent.step(task.prompt, history) # plan the next actionif not sandbox.is_allowed(action):history.append({"action": action, "result": "blocked_by_policy"})continuecur = hashlib.sha256(action.serialize().encode()).hexdigest()repeats = repeats + 1 if cur == fingerprint else 0if repeats >= 3: # terminate early on repeated identical actionsreturn {"status": "stuck_in_loop", "steps": step, "history": history}result = sandbox.exec(action) # execute command or modify filesbudget.add(result.duration, result.tokens, result.compute_cost)history.append({"action": action, "result": result.summary()})fingerprint = curreturn {"status": sandbox.run_acceptance_tests(), "steps": max_steps, "history": history}
On the cloud, these execution and scheduling steps can be built with general-purpose product categories such as container platforms, message queues, object storage, logging services, and monitoring and alerting. Baidu AI Cloud’s related products can provide these baseline capabilities, helping teams build an evaluation pipeline at a relatively low infrastructure cost.
7. Task-Set Construction and Evaluation Governance
7.1 Task-Set Design
- Real-first: Prioritize tasks drawn from historical bugs, feature requests, or code-review comments in real repositories, and retain the original test cases as acceptance criteria to ensure authenticity and a difficulty gradient.
- Difficulty stratification: Stratify and sample by dimensions such as number of files changed, context length, and whether multiple modules are involved, and compute pass rates per stratum to avoid distortion from an imbalanced difficulty distribution.
- Versioning: Put task descriptions, acceptance scripts, base images, and dependency versions under version control so that results from different times and different teams can be compared horizontally.
7.2 Guarding Against Data Contamination
A common hidden danger in model evaluation is “test-set leakage”: if a task and its solution already appear in the model’s training data, results will be systematically inflated. Common mitigations include:
- Use tasks generated after the model’s training cutoff;
- Keep some private tasks undisclosed;
- Periodically check whether task descriptions can be found together with answers through public channels;
- Watch for abnormal discontinuities when the same task performs differently across times and models.
7.3 Evaluation Pipeline
A minimal usable pipeline can be abstracted as:
Task set (versioned)→ scheduling and distribution→ sandbox execution (isolation / limits / security policy)→ acceptance tests (build / unit / integration / static checks)→ metric calculation (pass rate / completion / latency / cost)→ dashboards and gates
- Pipeline scheduling: Can be built on an open-source CI platform.
- Metric dashboards: Can use logging services and monitoring and alerting to track trends and alert on anomalies in pass rate, latency, cost, and failure rate.
- Quality gates: Set key metrics that a new version must pass as release conditions, e.g., “pass rate not below baseline,” “no high-risk operations,” “cost per successful task not above budget.”
7.4 Cost Budgeting and Tiered Scheduling
In practice, you don’t need to use the most capable option for every task. A “difficulty-tiered, cost-controlled” approach works:
- Use a low-cost option for higher-determinism tasks such as syntax fixes, simple refactoring, and unit-test writing;
- For failed or high-complexity tasks, automatically escalate to a more capable option and retry;
- For high-impact changes, add multiple rounds of independent review and full regression testing.
Because coding tasks are inherently stochastic, it’s recommended to run each task independently at least 3 to 5 times and take the pass ratio as the final score, to reduce the impact of chance in a single run.
8. Common Pitfalls and Recommendations
- Pitfall 1: Looking only at pass rate. Fix: report pass rate, completion, latency, and cost together, with confidence intervals.
- Pitfall 2: Representing overall capability with a single run. Fix: fix random seeds and record the number of samples; compare versions under paired conditions.
- Pitfall 3: Keeping the task set unchanged for a long time. Fix: regularly add new tasks, retire outdated ones, and continuously check for data contamination.
- Pitfall 4: Ignoring non-functional risks. Fix: bring dangerous-operation interception rate, out-of-scope access, and tampered test cases into the evaluation scope.
9. Conclusion
Evaluating long-horizon coding tasks has evolved from “just running a score” into a systems-engineering discipline spanning metric design, statistical inference, sandbox engineering, and cost governance. A single pass rate cannot fully reflect an agent’s true level. Only by placing pass rate, completion, latency, and cost in the same coordinate system—using tools such as cost per successful task, the Pareto frontier, and confidence intervals—can you reach reliable, actionable conclusions.
For organizations, rather than chasing leaderboard rankings, it’s better to build an internal evaluation system tailored to your own codebase and R&D workflow, and drive model selection and toolchain optimization with continuous, reproducible data. In the end, the goal of evaluation isn’t the score, but making AI coding capability truly fit into the R&D process and deliver value in a stable, efficient, and controllable way.
