paperbot · PL 论文追踪

全部论文 待读 收藏

P2 CCRep: Learning Code Change Representations via Pre-Trained Code Model and Query Back

CCRep:基于预训练代码模型与 Query Back 的代码变更表示学习
ICSE 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)2023匹配度 2/10 · 该论文关注代码变更表示学习,使用预训练代码模型和 query back 机制服务于提交信息生成等软件工程任务,与静态分析、形式化验证、浮点/贝叶斯程序分析以及 LLM/Agent 用于改进静态分析等核心方向无关,仅属于 PL+AI 的宽泛交叉。引用 33 inbox
Zhongxin Liu, Zhijie Tang, Xin Xia, Xiaohu Yang
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 CCRep,用预训练代码模型与 query back 机制学习通用代码变更表示,在三个下游任务上均超越 SOTA。

代码变更表示(将代码变更编码为数值特征向量)是提交信息生成、即时缺陷预测等众多代码变更相关自动化任务的关键步骤,其质量直接影响下游效果。然而已有工作通常针对单一任务设计并评估变更表示方法,鲜有研究探索可跨多任务复用与联合训练的通用代码变更编码器。为填补这一空白,本文提出 CCRep:它将代码变更视为变更前与变更后代码的组合,利用预训练代码模型获取高质量的代码上下文嵌入,并通过一种新的 query back 机制提取并编码发生变更的代码片段,使其与整个代码变更显式交互。作者将 CCRep 应用于提交信息生成、补丁正确性评估和即时缺陷预测三个任务进行验证,实验结果表明 CCRep 在各项任务上均优于现有最先进技术,体现了其跨任务适用性。

问题
已有代码变更表示方法多针对特定任务定制,缺乏可跨多种代码变更相关任务复用并联合训练的通用变更编码器。
方法
将代码变更建模为变更前代码与变更后代码的组合,借助预训练代码模型获得上下文嵌入,并用 query back 机制提取变更代码片段、使其与整体代码变更显式交互。
评估
在提交信息生成、补丁正确性评估和即时缺陷预测三个下游任务上,与各任务的最先进技术进行对比实验,CCRep 在每项任务上均取得更优结果。
原文摘要(Abstract)

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.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{abs-2302-03924,
  title = {CCRep: Learning Code Change Representations via Pre-Trained Code Model and Query Back},
  author = {Zhongxin Liu and Zhijie Tang and Xin Xia and Xiaohu Yang},
  booktitle = {ICSE},
  year = {2023},
  doi = {10.1109/icse48619.2023.00014}
}