arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2308.16586cs.SE
收藏

学习表示补丁(Patches)

Learning to Represent Patches

Xunzhu Tang, Haoye Tian, Zhenghan Chen, Weiguo Pian, Saad Ezzini, Abdoul Kader Kabore, Andrew Habib, Jacques Klein, Tegawende F. Bissyande

AI总结:

针对现有补丁表示方法忽略变更语义意图与修改行上下文的问题,提出融合代码上下文、代码变更意图与AST结构修改意图的Patcherizer方法,在三类软件工程任务上性能优于SOTA。

摘要:

补丁表示在自动化各类软件工程任务(如判定补丁准确性或总结代码变更)中至关重要。尽管近期研究已将深度学习用于补丁表示,聚焦于标记序列或抽象语法树(ASTs),但这类方法往往忽略了变更的语义意图及被修改行的上下文。为弥补这一缺口,我们提出一种新方法Patcherizer。该方法深入挖掘上下文与结构的意图,将周围代码上下文与两种创新表示相结合,分别捕捉代码变更中的意图,以及补丁应用前后AST结构修改的意图,这种整体表示能恰当地捕捉补丁的深层意图。Patcherizer采用图卷积神经网络进行结构意图图表示,采用transformers进行意图序列表示。我们在三个领域评估了Patcherizer嵌入的通用性:(1)补丁描述生成,(2)补丁准确性预测,(3)补丁意图识别。实验表明,该表示在所有任务上均有效,性能优于现有最优方法。例如,在补丁描述生成任务中,Patcherizer表现出色,BLEU分数平均提升19.39%,ROUGE-L分数平均提升8.71%,METEOR分数平均提升34.03%。

英文摘要:

Patch representation is crucial in automating various software engineering tasks, like determining patch accuracy or summarizing code changes. While recent research has employed deep learning for patch representation, focusing on token sequences or Abstract Syntax Trees (ASTs), they often miss the change's semantic intent and the context of modified lines. To bridge this gap, we introduce a novel method, Patcherizer. It delves into the intentions of context and structure, merging the surrounding code context with two innovative representations. These capture the intention in code changes and the intention in AST structural modifications pre and post-patch. This holistic representation aptly captures a patch's underlying intentions. Patcherizer employs graph convolutional neural networks for structural intention graph representation and transformers for intention sequence representation. We evaluated Patcherizer's embeddings' versatility in three areas: (1) Patch description generation, (2) Patch accuracy prediction, and (3) Patch intention identification. Our experiments demonstrate the representation's efficacy across all tasks, outperforming state-of-the-art methods. For example, in patch description generation, Patcherizer excels, showing an average boost of 19.39% in BLEU, 8.71% in ROUGE-L, and 34.03% in METEOR scores.

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

↑