Evaluating AI Agents on Real-World Software Engineering Tasks
This article breaks down how agent benchmarks for real software engineering tasks are built and scored, why leaderboard rankings shift and even reverse across versions, and how the gap between open-weight and closed models is narrowing. It also outlines how to build a reproducible internal evaluation loop, common pitfalls in interpreting results, and a phased rollout strategy for adopting coding agents in production.
1. Why Software Engineering Agents Need a New Kind of Benchmark
Traditional code evaluations mostly focus on single-function completion, algorithm puzzles, or unit test generation. These tasks have clear boundaries, short context, and deterministic grading. Real development work is the opposite: requirements are vague, codebases are large, dependencies are tangled, and fixing one spot often ripples across multiple modules.
This is why a class of benchmarks built around “real repositories + real defects + real verification” has emerged. The industry generally refers to them as agent benchmarks for software engineering tasks.
Three differences stand out:
- Task granularity moves from the function level to the repository level. Agents must handle retrieval, localization, modification, and verification end to end.
- Grading shifts from text similarity to behavioral correctness, typically using whether hidden tests pass as the sole deciding factor.
- The execution environment changes from plain text conversation to a runnable sandbox, requiring agents to handle dependency installation, build scripts, state rollback, and other engineering details.
2. Task Construction and Scoring
2.1 Task Sources and Filtering
High-quality tasks usually come from “historical issues that were already fixed” in long-maintained open-source repositories. Only issues fixed by real commits have trustworthy reference patches and regression tests.
Filtering typically removes three kinds of samples: those that require external service credentials to reproduce, those that depend on specific hardware, and those whose tests are flaky (randomness or timing dependencies).
2.2 Understanding the Metrics Correctly
Pass@1 is the share of attempts that succeed on the first try, and it is the metric closest to the real production experience. Pass@k, which allows k samples and takes the best result, inflates scores significantly, so the two cannot be compared directly.
Confidence intervals also matter. When there are only about a dozen subtasks, a swing of one or two samples can move the number by several percentage points. Small-sample results like “80% pass rate” should therefore be treated only as an early signal.
A schematic evaluation loop (pseudocode, showing the flow only):
def evaluate(model, tasks, k=1, max_steps=50):results = []for task in tasks:env = Sandbox(task.repo, task.base_commit)try:env.setup() # install dependencies, initialize environmentfor _ in range(k):patch = model.solve(task.prompt, env.replay())env.reset() # roll back to a clean state after each attemptenv.apply(patch)passed = env.run_hidden_tests()results.append(passed)if passed:breakfinally:env.destroy()return sum(results) / len(tasks)
3. Why Rankings Keep Moving and Reversing
A pattern shows up when you follow these leaderboards over time: rankings change frequently with each release, and old and new benchmarks often reach opposite conclusions. There are four main reasons.
First, task saturation. Once top models pass more than 70% of tasks, the remaining samples are mostly hard long-tail cases, discrimination drops, and tiny differences get amplified.
Second, version drift. A minor revision of the same benchmark can change the task set and container images, so historical scores are no longer strictly comparable.
Third, different inference budgets. The same model can differ by several percentage points between maximum reasoning effort and the default configuration.
Fourth, prompt and scaffolding differences. Retrieval strategy, context trimming, and retry mechanisms all change final results, and leaderboards often omit this part.
So treating a single first-place result as a selection criterion is risky. A safer approach is to look at performance by task type, for example how a model scores on defect fixing, cross-file refactoring, test writing, and dependency upgrades.
4. The Gap Between Open and Closed Models Is Closing
Early on, closed models clearly led on repository-level tasks, and open models usually sat in the lower half of leaderboards. As open-weight models improved at long context and tool calling, the gap narrowed to single-digit percentage points, and open solutions began posting the best results in their tier.
For enterprises, this means most day-to-day development assistance can be handled by privately deployed open-weight models without data leaving the premises, while the hardest tasks go to stronger general-purpose models, forming a tiered routing setup.
A simplified routing example:
def route(task):if task.cross_file and task.risk_level == "high":return "strong_model"if task.localized and task.has_repro_test:return "open_weight_model"return "strong_model_with_review"
5. Building a Reproducible Local Evaluation Loop
Turning leaderboard capability into your own gains requires an internal evaluation set. The recommended process:
- Mine fixed defects from your own repository’s commit history and build a task set of at least a hundred items.
- Containerize the build, tests, and dependency installation to keep the environment consistent.
- Fix the random seed and maximum step count.
- Record the full trajectory of each run, not just the score.
Reusable engineering building blocks include a container platform for isolated execution, object storage for trajectories and patch artifacts, a message queue for task distribution and load smoothing, and logging plus monitoring and alerting to observe failure clusters. If you use the relevant general-purpose product categories from Baidu AI Cloud, you can combine them this way into an elastic, auditable evaluation pipeline.
6. Common Mistakes in Reading Results
- Confusing small-sample results with large-scale conclusions.
- Ignoring coverage bias in hidden tests; repositories with incomplete tests will understate the true quality of a fix.
- Looking only at whether the run passed, not at whether the patch introduced unrelated changes, which creates regression risk.
- Overlooking cost; the compute spent on long reasoning chains and multiple retries must be weighed against the benefit.
7. Practical Recommendations
Start with low-risk scenarios such as explaining log errors, completing unit tests, and suggesting dependency upgrades. Then expand gradually to cross-module defect fixing, with mandatory human review and canary releases.
On the metrics side, track pass rate, average steps, lines changed per patch, and rollback rate together in a multi-dimensional dashboard. Only by connecting evaluation, execution, and observability can gains in model capability actually turn into development efficiency.
