当前位置: X-MOL 学术IEEE Trans. Softw. Eng. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Automated Code Editing With Search-Generate-Modify
IEEE Transactions on Software Engineering ( IF 6.5 ) Pub Date : 2024-03-27 , DOI: 10.1109/tse.2024.3376387
Changshu Liu 1 , Pelin Cetin 1 , Yogesh Patodia 1 , Baishakhi Ray 1 , Saikat Chakraborty 2 , Yangruibo Ding 1
Affiliation  

Code editing is essential in evolving software development. In literature, several automated code editing tools are proposed, which leverage Information Retrieval-based techniques and Machine Learning-based code generation and code editing models. Each technique comes with its own promises and perils, and for this reason, they are often used together to complement their strengths and compensate for their weaknesses. This paper proposes a hybrid approach to better synthesize code edits by leveraging the power of code search, generation, and modification. Our key observation is that a patch that is obtained by search & retrieval, even if incorrect, can provide helpful guidance to a code generation model. However, a retrieval-guided patch produced by a code generation model can still be a few tokens off from the intended patch. Such generated patches can be slightly modified to create the intended patches. We developed a novel tool to solve this challenge: SarGaM, which is designed to follow a real developer's code editing behavior. Given an original code version, the developer may search for the related patches, generate or write the code, and then modify the generated code to adapt it to the right context. Our evaluation of SarGaM on edit generation shows superior performance w.r.t. the current state-of-the-art techniques. SarGaM also shows its effectiveness on automated program repair tasks.

中文翻译:


使用“搜索-生成-修改”进行自动代码编辑



代码编辑对于不断发展的软件开发至关重要。在文献中,提出了几种自动代码编辑工具,它们利用基于信息检索的技术和基于机器学习的代码生成和代码编辑模型。每种技术都有其自身的前景和危险,因此,它们经常一起使用,以补充其优点并弥补其缺点。本文提出了一种混合方法,通过利用代码搜索、生成和修改的力量来更好地综合代码编辑。我们的主要观察是,通过搜索和检索获得的补丁,即使不正确,也可以为代码生成模型提供有用的指导。然而,由代码生成模型生成的检索引导补丁仍然可能与预期补丁有一些差距。可以稍微修改此类生成的补丁以创建预期的补丁。我们开发了一种新颖的工具来解决这一挑战:SarGaM,它旨在遵循真实开发人员的代码编辑行为。给定原始代码版本,开发人员可以搜索相关补丁,生成或编写代码,然后修改生成的代码以使其适应正确的上下文。我们对 SarGaM 在编辑生成方面的评估显示了当前最先进技术的卓越性能。 SarGaM 还展示了其在自动化程序修复任务上的有效性。
更新日期:2024-03-27
down
wechat
bug