利用搜索-生成-修改功能自动编辑代码

IF 6.5 1区 计算机科学 Q1 COMPUTER SCIENCE, SOFTWARE ENGINEERING IEEE Transactions on Software Engineering Pub Date : 2024-03-27 DOI:10.1109/TSE.2024.3376387
Changshu Liu;Pelin Cetin;Yogesh Patodia;Baishakhi Ray;Saikat Chakraborty;Yangruibo Ding
{"title":"利用搜索-生成-修改功能自动编辑代码","authors":"Changshu Liu;Pelin Cetin;Yogesh Patodia;Baishakhi Ray;Saikat Chakraborty;Yangruibo Ding","doi":"10.1109/TSE.2024.3376387","DOIUrl":null,"url":null,"abstract":"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: \n<sc>SarGaM</small>\n, which is designed to follow a real developer's code editing behavior. Given an original code version, the developer may \n<italic>search</i>\n for the related patches, \n<italic>generate</i>\n or write the code, and then \n<italic>modify</i>\n the generated code to adapt it to the right context. Our evaluation of \n<sc>SarGaM</small>\n on edit generation shows superior performance w.r.t. the current state-of-the-art techniques. \n<sc>SarGaM</small>\n also shows its effectiveness on automated program repair tasks.","PeriodicalId":13324,"journal":{"name":"IEEE Transactions on Software Engineering","volume":null,"pages":null},"PeriodicalIF":6.5000,"publicationDate":"2024-03-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Automated Code Editing With Search-Generate-Modify\",\"authors\":\"Changshu Liu;Pelin Cetin;Yogesh Patodia;Baishakhi Ray;Saikat Chakraborty;Yangruibo Ding\",\"doi\":\"10.1109/TSE.2024.3376387\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"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: \\n<sc>SarGaM</small>\\n, which is designed to follow a real developer's code editing behavior. Given an original code version, the developer may \\n<italic>search</i>\\n for the related patches, \\n<italic>generate</i>\\n or write the code, and then \\n<italic>modify</i>\\n the generated code to adapt it to the right context. Our evaluation of \\n<sc>SarGaM</small>\\n on edit generation shows superior performance w.r.t. the current state-of-the-art techniques. \\n<sc>SarGaM</small>\\n also shows its effectiveness on automated program repair tasks.\",\"PeriodicalId\":13324,\"journal\":{\"name\":\"IEEE Transactions on Software Engineering\",\"volume\":null,\"pages\":null},\"PeriodicalIF\":6.5000,\"publicationDate\":\"2024-03-27\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"IEEE Transactions on Software Engineering\",\"FirstCategoryId\":\"94\",\"ListUrlMain\":\"https://ieeexplore.ieee.org/document/10482873/\",\"RegionNum\":1,\"RegionCategory\":\"计算机科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q1\",\"JCRName\":\"COMPUTER SCIENCE, SOFTWARE ENGINEERING\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"IEEE Transactions on Software Engineering","FirstCategoryId":"94","ListUrlMain":"https://ieeexplore.ieee.org/document/10482873/","RegionNum":1,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

摘要

在不断发展的软件开发过程中,代码编辑是必不可少的。文献中提出了几种自动代码编辑工具,它们利用了基于信息检索的技术和基于机器学习的代码生成和代码编辑模型。每种技术都有自己的优势和劣势,因此,它们经常被结合使用,以取长补短。本文提出了一种混合方法,通过利用代码搜索、生成和修改的力量,更好地合成代码编辑。我们的主要观点是,通过搜索和检索获得的补丁即使不正确,也能为代码生成模型提供有益的指导。然而,由代码生成模型生成的以检索为指导的补丁仍可能与预期补丁相差几个字节。这种生成的补丁可以稍加修改,以创建预期的补丁。我们开发了一种新颖的工具来解决这一难题:SarGaM,它的设计遵循真实开发者的代码编辑行为。在给定原始代码版本的情况下,开发人员可以搜索相关补丁,生成或编写代码,然后修改生成的代码,使其适应正确的上下文。我们对 SarGaM 在编辑生成方面的评估结果表明,与当前最先进的技术相比,SarGaM 的性能更加卓越。SarGaM 还显示了其在自动程序修复任务中的有效性。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
Automated Code Editing With Search-Generate-Modify
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.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
IEEE Transactions on Software Engineering
IEEE Transactions on Software Engineering 工程技术-工程:电子与电气
CiteScore
9.70
自引率
10.80%
发文量
724
审稿时长
6 months
期刊介绍: IEEE Transactions on Software Engineering seeks contributions comprising well-defined theoretical results and empirical studies with potential impacts on software construction, analysis, or management. The scope of this Transactions extends from fundamental mechanisms to the development of principles and their application in specific environments. Specific topic areas include: a) Development and maintenance methods and models: Techniques and principles for specifying, designing, and implementing software systems, encompassing notations and process models. b) Assessment methods: Software tests, validation, reliability models, test and diagnosis procedures, software redundancy, design for error control, and measurements and evaluation of process and product aspects. c) Software project management: Productivity factors, cost models, schedule and organizational issues, and standards. d) Tools and environments: Specific tools, integrated tool environments, associated architectures, databases, and parallel and distributed processing issues. e) System issues: Hardware-software trade-offs. f) State-of-the-art surveys: Syntheses and comprehensive reviews of the historical development within specific areas of interest.
期刊最新文献
Fast and Precise Static Null Exception Analysis with Synergistic Preprocessing Towards a Cognitive Model of Dynamic Debugging: Does Identifier Construction Matter? SCAnoGenerator: Automatic Anomaly Injection for Ethereum Smart Contracts Metamorphic Testing of Image Captioning Systems via Image-Level Reduction Mitigating Noise in Quantum Software Testing Using Machine Learning
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1