Evaluating LLM Coding Ability: The Real Gaps Beyond the Scores

    Coding benchmarks for large language models are often compared with a single headline number, but that practice hides the differences that matter most. This article separates coding ability into three difficulty tiers—function-level generation, repository-level bug fixing, and engineering-level long-horizon tasks—and explains why their scores cannot share one table. It examines the survivorship bias in average scores, where aborted or unfinished tasks drop out of the denominator, and introduces completion-rate-aware accounting that can reverse the ranking. It then covers the four real bottlenecks behind failures on hard tasks, two variables that benchmarks struggle to capture (per-task cost and self-hosting flexibility), and a budget-aware evaluation protocol with tiered model routing. It closes with a minimum viable approach for enterprises to build their own evaluation set and practical selection conclusions: check coverage rate, budget, and failure reasons before trusting a headline score.

    1. First, Clarify What “Coding Ability” Actually Measures

    The easiest mistake when comparing coding ability across models is to put scores from different difficulty tiers into one table and compare them side by side. In engineering practice, a model’s coding ability roughly falls into three levels:

    • Function-level generation: Given a signature, docstring, or natural-language requirement, produce a single-function implementation that matches expectations and passes unit tests. The focus is on syntactic correctness, edge-case coverage, and familiarity with common algorithmic patterns.
    • Repository-level bug fixing: Given an issue description from a real project and the full codebase, the model must locate the defect, understand the context, generate a patch, and pass hidden tests. The difficulty jumps sharply here, because the challenge shifts from “writing correct logic” to “changing the right thing in the right file at the right place.”
    • Engineering-level long-horizon tasks: Cross-file refactoring, dependency version migration, concurrency and performance debugging, build/CI failure repair. These tasks have no single correct answer; they require multiple rounds of exploration, hypothesis validation, and tool calls, and they place heavy demands on context consistency and reasoning-chain length.

    The three levels do not progress linearly—their difficulty distribution is highly discontinuous. Public evaluation systems roughly map to these three tiers: function-level unit-test datasets; repository-level datasets built from open-source project issues and patches, plus their multilingual extensions; and the task suites built into coding tools. Understanding this is the prerequisite for correctly interpreting every score that follows.

    2. The Initial Picture from Public Data

    In one three-way comparison of open-weight models against two top-tier closed-source models, the publicly available results were roughly as follows (data compiled by third-party evaluations; specific versions and compute budgets will cause variation, so treat it as a trend reference only):

    Evaluation dimension High cost-performance open-weight model (thinking mode) Top-tier closed-source commercial model A Overseas top-tier model B
    Function-level generation accuracy ~90% ~88% ~87%
    Repository-level bug-fix success rate 83.7% 87.6% Not disclosed
    Multilingual repository-level task success rate Not disclosed 64.3% 57.7%
    Coding-tool built-in task suite ~70% Not disclosed Not disclosed
    Average score across 38 multi-step tasks 8.90 8.87 Not disclosed
    Completion rate across the 38 tasks 76% (29/38) Higher Not disclosed

    A revealing contrast: the open-weight model slightly leads on function-level generation, trails by about four percentage points on repository-level fixing, and flips to a disadvantage on multilingual tasks (if the closed-source side runs that evaluation). This shows there is no single scalar ranking for “coding strength.” A model’s capability profile is dimensional, and it correlates strongly with the language distribution of its training data, code scale, and the ratio of comments and documentation.

    3. The Biggest Trap: Survivorship Bias in the Average

    The most important signal in that 38-task run was not 8.90 versus 8.87, but the completion rate. The open-weight model had the higher average, yet 9 of its tasks were cut off by timeouts—and those 9 happened to be the hardest coding and reasoning tasks.

    Statistically, this is a classic conditional-mean problem. The so-called average score is just a conditional mean over the subset of completed tasks; unfinished tasks never enter the denominator. As a result, model performance behaves like:

    1. observed average ≈ task coverage × conditional quality on completed tasks

    If you report only the second factor, a model can inflate its score simply by “avoiding hard problems.” Here is pseudocode for the correct accounting:

    1. def report_metrics(tasks, results, budget):
    2. """Completion-rate-aware scoring: aborted tasks count as 0"""
    3. scored, completed, abort_reasons = 0.0, 0, Counter()
    4. for r in results:
    5. if r.aborted: # timeout / budget exhausted / tool-call rounds maxed out
    6. abort_reasons[r.reason] += 1 # timeout | token_budget | step_limit | context_overflow
    7. continue
    8. completed += 1
    9. scored += r.score # e.g., ratio of hidden tests passed
    10. return {
    11. "coverage": completed / len(tasks),
    12. "cond_score": scored / completed if completed else 0.0,
    13. "effective": scored / len(tasks), # the score actually usable for cross-model comparison
    14. "abort_profile": dict(abort_reasons),
    15. }

    Once you count aborted tasks as 0, the ranking in the two tables flips immediately: 8.90 × 76% ≈ 6.76, while a higher-coverage option can reach above 8. Any evaluation report that does not report both coverage and the distribution of failure reasons cannot support a selection decision.

    4. Four Real Bottlenecks Behind Failures on Hard Tasks

    Context consistency decay. During cross-file refactoring, the model must keep naming conventions, interface signatures, and implicit contracts stable across tens of thousands of tokens of code. As rounds accumulate, constraints established early are easily overwritten by later generation, showing up as “fixing module A breaks module B,” or re-defining a symbol that already exists.

    Reasoning budget and premature termination. Thinking mode is usually bounded by a token budget. Hard tasks need a longer exploration chain; once the budget runs out mid-way, the output degrades into “concluding with only half the thinking done,” which looks like a capability problem but is really a budget-configuration problem.

    Stability of the tool-call loop. Engineering-level tasks rely on a closed loop of “read file → modify → run tests → read logs → modify again.” Step limits, retry strategy on failure, and command-output truncation length can all significantly change the final success rate. The same model with good tool orchestration can differ by more than ten percentage points in practice.

    Availability of verification feedback. Whether the model can actually run builds and tests in a sandbox directly determines whether it can self-correct. Without an executable environment, the model can only reason statically, and performance on nearly all long-horizon tasks drops noticeably.

    5. Two Hidden Variables That Benchmarks Struggle to Capture

    Cost is amplified in agent scenarios. A ten- to thirty-fold difference in API unit price is just a difference in the bill for single-turn Q&A; but one multi-step task can consume hundreds of thousands of tokens, so the cost difference turns into a capability difference—a higher-cost model can complete multiple rounds of exploration within budget, while a lower-cost model must converge early. In evaluation, price must be viewed through “cost per task” rather than “price per token.”

    Self-hosting is about architectural possibility. Open weights mean data stays in-domain, the model can run offline, it can be further pretrained or fine-tuned on private codebases, and versions can be pinned for reproducibility. For scenarios that are sensitive about code assets and need to connect to internal knowledge bases and private tool chains, this is a structural advantage. But self-hosting requires accounting for total cost of ownership: accelerator-card memory and throughput headroom, concurrency and queuing strategy, operations staffing, and version-upgrade and rollback mechanisms—all of which are long-term costs.

    6. A Budget-Aware Evaluation Protocol and Tiered Routing

    6.1 Reworking the Evaluation Protocol

    • Set three explicit budgets: caps on thinking/output tokens, wall-clock time, and tool-call rounds, and state them in the report.
    • Produce curves across multiple tiers: evaluate at several budget levels to get a “budget–success rate” curve. Many models are not weak in capability; they simply fall off a cliff at low budget levels.
    • Report three metrics in parallel: coverage, success rate, and cost per task. Missing any one of the three leads to misjudgment.
    • Report by difficulty bucket: split into buckets by number of files changed, whether it spans modules, and whether external dependencies are needed, so that high-scoring tasks do not mask weaknesses.
    • Report variance on small samples: when the task count is in the dozens, a two- or three-point gap is basically within the noise, so report confidence intervals or the mean and standard deviation across multiple repetitions.

    6.2 Tiered Routing: Use Cheap Models Where They Excel

    Since capability profiles are dimensional, the optimal solution is often not either/or but dispatching by difficulty:

    1. def dispatch(task):
    2. if task.single_file and task.has_signature and task.has_tests:
    3. return open_weight_model # medium-difficulty mainstream; cost and latency first
    4. if task.cross_file or task.requires_long_reasoning:
    5. return strong_model # hard tasks; accuracy first
    6. return strong_model
    7. def run_with_escalation(task):
    8. model = dispatch(task)
    9. result = execute(model, task, budget_for(model))
    10. if result.aborted or not result.tests_passed:
    11. # fallback for hard tasks: switch to a stronger model, but reuse completed retrieval and context
    12. result2 = execute(strong_model, task, budget_escalation,
    13. context=result.partial_context)
    14. return pick_better(result, result2)
    15. return result

    Routing thresholds must come from your own team’s evaluation data; copying someone else’s conclusions wholesale is the most common reason such systems fail.

    7. A Minimum Viable Approach to Building Your Own Evaluation Set

    Sample sources: before/after diffs of historical merge requests, fix records from production tickets, and CI failure-and-fix logs. The value of these three data types is that they naturally come with a “correct answer” and real context.

    Layered construction: use function-level cases to regress basic syntax ability; inject dependencies and configuration into module-level cases; require cross-file changes in repository-level cases; and add regression-level cases that additionally check “no new test failures are introduced.” The last category is often overlooked, yet it is the source of production incidents.

    Guard against data contamination: use private, unpublished samples; upgrade dependencies to versions past the training cutoff; and randomly rewrite requirement descriptions and variable names. Otherwise, evaluation results are systematically overestimated.

    Engineering support: a container platform provides reproducible build and test environments; object storage accumulates samples, patches, and run artifacts; a message queue handles task dispatch and concurrency throttling; and logging services plus monitoring alerts watch timeout rates, the distribution of tool-call rounds, and failure-reason categories so evaluation data keeps flowing back in. If an enterprise builds this pipeline on Baidu AI Cloud, the general-purpose capability categories above—elastic compute, containerized runtime, artifact storage, and observability—can cover the full set of needs without depending on any specific proprietary interface.

    Iteration rhythm: after any change to the model version, prompts, or tool orchestration, run a regression pass, compare the three metrics against a fixed sample set, and turn selection from a “subjective impression” into a “reproducible experiment.”

    8. Selection Conclusions

    • The broad mainstream of medium difficulty: the gap between top models is often within the noise range, so decisions should prioritize cost, latency, and data-compliance requirements.
    • Complex multi-file refactoring, very long reasoning chains, cross-step context retention: this is where the real dividing line lies. Check completion rate first, then average score, and finally cost per task.
    • Mainstream architectural choice: use a cost-performance model to handle the vast majority of requests, escalate hard cases, and fall back to a stronger model, with timeout-and-retry and budget control in place.
    • Do not ignore data distribution: differences in multilingual, multi-framework, and private-code-style performance may be more decision-relevant than the difference in total score.

    In one sentence: a benchmark score measures “how good a model is at the problems it is allowed to finish,” while engineering deployment cares about “how much the model can actually deliver under the budget and tools I give it.” Put coverage, budget, and failure reasons on the table, and selection turns from a leaderboard comparison into an engineering judgment.