Cross Domain Few-Shot Line-Level Defect Prediction in Open Software Development via Meta Learning
Abstract
Defect prediction tools are designed to assist practitioners in effectively prioritizing the risk files that are most likely to manifest software defects after release, with limited software quality assurance resources. It plays a vital role in code inspection activities. Currently, numerous automated defect prediction methods have been proposed to enhance the efficiency of code review and software quality. However, most previous methods often rely on a substantial number of labeled samples for training. Additionally, when confronted with tasks involving a broad domain span, these methods frequently struggle to effectively identify defective files and lines. To address this issue, we propose a model named DEF-Hunter for rapidly adapting to new file-level and line-level defect predictions when encountering new technical domains. DEF-Hunter consists of two components: defect identification component and transfer learning component. The defect identification component employs a hierarchical attention network to learn the hierarchical structure of the source code, capturing the surrounding code tokens and neighboring lines. It utilizes attention mechanisms to calculate risk scores for code tokens contributing to the prediction of defective files. The transfer learning component employs meta-learning to enhance the model's cross-domain generalization ability, achieving few-shot line-level defect prediction. The experimental results demonstrate that DEF-Hunter outperforms the state-of-the-art methods in both performance, cost-effectiveness and across metrics such as Balance Accuracy, AUC, MCC, and Recall@Top20%LOC, e.g., compared to state-of-the-art methods, DEF-Hunter improves the Balance Accuracy score by 29%, 29%, 17.49%, 7.32%, and 2.38%, respectively.
Department(s)
Information Technology and Cybersecurity
Document Type
Article
DOI
10.1109/TCE.2025.3572334
Keywords
deep learning, defect prediction, Software quality assurance, transfer learning
Publication Date
1-1-2025
Recommended Citation
Yang, Zhiguo; Li, Zhengdao; Guo, Shikai; Zhang, Lehuan; Li, Hui; Ning, Qiao; and Ma, Qian, "Cross Domain Few-Shot Line-Level Defect Prediction in Open Software Development via Meta Learning" (2025). Faculty Scholarship. 288.
https://bearworks.missouristate.edu/articles00/288
Journal Title
IEEE Transactions on Consumer Electronics