超越通过测试:改进大语言模型生成代码质量的技术的系统综述与受控再评估
Beyond Passing Tests: A Systematic Review and Controlled Re-evaluation of Techniques for Improving the Quality of LLM-Generated Code
AI总结:
本研究通过系统综述628项研究并受控再评估,发现多数改进LLM生成代码质量的技术仅覆盖单一维度,在匹配预算下n-best采样表现优于多数技术,仅1种技术显著优于它,收益需基于独立指标报告。
摘要:
大语言模型通过了大多数功能正确性基准测试,但通过测试并不能说明其代码是否可读、高效或安全。许多技术声称能改进这些质量,但它们的证据分散,通常仅覆盖一个质量维度,且很少在相同计算预算下进行比较。我们开展了系统综述与受控再评估:对628项主要研究(2021年7月至2026年10月)进行系统文献综述,在作者审核的LLM协助下,按阶段、信号源和质量目标对技术进行分类。多数研究仅测量其目标维度,收益常伴随正确性不变或未报告,单一自动化质量信号易被操纵,且计算、方差和污染情况很少被报告。受控再评估在匹配的正确性、可维护性、效率和安全基准预算下,对4种模型运行10种技术,扩展至13种当前模型和仓库级任务,并在Gemma 4 31B上对66种重点技术进行正面比较。一次调用中,质量提示提升了分析器问题数量,但复杂度和评估者分数几乎不变。在匹配预算下,带分析器加权排序器的n-best采样在排序器未优化的指标上与提示、规划、自精调、审查智能体和检索相当或更优,而分析器反馈循环和精调仅在分析器问题数量上优于它。在接近上限的可能受污染基准HumanEval+上出现大的正确性损失,但在模型训练截止日期后的竞赛中未出现。在正面比较中,66种技术中仅1种在95%区间外的主要目标上优于n-best采样,该比率与随机概率一致。收益应针对匹配预算的采样基线,并在独立于技术自身信号的指标上报告。
英文摘要:
Large language models pass most functional-correctness benchmarks, but passing tests says little about whether their code is readable, efficient or secure. Many techniques claim to improve these qualities, yet their evidence is scattered, usually covers one quality dimension and is rarely compared at an equal compute budget. We contribute a systematic review and a controlled re-evaluation. A systematic literature review of 628 primary studies (July 2021 to October 2026), with disclosed, author-reviewed LLM assistance, organizes the techniques by stage, signal source and quality target. Most studies measure only the dimension they target, gains often come with unchanged or unreported correctness, single automated quality signals are gamed, and compute, variance and contamination are rarely reported. A controlled re-evaluation runs ten techniques on four models at matched budgets on correctness, maintainability, efficiency and security benchmarks, extends it to thirteen current models and repository-level tasks, and compares 66 highlighted techniques head-to-head on Gemma 4 31B. At one call, quality prompting raises analyzer issue counts and leaves complexity and judge scores almost unchanged. At matched budgets, best-of-n sampling with an analyzer-weighted ranker matches or beats prompting, planning, self-refinement, a reviewer agent and retrieval on measures the ranker does not optimize, while an analyzer feedback loop and fine-tuning beat it only on analyzer issue counts. Large correctness losses on HumanEval+, a likely contaminated benchmark near its ceiling, do not appear on contests held after the models' training cutoffs. In the head-to-head, 1 of 66 techniques beats best-of-n on its primary target beyond the 95% interval, a rate consistent with chance. Gains should be reported against a budget-matched sampling baseline and on measures independent of the technique's own signal.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。