融合代码变更与提交信息,提升早期缺陷预测准确率
Just-In-Time Software Defect Prediction via Bi-modal Change Representation Learning
- 构建双模态预训练模型,同时学习代码改动和提交信息语义
- 在27,391个代码变更上训练,F1分数比现有方法高10.8%
- 适合关注代码质量与自动化检测的研究者和开发者
为实现早期软件缺陷预测,研究者提出了即时缺陷预测(JIT-DP),旨在识别代码提交中的潜在缺陷。现有方法仅学习源码的修改内容,忽略了提交背后的自然语言意图,限制了深层语义捕捉能力。为此,我们提出一种新的双模态变更预训练模型BiCC-BERT,该模型在代码变更语料库上预训练,学习双模态语义表示。为引入提交信息,设计了新的预训练目标——替换消息识别(RMI),以学习提交消息与代码变更之间的语义关联。随后,将BiCC-BERT集成到JIT-DP中,提出新方法JIT-BiCC。通过利用BiCC-BERT的双模态表示,JIT-BiCC能更深入地捕捉变更语义。我们在27,391个代码变更上训练JIT-BiCC,并与8种前沿的JIT-DP方法对比。结果表明,JIT-BiCC超越所有基线,F1分数提升10.8%,验证了其在学习双模态语义方面的有效性。
原文摘要 · Abstract (English)
For predicting software defects at an early stage, researchers have proposed just-in-time defect prediction (JIT-DP) to identify potential defects in code commits. The prevailing approaches train models to represent code changes in history commits and utilize the learned representations to predict the presence of defects in the latest commit. However, existing models merely learn editions in source code, without considering the natural language intentions behind the changes. This limitation hinders their ability to capture deeper semantics. To address this, we introduce a novel bi-modal change pre-training model called BiCC-BERT. BiCC-BERT is pre-trained on a code change corpus to learn bi-modal semantic representations. To incorporate commit messages from the corpus, we design a novel pre-training objective called Replaced Message Identification (RMI), which learns the semantic association between commit messages and code changes. Subsequently, we integrate BiCC-BERT into JIT-DP and propose a new defect prediction approach -- JIT-BiCC. By leveraging the bi-modal representations from BiCC-BERT, JIT-BiCC captures more profound change semantics. We train JIT-BiCC using 27,391 code changes and compare its performance with 8 state-of-the-art JIT-DP approaches. The results demonstrate that JIT-BiCC outperforms all baselines, achieving a 10.8% improvement in F1-score. This highlights its effectiveness in learning the bi-modal semantics for JIT-DP.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。