arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.14129cs.SEcs.LG
收藏

GrACE:利用关联代码编辑进行生成

GrACE: Generation using Associated Code Edits

Microsoft(微软);University of Pennsylvania(宾夕法尼亚大学);Microsoft Research(微软研究院)

Priyanshu Gupta, Avishree Khare, Yasharth Bajpai, Saikat Chakraborty, Sumit Gulwani, Aditya Kanade, Arjun Radhakrishna, Gustavo Soares, Ashish Tiwari

AI总结:

本文提出 GrACE 方法,通过将先前相关代码编辑知识注入预训练代码大语言模型,在 Codex 和 CodeT5 上显著提升了代码编辑预测性能,top-1 正确编辑代码分别比现有符号和神经方法提高 29% 和 54%。

摘要:

开发人员出于修复缺陷或添加新功能等多种原因,会花费大量时间编辑代码。由于代码编辑的多样性以及捕捉开发人员意图的困难,设计有效的方法来预测代码编辑一直是一个活跃但具有挑战性的研究领域。在这项工作中,我们通过赋予预训练的代码大语言模型(LLMs)以先前相关编辑的知识来应对这些挑战。LLMs 的生成能力有助于应对代码变更的多样性,而以先前编辑为条件进行代码生成有助于捕捉潜在的开发人员意图。我们分别在零样本和微调设置下评估了两个知名的大语言模型 Codex 和 CodeT5。在我们使用两个数据集进行的实验中,先前编辑的知识显著提升了大语言模型的性能,使它们在 top-1 建议中分别能够比当前最先进的符号方法和神经方法多生成 29% 和 54% 的正确编辑代码。

英文摘要:

Developers expend a significant amount of time in editing code for a variety of reasons such as bug fixing or adding new features. Designing effective methods to predict code edits has been an active yet challenging area of research due to the diversity of code edits and the difficulty of capturing the developer intent. In this work, we address these challenges by endowing pre-trained large language models (LLMs) of code with the knowledge of prior, relevant edits. The generative capability of the LLMs helps address the diversity in code changes and conditioning code generation on prior edits helps capture the latent developer intent. We evaluate two well-known LLMs, Codex and CodeT5, in zero-shot and fine-tuning settings respectively. In our experiments with two datasets, the knowledge of prior edits boosts the performance of the LLMs significantly and enables them to generate 29% and 54% more correctly edited code in top-1 suggestions relative to the current state-of-the-art symbolic and neural approaches, respectively.

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

↑