Evaluating LLM Coding Ability: How to Interpret the Gap Between Open and Closed Models
This article explains how to assess LLM coding ability without over-relying on leaderboard scores. It covers common evaluation dimensions, five pitfalls in interpreting rankings, a minimal in-house evaluation workflow with isolation and metrics, pass@k estimation, and a three-step framework for model selection.
1. Background: Coding Ability Is Becoming a Dividing Line for Model Capability
Recently, there has been extensive discussion about the pace of large language model development. Some people see a period without new releases and conclude that progress has stalled. Others quickly conclude after a new model launch that the industry landscape has been rewritten. Both judgments are easy to distort because they rely on personal impressions and lack reproducible measurement methods.
Code generation and code modification are among the tasks that best reflect the engineering value of models. Unlike open-ended question answering, the inputs and outputs of coding tasks can be checked by programs: whether the code compiles, whether tests pass, and whether the target behavior is achieved. This verifiability makes coding ability a core metric for measuring the practical usefulness of a model.
Developers usually care about the following questions:
- Can the model understand the structure of a real repository, rather than only handling a single code snippet?
- Can the model locate defects and complete fixes within a limited time and number of steps?
- Can the model reliably call tools to complete a multi-step loop of reading files, running commands, inspecting output, and then making further modifications?
- When fixing a problem, does the model break other existing functionality or introduce unnecessary changes?
These questions cannot be answered by a single score. They need to be examined separately.
2. Common Evaluation Dimensions and Their Meaning
2.1 Composite Intelligence Index
A composite index aggregates results from multiple benchmarks into a single weighted number, making it suitable for rough ranking. Its value is that it enables quick comparison of overall levels. Its drawback is that the choice of weights is subjective. Under different weights, the same model may rank noticeably differently, so a composite index can only serve as an initial screening reference.
2.2 Agent-Oriented Terminal Task Benchmarks
This type of benchmark lets a model work in a terminal-like environment. The model needs to read files, execute commands, parse output, and modify code, and a test script or state check ultimately determines whether the task is complete. Evaluation results are heavily affected by the following factors:
- The time limit and step limit per task;
- The set of available tools and their permissions;
- Whether retries are allowed after a failure;
- How prompt templates and system instructions are written.
Therefore, the same benchmark may produce different results in different teams’ hands. When reading such scores, the first step is to confirm the specific configuration of the evaluation framework.
2.3 Degree of Open Weights
Open weights and closed-source APIs are two different dimensions. Open weights mean that model parameters can be downloaded and deployed, fine-tuned, and audited in one’s own environment, but this also comes with deployment and operations costs. Closed-source APIs are usually easy to integrate, but data flows, availability, and version changes must be explained and borne by the service provider.
When comparing open and closed models, the score gap is only one aspect. For enterprises with data egress restrictions, whether a model can be deployed locally may matter more than a few points of difference.
2.4 Cost, Latency, and Throughput
Coding agents usually require multiple rounds of calls, and each step consumes tokens and adds waiting time. A model with slightly lower accuracy but half the cost per task may be more suitable in large-batch scenarios. During evaluation, the cost, elapsed time, and number of calls per task should be recorded together.
The following table summarizes the focus of several dimensions:
| Dimension | Question to consider | Common way to judge |
|---|---|---|
| Overall capability | What range is the overall level in? | Public leaderboards, as an initial screen |
| Task accuracy | Can it pass on target tasks? | In-house evaluation set, multiple runs |
| Stability | Are results consistent across repeated runs on the same task? | Variance and pass@k |
| Tool reliability | Does it misuse commands or exceed permissions? | Execution log audit |
| Deployment and compliance | Can data leave the environment? Can it be deployed privately? | Architecture and contract review |
| Cost and latency | Cost and time per task | Actual runtime statistics |
3. Five Points for Reading Leaderboard Scores
First, differences in evaluation settings. The same model may score quite differently under different temperature parameters, tool sets, and step limits. Before comparing two scores, confirm whether the evaluation conditions are consistent.
Second, random fluctuation in a single run. Model output is stochastic, and the result of a single run may be nothing more than noise. If two models differ by only one or two points, it is not appropriate to conclude which is better without multiple runs and confidence intervals.
Third, data contamination. Training data may contain content that is identical or highly similar to benchmark questions, which can inflate scores, and the degree of inflation is difficult to quantify. For public benchmarks, it is best to combine them with undisclosed internal tasks when making judgments.
Fourth, discretization caused by the number of tasks. Suppose a benchmark contains 80 tasks, so each task accounts for about 1.25 points. A difference of two questions will appear as a 2.5-point change. When the number of tasks is small, individual questions can significantly change the total score. This is especially important when comparing similar models.
Fifth, measured versus estimated results. Some leaderboards mark statuses such as “estimated” or “pending release,” providing projections based on assumptions rather than actual runtime data. When making judgments, distinguish verified results from speculative conclusions.
4. Building Your Own Evaluation Pipeline
Public benchmarks can provide reference points, but what really determines model selection is an evaluation that closely matches your own business. Below is a minimal executable workflow.
4.1 Task Set Design
Sources for the task set can include the following:
- Defects already fixed in historical tickets, with the reproduction steps and verification tests from that time;
- Anonymized internal code snippets covering common frameworks and business modules;
- New requirements written for specific scenarios, such as adding unit tests, migrating interfaces, or fixing alerts.
Tasks should cover different types such as reading code, locating problems, modifying implementations, adding tests, and refactoring, and should be stratified by difficulty. Each task should have an automated scoring method, with manual review used to sample-check whether the scoring script itself is reliable.
4.2 Execution Environment Isolation
Each run should start from a clean snapshot to avoid files or caches left by the previous run affecting the result. Recommended practices are as follows:
- Use containers or virtualized environments to run tasks;
- Disable external network access by default, allowing only necessary dependency sources;
- Limit CPU, memory, and disk quotas;
- Set a uniform timeout; record timeouts as failures.
4.3 Metric Definitions
It is recommended to record at least the following metrics:
- pass@1: the pass rate of a single run;
- pass@k: the probability that at least one of k samples passes;
- average number of steps and tool calls;
- time and cost per task;
- number of out-of-scope operations, such as modifying files unrelated to the task.
pass@k usually uses an unbiased estimate. Suppose the same task is run n times, and c of those runs pass. Then the estimated value of pass@k is:
$\text{pass@}k = 1 - \frac{\binom{n-c}{k}}{\binom{n}{k}}$
4.4 Example Code
The following code shows the basic structure of a single task run and scoring process, omitting some engineering details.
import mathimport subprocessimport timefrom dataclasses import dataclass@dataclassclass TaskResult:task_id: strpassed: boolsteps: int | Noneseconds: floatdef run_task(task, agent, timeout_s=600):"""Run one agent task in an isolated directory and judge the result using the test command."""workdir = prepare_snapshot(task.repo_ref) # Start from a clean snapshot every timestart = time.monotonic()steps = Nonetry:trace = agent.solve(task.prompt, workdir, timeout=timeout_s)steps = len(trace.actions)except TimeoutError:pass # Record timeouts directly as failures; do not continue judgingelapsed = time.monotonic() - startif steps is None:return TaskResult(task.task_id, False, None, elapsed)# Grading only looks at the final state. Pass the command as a list to avoid injection risk from shell string concatenation.proc = subprocess.run(task.test_cmd,cwd=workdir,capture_output=True,timeout=300,)return TaskResult(task.task_id, proc.returncode == 0, steps, elapsed)def pass_at_k(n: int, c: int, k: int) -> float:"""Unbiased estimate of pass@k when c of n runs pass."""if n - c < k:return 1.0return 1.0 - math.comb(n - c, k) / math.comb(n, k)
Run results should be aggregated by task, and bootstrap resampling should be performed with the task as the unit to estimate confidence intervals for the score. If the intervals for two models overlap substantially, it is not appropriate to conclude which one is better.
5. Model Selection Framework
Model selection should not rely only on leaderboards. The recommended process has three steps: first use public leaderboards to narrow the candidates; then use an in-house evaluation set to compare accuracy, stability, and cost; finally run a small-scale pilot.
