CCRep:通过预训练代码模型和查询返回学习代码更改表示
CCRep: Learning Code Change Representations via Pre-Trained Code Model and Query Back
摘要:
将代码更改表示为数字特征向量,即,代码改变表示通常是使与代码改变相关的许多软件工程任务自动化的必要步骤,例如,提交消息生成和即时缺陷预测。直观地说,代码更改表示的质量对于自动化方法的有效性至关重要。以前的工作代码变化通常设计和评估代码变化表示方法的特定任务,很少有工作调查代码变化编码器,可以使用和联合训练的各种任务。为了填补这一空白,这项工作提出了一种新的代码更改表示学习方法命名为CCRep,它可以学习编码的代码更改为不同的下游任务的特征向量。CCRep将代码变更看作是变更前后代码的组合,利用预先训练好的代码模型获取高质量的代码上下文嵌入,并使用一种新的查询机制对变更后的代码片段进行提取和编码,使其与整个代码变更显式交互。为了评估CCRep并证明其适用于不同的代码更改相关的任务,我们将其应用到三个任务:提交消息生成,补丁正确性评估和及时的缺陷预测。实验结果表明,CCRep优于国家的最先进的技术在每个任务。
英文摘要:
Representing code changes as numeric feature vectors, i.e., code change representations, is usually an essential step to automate many software engineering tasks related to code changes, e.g., commit message generation and just-in-time defect prediction. Intuitively, the quality of code change representations is crucial for the effectiveness of automated approaches. Prior work on code changes usually designs and evaluates code change representation approaches for a specific task, and little work has investigated code change encoders that can be used and jointly trained on various tasks. To fill this gap, this work proposes a novel Code Change Representation learning approach named CCRep, which can learn to encode code changes as feature vectors for diverse downstream tasks. Specifically, CCRep regards a code change as the combination of its before-change and after-change code, leverages a pre-trained code model to obtain high-quality contextual embeddings of code, and uses a novel mechanism named query back to extract and encode the changed code fragments and make them explicitly interact with the whole code change. To evaluate CCRep and demonstrate its applicability to diverse code-change-related tasks, we apply it to three tasks: commit message generation, patch correctness assessment, and just-in-time defect prediction. Experimental results show that CCRep outperforms the state-of-the-art techniques on each task.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。