AI Coding Benchmarks: Engineering Tradeoffs Between Task Completion, Runtime, and Cost
This article examines newly published long-horizon coding benchmark results for real-world engineering tasks. It explains why higher task completion is often accompanied by runtimes measured in hours, how runtime and cost do not scale linearly, and what statistical pitfalls can distort benchmark rankings. It also provides practical methods for evaluating agent-based coding systems, including cost per successful task, effective throughput, selection strategies, and key considerations for building an internal evaluation platform.
AI Coding Benchmarks: Engineering Tradeoffs Between Task Completion, Runtime, and Cost
Recently, the official developer organization of a major mobile operating system platform published a batch of long-horizon coding evaluation results aimed at real engineering tasks. Overall, the configurations with higher average completion tend to require several hours or even dozens of hours to complete. By contrast, a lower-cost configuration takes about 44% of the runtime of a high-completion configuration, while its cost is only about one thirty-second as much.
This article analyzes these results from four perspectives: how to interpret the metrics, where long runtime comes from, what statistical pitfalls may mislead decision-making, and how to select the right approach. It also outlines key elements of building an internal evaluation platform and includes example code to help engineering teams avoid being misled by a single leaderboard score.
1. The Evaluation Target Has Changed: From Completing a Function to Completing a Requirement
In the past, code generation capability was often evaluated using single-function completion or single-bug-fix tasks, with unit test pass rates used as the measurement. This approach is objective, fast, and repeatable, but it mainly assesses local generation ability.
Coding tools that work in the form of AI agents are different. The evaluation target has evolved into end-to-end engineering tasks. Common mobile application development scenarios include four categories:
- Application creation: Start from an empty project and build a runnable application skeleton that includes interfaces, navigation, data storage, and other modules.
- Feature development: Add new requirements to an existing codebase, understand the current architecture and code style, and complete changes spanning from the UI layer to the data layer.
- Code migration: Migrate a project from an older version or older paradigm to a newer approach, such as moving from imperative layout to declarative UI.
- Application conversion: Convert mature application logic from another platform to the target platform while maintaining functional equivalence.
These tasks are mostly long-horizon tasks, with three notable characteristics:
- Many steps and long duration: A single task may require dozens of tool calls, multiple build and debugging cycles, and can span tens of minutes to several hours.
- Complex state: The task result is not a piece of text, but a project state that can be built, run, and coordinated across multiple files.
- Expensive feedback: Each verification step may require actually running a build, installation, or test, and errors may only appear after several steps.
Because of this, such benchmarks must answer not only whether a task was completed, but also how long it took and how much it cost.
2. Four Core Metrics: What Each Metric Answers
Public long-horizon coding benchmarks usually report four metrics at the same time. Each metric corresponds to a different dimension:
| Metric | Question answered | Main use | Interpretation note |
|---|---|---|---|
| Pass rate | How many tasks are actually completed | Result quality, the most critical metric | Often determined by a small number of tasks, with high variance |
| Average completion | How far unfinished tasks progressed | Diagnostic and improvement signal | As a continuous value, it can be dominated by a few tasks and is not equivalent to pass rate |
| Average runtime | How long one evaluation round takes | Timeliness and concurrency capability | Depends on parallelism and is heavily affected by build waiting |
| Cost per run | How much one evaluation round costs | Economic feasibility and scalability | Depends on pricing and caching, and should not be directly converted into production cost |
Two points need special clarification:
- The relationship between completion and pass rate: Completion describes how far a task progressed, such as whether the project can build, whether core functionality is usable, and whether tests pass. High completion means the task is “almost done,” not “basically done.” A task is considered passed only when all acceptance criteria are met.
- The measurement basis of cost: Running cost is the total cost of completing one full benchmark round, not the unit price of a single task. Therefore, it is not suitable for direct comparison with an individual developer’s daily usage, but it is well suited for comparing the relative economics of different configurations.
3. Reading the Data: The Triangle of Results, Completion, and Cost
For technical discussion, the three newly published sample configurations below are anonymized as A, B, and C. They do not refer to any specific product or service.
| Metric | Sample A | Sample B | Sample C |
|---|---|---|---|
| Pass rate | 28.7% | 24.0% | 17.3% |
| Average completion | Not reported | 82.3% | 71.2% |
| Average runtime per round | Not reported | 27.4 hours | 12.0 hours |
| Cost per run | Not reported | About $320 | About $10 |
Sample B uses an agent framework combined with a large model. Sample C uses an agent combination based on a lightweight, fast model. Together, they show a clear tradeoff among results, completion, time, and cost.
(1) The gap between completion and pass rate reveals the real difference
Sample B has an average completion of 82.3%, meaning that tasks which failed still completed more than 80% of the work on average. Sample C has an average completion of 71.2%, about 11 percentage points lower.
Does this mean Sample C has higher completion? No. In Sample C, only a few tasks fail completely, while most failures occur in the final stages of the task. In Sample B, failed tasks are more often partially completed, moving forward one step and backward another. This difference shows that a low pass rate does not necessarily mean weak capability, and high completion does not necessarily mean the result is close to usable. The two must be interpreted together.
(2) Runtime and cost do not have a linear relationship
Sample C takes about 44% of the runtime of Sample B, but its cost per run is only about 3% of Sample B’s cost.
More importantly, if each round runs 30 tasks and the pass rate is the task-level pass proportion, Sample B costs about $44 per successful task on average, while Sample C costs about $1.9 per successful task. The difference is about 23 times, far larger than what the difference in pass rates alone would suggest.
This is caused by the combined effect of quantity and price: the cost of processing a single task is higher, and the success rate is lower. When multiplied together, the economic cost per successful result becomes much larger.
(3) The pass rate difference may not be statistically meaningful
The pass rate difference between Sample B and Sample A is 4.7 percentage points. At the scale of 30 tasks, this gap may fall within the range of statistical fluctuation, as discussed in Section 5. It should not be used alone to conclude which configuration is stronger.
(4) Speed advantages have clear boundaries
Sample C is more suitable for tasks with limited budgets, sensitive response times, and controllable failure consequences, such as boilerplate code generation, UI prototype construction, and unit test supplementation. High-risk long-horizon tasks such as core module development, complex migration, and cross-platform conversion still depend more on high-completion configurations, with human review as a safeguard.
4. Where Does Long Runtime Come From: Five Overheads of Long-Horizon Agents
Higher completion often means more reasoning and execution. An average runtime of dozens of hours is not surprising. It can be attributed to five types of overhead.
1. Multiplicative effect of inference throughput and output length
The execution time of a single task can be roughly decomposed into effective working time plus waiting time. Effective working time is mainly determined by the output length of each model turn and the model generation speed:
Effective working time ≈ Σ(output tokens per turn ÷ generation speed) + extra output from planning and rework turns
Long-horizon tasks require reading large amounts of code, writing plans, and repeatedly connecting multiple tool calls. The longer the turns and context, the more obvious this term becomes.
2. Context growth and secondary processing overhead
Long-horizon tasks need to maintain a large amount of information, including task descriptions, code search results, build logs, and historical decisions. As the context continues to grow, two types of overhead appear:
- Each turn requires processing more tokens.
- To avoid getting lost in the middle of the context, agents often need to periodically summarize and compress the context, or split it into subtasks for separate execution.
3. Hard waiting from build and test feedback
Mobile application development involves build, installation, and test stages that can take considerable time. Incremental builds may take tens of seconds, while first-time builds or dependency downloads may take several minutes. Installation and startup involving device emulators or physical devices can take even longer. This type of waiting cannot be eliminated by a faster model alone; it can only be reduced through incremental builds, caching, and parallelism.
4. Extra iterations caused by self-verification
High-completion configurations tend to follow a pattern of “implement, verify, fix, repeat.” Each self-check may uncover additional edge cases and trigger repairs. This is the main driver for moving from “roughly runnable” to “actually passing,” and it is also a major source of runtime.
5. Sunk cost of failed restarts and full retries
Average runtime is usually calculated as total runtime divided by the number of runs. If a particular run falls into an inefficient loop and only stops when it exhausts the timeout or budget limit, its runtime increases both the average runtime and the total cost.
From this, a pattern emerges: the result quality, runtime, and cost of long-horizon tasks often move in the same direction. Improving one dimension usually requires sacrificing the other two, making it difficult to optimize all three at the same time.
5. Four Statistical Pitfalls When Interpreting Benchmark Scores
1. Unstable rankings caused by small samples
When a round has only about 30 tasks, random fluctuation in pass rate can be quite large:
import mathdef wilson_interval(k, n, z=1.96):"""Return the Wilson confidence interval for the pass rate, avoiding extreme estimates under small samples."""p = k / ndenom = 1 + z * z / ncenter = (p + z * z / (2 * n)) / denomhalf = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / denomreturn center - half, center + half# 7 passes out of 30 tasks, point estimate is about 23.3%print(wilson_interval(7, 30))# The 95% confidence interval is approximately [12.2%, 39.8%], spanning nearly 28 percentage points
The gap between Sample B and Sample A in the table above may simply be random variation between different runs. Comparisons between different technical routes should preferably use paired comparisons: let each configuration face the same set of tasks, run the same number of times, and test the difference in pass or fail outcomes on the same task.
2. Averages hide distribution differences
Average completion may be dominated by a small number of tasks. For example:
- Suppose one configuration achieves nearly 100% completion on 6 tasks but gets stuck at the final step, while on the other 24 tasks its completion is only about 76%. The average completion is about 81%.
- Another configuration achieves 81% completion on all 30 tasks, but passes none of them.
The averages are similar, but the actual capability is very different. Therefore, teams should also look at the median, percentiles, failure reason distribution, and stratified results by task difficulty.
3. Different measurement bases for cost and runtime
Inference cost is linearly additive. Dividing total cost by the number of successful tasks gives a meaningful metric called cost per successful task.
Runtime is different. In parallel evaluation, wall-clock time depends on the slowest task and is not equal to the sum of all task execution times. Therefore, “runtime per successful task” should only be treated as a rough reference. If task-level timeliness matters, it is better to directly measure end-to-end latency for each task and report percentiles.
4. Leaderboard tasks may not match production distribution
Public benchmark tasks are usually curated. The number of tasks is limited, and the benchmark may not cover the team’s own codebase size, technology stack, or business constraints. A leaderboard score can answer roughly where a configuration stands, but it cannot answer whether it works well in a specific environment.
6. Turning Tradeoffs into Decisions: Cost per Successful Task and Effective Throughput
Engineering decisions should not be based only on whether the pass rate is the highest. They should start from the cost per successful result.
Let:
- N be the total number of tasks;
- p be the pass rate;
- C be the total cost of one complete run;
- T be the wall-clock time of one complete run;
- S = p × N be the number of successful tasks in one run.
If a single task can run independently and the parallelism is k, then S successful tasks can be completed in approximately S/k time slots. The required wall-clock time is approximately:
(S / k) × t
where t is the end-to-end latency of a single task.
This leads to two decision metrics:
- Cost per successful task: C / S = C / (p × N). This is the economic cost required for each successful task. It rises sharply as the pass rate decreases.
- Effective throughput: S / ((S / k) × t) = k / t. With fixed parallelism and fixed latency, this metric is independent of the pass rate.
Three implications follow:
- Pass rate determines unit price: With a fixed task set, a lower p leads to a higher cost per successful task.
- Throughput is determined by resources and single-task latency: If the budget is sufficient, increasing parallel instances and reducing single-task latency can proportionally increase delivery per unit time.
- Pass rate determines resource utilization: If p is lower, more compute is spent on failed tasks, increasing actual usage and waste.
This also explains why “high completion, long runtime, and high cost” often appear together. High completion requires more verification and repair rounds, which directly increases single-task latency and single-task cost. If parallelism stays unchanged, throughput also decreases.
However, this structure also points to an improvement direction: reducing latency without sacrificing too much pass rate is the most cost-effective optimization path.
This idea can be formalized as a constrained optimization problem:
maximize p(τ)subject to E[single-task latency] ≤ τC / S ≤ acceptable cost per successful task
where p(τ) represents the pass rate under a latency budget τ.
In practice, teams can run evaluations under different timeout and budget settings, plot the pass rate–latency–cost curve, and choose the tradeoff point acceptable to the team.
Some mature agent frameworks already provide mechanisms such as multiple reasoning strength levels, parallel subtasks, and cross-turn caching. These mechanisms reflect the same idea: concentrate compute on the parts most likely to determine task success or failure.
7. Combination Strategies for Different Scenarios
- Hybrid routing by task type: First use simple rules to estimate task difficulty. Send boilerplate generation and content drafting tasks to lower-cost configurations, and complex refactoring or cross-module migration tasks to high-completion configurations.
- Serial tiering, or relay mode: First let a lower-cost configuration complete the main implementation, then let a high-completion configuration review, repair, and verify it. If failures in the low-cost stage are concentrated in the final stages, this relay approach can significantly reduce spending in the expensive stage.
- Parallel Best-of-N: Run multiple instances of the same task in parallel and select the first successful result. This reduces wall-clock time and improves pass rate, at the cost of roughly linear cost growth.
- Engineering-side cost reduction: Provide agents with fast feedback channels such as type checking, unit tests, and build caching so that errors are exposed earlier. This is often more effective than simply switching to a faster model.
8. Key Elements of Building a Long-Horizon Coding Evaluation Platform
Relying on public leaderboards tends to create a passive “watch the score” mentality. Mature teams should build their own evaluation platform. Its core can be summarized in six points:
- Task set design: Organize tasks into four layers—application creation, feature development, code migration, and application conversion. Each layer should cover different complexity levels and align with the team’s real requirement distribution. Each task should have automatically verifiable acceptance criteria.
- Environment isolation and reproducibility: Execute each task in an independent container, fix dependency versions, use base image caching to reduce build time, and ensure every run starts from the same state.
- Execution control: Set wall-clock timeouts, iteration limits, and budget caps. Record model calls, tool calls, and build logs for each round to support later root-cause analysis.
- Automated scoring: Use build success, critical test passage, and acceptance script passage as pass criteria. Use process signals such as linting, static checks, and runtime behavior checks to calculate completion, while minimizing subjective judgment.
- Statistical standards: Repeat each configuration at least 3 to 5 times. Report mean, standard deviation, and confidence intervals. For cross-configuration comparisons, prioritize paired comparisons.
- Security and compliance: Task repositories and dependencies should come from controlled environments. Build network access should follow the principle of least privilege. Be cautious about external content in repository documentation and code comments to prevent malicious content from inducing the agent to perform unauthorized operations.
The following example code shows execution and metric calculation:
import statisticsimport timefrom collections import Counterfrom dataclasses import dataclassfrom typing import Callable@dataclassclass TaskResult:passed: boolcompleteness: float # Completion score between 0 and 1seconds: float # End-to-end latency for a single taskcost_usd: float # Inference cost for a single taskstage: str # Stage where failure occurreddef run_task(task, agent, timeout_s: int) -> TaskResult:workspace = prepare_workspace(task) # Create a clean isolated environmentstart = time.monotonic()result = agent.run(task.prompt, workspace,timeout_s=timeout_s) # Runtime enforces timeout and budget limitselapsed = time.monotonic() - startpassed, completeness, stage = task.verify(workspace)# passed: whether the task passed; completeness: completion score; stage: failure stagereturn TaskResult(passed, completeness, elapsed,result.cost_usd, stage)def aggregate(results: list[TaskResult], wall_clock_s: float,parallel: int = 1) -> dict:n = len(results)passed = sum(r.passed for r in results)return {"pass_rate": passed / n,"avg_completeness": statistics.mean(r.completeness for r in results),"cost_per_pass": sum(r.cost_usd for r in results) / max(passed, 1),"p50_latency": statistics.median(r.seconds for r in results),"p90_latency": sorted(r.seconds for r in results)[int(n * 0.9) - 1],"throughput": passed / (wall_clock_s / 3600), # Successful tasks per hour"cost_per_hour_pass": sum(r.cost_usd for r in results)/ max(passed / (wall_clock_s / 3600), 1e-9),"fail_stage_dist": dict(Counter(r.stage for r in results if not r.passed)),}def select(metrics_list: list[dict], alpha: float = 1.0) -> dict:"""Minimize combined cost: a larger alpha favors lower latency."""best = min(metrics_list,key=lambda m: m["cost_per_pass"] + alpha * m["p50_latency"],)return best
After collecting enough samples of “different parameter configurations plus corresponding metrics,” teams can:
- Plot an efficiency frontier with pass rate on the vertical axis and latency or cost on the horizontal axis.
- Fit an approximate relationship such as p ≈ p_max × exp(−τ/τ0), where τ0 is the latency characteristic scale.
- Estimate the relative pass rate loss when latency is reduced by a factor of 1/e.
The “knee point” on this curve, where marginal benefit begins to decline significantly, is often the engineering sweet spot.
Cloud elastic resources can also be useful here. During peak periods, parallel evaluations can start compute instances on demand in container platforms and release them after completion. Task artifacts, build logs, and evaluation reports can be stored centrally in object storage and logging services for later review. With monitoring and alerting, teams can set thresholds for key indicators such as timeout rate and cost per successful task.
9. Common Misconceptions and Conclusion
Based on the analysis above, four common misconceptions can be identified:
- Pass-rate-only thinking: Looking only at pass rate while ignoring cost and latency. With a fixed task set, every small drop in pass rate can significantly increase the cost per successful task.
- Completion-only thinking: Treating high average completion as “almost done,” while ignoring that failed tasks are often stuck at the final step.
- Leaderboard-only thinking: Treating public benchmark scores as expected production performance, while ignoring task distribution and statistical fluctuation.
- Model-only thinking: Believing that replacing a model with a stronger one solves everything, while ignoring engineering factors such as build feedback, task decomposition, and parallel scheduling.
Combining the data and analysis above, three conclusions can be drawn:
- There is no universally superior configuration; there are only configurations matched to specific scenarios. Results, completion, time, and cost constrain each other, and tradeoffs are the norm.
- Cost per successful task and effective throughput are more business-relevant than pass rate alone. Pass rate determines the cost per successful result, while parallelism and single-task latency determine delivery speed.
- Selection should be based on your own data. Teams should build layered task sets and automated evaluation platforms, find the tradeoff point that suits them on the pass rate–latency–cost curve, and continuously improve output per unit of compute through hybrid routing, parallel Best-of-N, and engineering feedback mechanisms.
