Evaluating LLM Code Repair Capabilities: Benchmarks, Limits, and Selection Practices
This article explains why public coding benchmarks often fail to reflect real programming ability, then breaks LLM evaluation into three dimensions: repository-level bug fixing, large-scale multi-file refactoring, and command-line environment execution. It covers the value and limitations of classic bug-fix benchmarks, how harder refactoring benchmarks restore discriminative power through change size and licensing isolation, and the process-oriented nature of terminal-based agent evaluation. It also outlines a practical workflow for building a private, reproducible evaluation set aligned with your own codebase, along with common pitfalls and architecture recommendations.
1. Why Benchmark Scores No Longer Explain Real Coding Ability
When enterprises evaluate AI coding tools, a common frustration is that top models on public leaderboards sit within a very narrow score band, yet the experience gap in real projects is obvious. The reason is not mysterious: once the tasks, tests, and scoring methods of a public benchmark stabilize, they get reused repeatedly. That makes them easy for models to have “seen” during training, and any weakness in the evaluation methodology itself amplifies the error.
To understand coding ability evaluation, it helps to split it into three distinct dimensions:
- Bug repair: locating a problem in an existing codebase and producing a minimal viable change;
- Long-chain refactoring: completing a requirement across files and modules, with large changes and many dependencies;
- Environment execution: autonomously exploring, installing dependencies, running commands, and verifying results in a command-line environment.
Each dimension maps to a different evaluation design, and no single score can cover all three.
2. Classic Repository-Level Bug Fix Evaluation: Value and Limitations
The earliest widely adopted approach builds tasks automatically from real defects and merge records in open-source repositories: given a repository snapshot, a problem description, and a set of verification tests, the model must produce a patch, judged by whether the tests pass. To improve stability, the industry later introduced manually curated high-quality subsets that remove samples with vague descriptions, flaky tests, or ambiguous judging criteria; these subsets are typically a few hundred tasks in size.
The value of this type of evaluation lies in being “real”: tasks come from real engineering work, and verification is done by executable tests rather than subjective human scoring. But its limitations are equally clear:
- Fragile judging: some tests mark a correct solution as failing, for example when a change fixes the root cause but touches implementation details that the test over-constrains.
- Data contamination: repositories, defect descriptions, and fix records are all publicly searchable, so models may have encountered similar samples during pre-training.
- Difficulty saturation: once mainstream models broadly enter a high-score range, the discriminative power of the score drops quickly and its marginal information approaches zero.
An intuitive signal: if most models cluster in a narrow high-score band on a given benchmark and only a handful of samples separate them, that benchmark is better suited as a “baseline capability threshold” than as a “selection criterion.”
3. High-Difficulty Refactoring Evaluation: Trading Scale and Isolation for Discriminative Power
To mitigate the problems above, harder alternatives have emerged, built on two main design ideas.
First, raise difficulty through change size. For example, each task must change at least ten lines of code, and a substantial share of tasks require changes of a hundred lines or more. Larger changes mean a model cannot complete the task through local pattern matching alone; it must understand call relationships, interface contracts, and regression risk.
Second, isolate through licensing. The public subset and the held-out subset are built from repositories under strong copyleft licenses (such as GPL-family licenses), lowering the probability of overlap with common training corpora and making scores closer to “unseen” real-world performance.
On this type of evaluation, most models score markedly lower than on classic benchmarks, typically below sixty percent; only a very small number of closed-source flagship models clear that bar. This shows precisely that when tasks require long-chain reasoning and cross-file consistency, capability tiers between models re-emerge.
It is worth stressing that a high or low score is not the whole story of engineering usability. Large-change tasks also demand more of context management, retrieval strategy, and verification loops, and supporting engineering capabilities often determine the final outcome more than the “bare model score.”
4. Terminal Environment Execution Evaluation: A Touchstone for Agent Capability
The third type of evaluation places a model in a command-line environment and asks it to autonomously complete a set of operational tasks: listing directories and files, searching code, installing dependencies, running builds and tests, and iteratively fixing issues based on errors until the goal state is reached.
Its fundamental difference from the first two types is that it is process-oriented: scoring looks not only at the final artifact but also at whether the model makes sound decisions within a limited number of steps. Common failure modes include:
- Blindly executing high-risk commands without necessary confirmation or rollback;
- Repeatedly retrying after a dependency installation fails, without diagnosing the environment;
- Ignoring existing tests or log clues and modifying code based on guesswork;
- Losing early constraints after context grows, leading to goal drift.
For this kind of capability, engineering practice usually needs external constraints to fill the gaps: restricting an allowlist of executable commands, setting timeouts and resource limits, requiring reproducible logs, and running in a sandbox with snapshots retained for rollback.
5. Turning Leaderboard Scores into an Actionable Selection Method
Rather than chasing a single leaderboard, a more reliable approach is to build a private evaluation set drawn from the same distribution as your own codebase. A reusable workflow:
1. Sample: draw 100-300 items from historical defect tickets, covering different modules and change sizes2. Sanitize: remove internal identifiers, addresses, and proprietary names while keeping real call relationships3. Freeze: fix the repository snapshot and verification commands for each task, and pin dependency versions4. Bucket: group and report results by three categories: local fix / cross-file refactoring / environment operation5. Re-run: regress periodically, watch for score drift, and detect contamination and broken tests6. Attribute: manually classify failed samples into comprehension errors, retrieval gaps, and verification failures
When scoring, it is advisable to introduce process metrics rather than pass rate alone, such as average number of interaction turns, proportion of invalid commands, average elapsed time, and number of rollbacks. These metrics often correlate with real development experience more strongly than leaderboard rank.
6. Common Pitfalls and Practical Recommendations
- Pitfall 1: higher score is always better. Score differences in a saturated range are often smaller than evaluation noise, so pay attention to confidence intervals and sample size.
- Pitfall 2: one model fits all tasks. Bug repair, long-chain refactoring, and terminal operation place different demands on capability and should be assigned by scenario.
- Pitfall 3: ignoring the verification loop. Without stable tests and a sandbox, even the strongest model cannot prove a change is correct.
- Pitfall 4: overlooking data compliance. Confirm the evaluation set and repository licenses in advance to avoid introducing unusable code.
For the implementation architecture, you can compose general-purpose technical components: use a container platform to provide isolated sandboxes, object storage to hold repository snapshots and artifacts, a message queue to schedule evaluation tasks, and logging services with monitoring and alerting to track failure rates and latency fluctuations. Baidu AI Cloud can provide corresponding support in these general capabilities, helping teams turn evaluation from a “one-off benchmark run” into a “continuously observable engineering process.”
7. Conclusion
Coding ability evaluation is moving from a “single high-score benchmark” toward a combined system that is “multi-dimensional, strongly isolated, and process-oriented.” Understanding the design trade-offs of each evaluation type, building a private and reproducible evaluation loop, and pairing it with sandboxing and observability are what enable stable, explainable selection decisions in an environment of rapidly iterating models.
