AI 编码智能体写代码过度:一句简短提示词可将过度工程化程度降低 40%
Don't Over-Engineer It: AI Coding Agents Write Too Much Code, and a Short Prompt Reduces It
AI 导读
一项 arXiv 研究提出过度工程化评分(OES),分析 SWE-bench Verified 上 14 个公开智能体的 6,790 个智能体-任务对,发现智能体补丁中位大小为参考解的 0.67 到 8.20 倍,补丁为参考解 1-1.5 倍时解决率最高(59.6% vs 超过 10 倍时的 34.8%)。
正文 · 原文
Abstract:AI coding agents routinely produce correct solutions that include far more code than necessary, adding unrequested tests, documentation, refactoring and error handling beyond what the task requires. We formalize this phenomenon as over-engineering and introduce the Over-Engineering Score (OES), a family of metrics comparing the size and location of an agent's patch with the reference solution. Analyzing 6,790 agent--task pairs from 14 public agents on SWE-bench Verified, we find that over-engineering is pervasive (median OES between 0.67 and 8.20$\times$ the reference size, depending on the agent) and that a "Goldilocks zone" of 1--1.5$\times$ the reference has the highest resolution rate (59.6% vs. 34.8% for patches above 10$\times$), an association that persists under difficulty controls. A short system-prompt constraint that tells the agent to make the minimal change and not to add tests, documentation, type annotations, error handling or refactoring unless asked reduces mean OES by 40% across 14 models from 7 providers (13 of 14 models; median per-model reduction 43%), mostly by stopping edits to files the reference fix does not touch. Much of what it removes is unrequested test code: excluding test files, the reduction is 14%. It also cuts input tokens per task for 13 of 14 models, by up to 42%, and mean OES also falls for every model on SWE-bench Multilingual and Pro. Resolution does not change significantly in aggregate on any benchmark, and per-model effects go both ways.
| Comments: | Accepted at the AAAI-27 Workshop on Agentic Software Engineering (AgenticSE). OpenReview: this https URL. 13 pages, 1 figure, 17 tables |
| Subjects: | Software Engineering (cs.SE); Artificial Intelligence (cs.AI); Computation and Language (cs.CL) |
| Cite as: | arXiv:2612.04613 [cs.SE] |
| (or arXiv:2612.04613v1 [cs.SE] for this version) | |
| https://doi.org/10.48550/arXiv.2612.04613 arXiv-issued DOI via DataCite (pending registration) |
Submission history
From: Jay Desai [view email]
[v1]
Wed, 2 Dec 2026 20:43:31 UTC (69 KB)
来源:arXiv cs.AI · arxiv.org