arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2602.02896cs.SE
收藏

面向大语言模型(LLM)代码生成的失败意识增强:决策框架的实证研究

Failure-Aware Enhancements for Large Language Model (LLM) Code Generation: An Empirical Study on Decision Framework

University of Montana(蒙大拿大学)

Jianru Shen, Zedong Peng, Lucy Owen

AI总结:

本文通过实证研究,提出了一种基于失败特征的决策框架,用于指导大语言模型代码生成中的增强策略选择。

摘要:

大语言模型(LLMs)在通过将需求转化为代码来自动化软件开发方面显示出潜力。然而,即使先进的提示工作流如逐步提示法也常常无法满足某些需求。尽管自我批评、多模型协作和检索增强生成(RAG)等方法已被提出以弥补这些差距,但开发者缺乏明确的指导来判断何时使用每种方法。在对25个GitHub项目的实证研究中,我们发现逐步提示法在平均任务完成率上达到96.9%,显著优于直接提示法(80.5%,Cohen's d=1.63,p<0.001),但仍有8个项目未完成。对于6个最具代表性的项目,我们评估了每种增强策略在4种失败类型上的表现。我们的结果表明,方法的有效性取决于失败特征:自我批评在可审查的逻辑错误上成功,但在外部服务集成上完全失败(0%改进),而RAG在所有失败类型上均取得最高完成率,效率更优。基于这些发现,我们提出了一种决策框架,将每种失败模式映射到最合适的增强方法,为实践者提供实际的、数据驱动的指导,而非试错。

英文摘要:

Large language models (LLMs) show promise for automating software development by translating requirements into code. However, even advanced prompting workflows like progressive prompting often leave some requirements unmet. Although methods such as self-critique, multi-model collaboration, and retrieval-augmented generation (RAG) have been proposed to address these gaps, developers lack clear guidance on when to use each. In an empirical study of 25 GitHub projects, we found that progressive prompting achieves 96.9% average task completion, significantly outperforming direct prompting (80.5%, Cohen's d=1.63, p<0.001) but still leaving 8 projects incomplete. For 6 of the most representative projects, we evaluated each enhancement strategy across 4 failure types. Our results reveal that method effectiveness depends critically on failure characteristics: Self-Critique succeeds on code-reviewable logic errors but fails completely on external service integration (0% improvement), while RAG achieves highest completion across all failure types with superior efficiency. Based on these findings, we propose a decision framework that maps each failure pattern to the most suitable enhancement method, giving practitioners practical, data-driven guidance instead of trial-and-error.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑