Evaluating Software Engineering Agents: Building a Real-World Task Benchmark from Scratch
This article explores the challenges of evaluating AI agents in real-world software engineering tasks. It outlines the core principles of building an evaluation benchmark—zero contamination, high diversity, and real-world complexity—and details the standard pipeline for task construction. Additionally, it provides practical guidance on evaluation metrics, interpreting leaderboard scores, avoiding common pitfalls, and setting up a reliable internal evaluation process to help teams select and improve AI models for code engineering.
1. Why We Need Real-World Engineering Code Evaluation
Early code evaluations mostly focused on single-function completion or algorithmic puzzles. These tasks were short, with clear inputs and outputs, where models could score simply by generating a snippet of code. Real-world software engineering is entirely different. Developers must locate issues within an existing codebase, understand cross-module call relationships, modify multiple files, and ensure existing tests continue to pass. The difficulty of such tasks lies in the large context scale, complex dependencies, and the requirement that modifications must conform to existing project conventions.
Therefore, determining whether a large language model (LLM) is capable of engineering work requires an evaluation system closer to real-world scenarios. It should at least answer three questions: Can the model understand an unfamiliar codebase? Can it complete modifications under multiple constraints? And can the modifications pass automated verification?
2. Three Core Design Principles of the Evaluation Benchmark
1. Zero Contamination
If evaluation questions are sourced from public historical issues or heavily overlap with common training data, models might score based on memorization rather than reasoning. Zero contamination requires tasks to be written from scratch without directly reusing public bug reports or code commits. Scores derived this way better reflect the model’s true generalization capabilities.
2. High Diversity
A single language or a single type of task cannot represent the full spectrum of engineering. Diversity is reflected across four dimensions: programming language, project domain, task type (such as bug fixing, feature extension, refactoring, performance tuning), and repository scale. A qualified benchmark should cover multiple languages and numerous independent repositories to prevent models from only excelling at a specific category of problems.
3. Real-World Complexity
Complexity is primarily reflected in three aspects: the number of steps required to complete the task, the number of files that need to be read, and the interdependencies between different modifications. Task descriptions should resemble real-world requirements, stating only the goals and constraints without dictating specific implementation methods. This properly tests the model’s ability to plan autonomously.
3. Standard Pipeline for Task Construction
A reliable evaluation task typically goes through the following five stages:
(1) Repository Selection: Choose actively maintained open-source projects, ensuring the codebase structure is sound and dependencies can be installed normally.
(2) Problem Design: Design bugs or feature requirements based on the actual state of the project, and write a clear description in natural language.
(3) Verification Construction: Write test cases covering key requirement points and boundary conditions. Tests should only verify external behavior, not dictate internal implementation, otherwise reasonable alternative solutions may be incorrectly marked as failed.
(4) Dual Verification: Independent personnel should review the description for ambiguity and confirm that the tests pass on the reference implementation but fail on the buggy version.
(5) Environment Pinning: Lock dependency versions and the runtime environment to ensure that evaluations conducted at different times can be fairly compared.
Below is an illustrative structure of a task record, showing how fields are organized:
task_id: Task identifierrepo_snapshot: Pinned commit version of the repositorylanguage: Programming languagedescription: Requirement description (natural language)hidden_tests: Test suite dedicated to evaluation, not disclosed to the model being testedtimeout_seconds: Time limit for a single run
Keeping the test suite hidden prevents the model from fitting the test cases themselves, ensuring the pass rate reflects actual problem-solving ability.
4. The Value of Broad Coverage
One public benchmark includes 113 original tasks distributed across 91 active open-source repositories, involving five programming languages. The value of broad coverage lies in the fact that different repositories have significant differences in code style, framework choices, and testing habits, all of which impact model performance. Cross-repository evaluation reduces chance and leads to more stable conclusions.
When building your own evaluations, the proportion of questions should match the target user’s tech stack. For instance, if the business is primarily backend services, questions related to backend languages and common service frameworks should account for a larger share, while frontend or data-related tasks should be allocated according to actual usage frequency.
5. Evaluation Metrics and Scoring Methods
The most commonly used metric is the task pass rate—the proportion of tasks where the model’s generated modifications allow all hidden tests to pass. Some systems also record average attempts, single-task time consumption, and resource usage to assess efficiency.
When using these metrics, note the following:
- Pass rates should distinguish between single-attempt and multi-attempt scenarios. Their meanings differ and should be labeled separately in reports rather than mixed together.
- Timeouts, environment errors, and logical errors should be counted separately. This helps determine whether failures stem from model capability or the evaluation environment itself.
- If the model is allowed to call external tools, the available tools and their permission scopes must be explicitly listed and noted in the report; otherwise, the results cannot be reproduced.
6. How to Interpret Leaderboard Scores
A common situation on public leaderboards is that multiple models have similar scores or even tie for first place. For example, in one version of a leaderboard, two models both achieved a 74% pass rate. Another model reached about 77.9% in a subsequent version. When reading these numbers, keep three things in mind:
First, small margins may fall within the margin of statistical error. Taking 113 tasks as an example, each question accounts for roughly 0.9 percentage points, so a difference of a few percentage points may not represent a fundamental capability gap.
Second, version updates may change the task set or scoring rules. Before comparing across versions, confirm whether the evaluation criteria of both runs are consistent.
Third, a leaderboard only reflects performance under specific settings. Factors like runtime budget, whether multi-turn interaction is allowed, and the prompt template all affect the final result. Therefore, leaderboards are better used as a reference rather than the sole basis for selection.
7. Common Pitfalls
Pitfall 1: Taking leaderboard rankings directly as the selection basis. Rankings reflect the task distribution of the benchmark, which needs to be compared against your own business task distribution before making a judgment.
Pitfall 2: Looking only at the pass rate while ignoring failure reasons. Failure modes reveal a model’s weaknesses, such as misunderstanding requirements, failing to locate the code, or failing verification after modifications. Improvement directions vary completely based on the cause.
Pitfall 3: Ignoring costs. Long contexts and multi-turn interactions significantly increase time and expense. Evaluations should consider the cost per task rather than just the final score.
Pitfall 4: Using public questions for evaluation. Public questions are easily incorporated into training data, which degrades the credibility of the evaluation conclusions.
8. Practical Advice for Building Your Own Evaluation
(1) Extract questions from real bugs and requirements that have occurred in your business, anonymizing them to serve as base material.
(2) Equip each question with executable verification means to avoid relying on subjective manual scoring and to ensure results are repeatable.
(3) Retain historical failure samples to form a regression set, rerunning them after every model or tool upgrade.
(4) Periodically replace a portion of the questions to reduce bias caused by model memory.
(5) Evaluation scripts need version control just like the questions, and both should be archived together for future reproduction.
A minimal evaluation process looks roughly like this:
for task in tasks:workspace = prepare(task.repo_snapshot)patch = model.solve(task.description, workspace)apply(patch, workspace)result = run_tests(task.hidden_tests, timeout=task.timeout_seconds)record(task.task_id, result)
The key to this process is that every step can be independently recorded and inspected. When an anomaly occurs, you can pinpoint the specific stage without having to rerun the entire evaluation.
9. Summary
Real-world engineering code evaluation focuses on whether a model can independently complete verifiable modifications within a complex codebase. Zero contamination, high diversity, and real-world complexity are the three fundamental requirements for this type of benchmark. When referencing leaderboards, readers should make comprehensive judgments combining task distribution, statistical error, and evaluation criteria. For teams looking to implement AI in their workflows, establishing a repeatable, traceable internal evaluation process to continuously track the model’s actual performance in their specific business is far more valuable than chasing a single ranking.
