Beyond Pass@k: Measuring Reliability and Security of Agentic Code Generation
Organizations: Cornell University
Abstract
AI coding agent benchmarks rank agents with the Chen et al. (2021) pass@k estimator, but current implementations misapply it: they set n to the number of unit tests in a single submission rather than the number of independent rollout attempts, conflating test-suite size with attempt independence. We diagnose this operationalization error, prove it by counterexample, and propose reliability@k, the same estimator applied correctly, with n = independent rollouts and c = fully-passing rollouts per (task, agent) pair. In a synthetic multi-rollout benchmark, the misapplied metric inflates reported scores by 0.85-0.97 in absolute terms (0.96-0.98 reported vs. 0.00-0.12 corrected), and a cheap single-rollout proxy fails to substitute for repeated runs (Spearman ). Motivated by evidence that functional correctness does not imply security safety, we additionally propose security-adjusted reliability@k, which counts only rollouts that are both functionally correct and free of high-severity insecure patterns. In an initial live-API test with three agents, the adjustment did not change any ranking under our current scanner and threshold, so we present it as a proposed complementary lens whose decisive evaluation requires better-powered future runs. Finally, a preliminary 5-task SWE-bench Verified pilot observes the same core concern in a real repository setting: macro-averaged hidden-test pass rate was 0.80 while strict task resolution was 0.20.
Figures & tables
| Agent | Pass@5 | Rel.@5 | Infl. |
|---|---|---|---|
| agent-x | 0.975 | 0.125 | 0.850 |
| claude-code | 0.965 | 0.000 | 0.965 |
| codex | 0.959 | 0.000 | 0.959 |
| Mean | 0.966 | 0.042 | 0.924 |
| Task | Diff. | Resolved | F2P | P2P | Regr. |
|---|---|---|---|---|---|
| astropy__astropy-12907 | medium | yes | 2/2 | 13/13 | 0 |
| astropy__astropy-13033 | medium | no | 0/1 | 20/20 | 0 |
| astropy__astropy-13236 | medium | no | 0/2 | 644/644 | 0 |
| astropy__astropy-13398 | hard | no | 0/4 | 63/68 | 5 |
| astropy__astropy-13453 | medium | no | 0/1 | 2/9 | 7 |
Code Generation Evaluation
Code generation evaluation measures whether AI-produced programs are correct, reliable, secure, efficient, and faithful to their specifications.
See all 215 papers