Large language models such as Codex, have shown the capability to produce code for many programming tasks. However, the success rate of existing models is low, especially for complex programming tasks. One of the reasons is that language models lack awareness of program semantics, resulting in incorrect programs, or even programs which do not compile. In this paper, we systematically study whether automated program repair (APR) techniques can fix the incorrect solutions produced by language models in LeetCode contests. The goal is to study whether APR techniques can enhance reliability in the code produced by large language models. Our study revealed that: (1) automatically generated code shares common programming mistakes with human-crafted solutions, indicating APR techniques may have potential to fix auto-generated code; (2) given bug location information provided by a statistical fault localization approach, the newly released Codex edit mode, which supports editing code, is similar to or better than existing Java repair tools TBar and Recoder in fixing incorrect solutions. By analyzing the experimental results generated by these tools, we provide several suggestions: (1) enhancing APR tools to surpass limitations in patch space (e.g., introducing more flexible fault localization) is desirable; (2) as large language models can derive more fix patterns by training on more data, future APR tools could shift focus from adding more fix patterns to synthesis/semantics based approaches, (3) combination of language models with APR to curate patch ingredients, is worth studying.
翻译:大型语言模型(如 Codex ) 展示了为许多编程任务制作代码的能力。 但是,现有模型的成功率较低, 特别是复杂的编程任务。 原因之一是语言模型缺乏对程序语义学的认识,导致程序错误,甚至编程不完善。 在本文中, 我们系统研究自动程序修理( APR) 技术能否纠正LetCode 竞赛中语言模型产生的错误解决方案。 我们的目标是研究RA 技术能否提高大语言模型生成的代码的可靠性。 我们的研究显示:(1) 自动生成代码与人造的解决方案共享共同的编程错误, 表明 RA 技术有可能修复自动生成的代码; (2) 统计错误本地化方法提供的错误位置信息, 导致错误位置信息, 导致不正确的程序程序。 新发布的代码编辑模式与现有的 Java 修复工具 TBar 和 Recoder 的不正确解决方案相似或更好。 我们通过分析这些工具产生的实验结果, 提供了几项建议:(1) 加强RA 工具, 以克服补补补空空间中的局限性( 例如, 引入更灵活的本地化), 表明 APR 系统化方法可能改变大语言模式,, 使大语言模型更侧重于 。