MulLog: A Software Defect Prediction Approach Based on Multi-label Contrastive Learning and Line Property Graph Learning
摘要
Software defect prediction models assist developers in optimizing the allocation of testing resources by pinpointing source code modules that are prone to defects. Abstract Syntax Tree (AST) is widely used in defect prediction due to its ability to capture syntactic rules of source code. However, previous research has three main limitations: numerous AST nodes consuming many resources, AST not explicitly representing semantics, and a lack of fine-grained defect prediction approaches. To alleviate these limitations, we propose MulLog, a novel software defect prediction approach. In short, MulLog models a source code file as a collection of multi-label nodes and a Line Property Graph (LPG). It then employs a combined approach of multi-label contrastive learning and Line Property Graph learning to extract fine-grained syntactic and semantic information at the code line level, thereby identifying defective code lines and files. We conducted extensive experiments on file-level and line-level defect prediction tasks in both cross-project and within-project validation settings. The evaluation results indicate that our approach outperforms the state-of-the-art techniques across 32 versions of 9 software projects.