Software Defect Prediction under Label Scarcity: A Few-Shot Prototypical Learning and Adaptive Fusion Method
Main Article Content
Keywords
prototypical networks, software defect prediction, few-shot learning, supervised contrastive learning, adaptive fusion.
Abstract
Software defect prediction is a core means of software quality assurance and can reduce operation and maintenance costs by allocating testing resources in advance. However, in early project stages and cross-organizational reuse scenarios, defect labels are commonly scarce and classes are highly imbalanced. Most existing defect prediction methods assume sufficient training labels. Fixed model strategies have difficulty adapting to different label budgets, and evaluation based on random splitting can produce optimistic bias because duplicated samples leak across data subsets. This study proposes ProtoStar, a software defect prediction framework for label-scarce settings. Its core is a few-shot prototype engine that jointly trains with focal loss and supervised contrastive loss. The framework combines this engine with a label-budget-adaptive fusion mechanism selected through out-of-fold validation and an honest evaluation pipeline based on deduplicated grouped splitting, thereby achieving robust defect-risk ranking at low labeling cost. Systematic evaluation on 13 National Aeronautics and Space Administration Metrics Data Program (NASA MDP) datasets shows that the method significantly outperforms strong supervised baselines in k-shot few-shot and total-budget-constrained cold-start settings. Adaptive fusion effectively avoids ensemble overfitting. For cross-project prediction, the defect-hit enrichment among the top 20% high-risk modules reaches 1.28-1.76 times the base rate, providing a feasible technical approach to software quality assurance under limited labeling.
References
- [1]X. Tian, J. Chang, C. Zhang, et al., Survey of open-source software defect prediction method, Journal of Computer Research and Development 60 (7) (2023) 1467–1488 (in Chinese). https://doi.org/10.7544/issn1000-1239.202221046.
- [2]T. Menzies, J. Greenwald, A. Frank, Data mining static code attributes to learn defect predictors, IEEE Transactions on Software Engineering 33 (1) (2007) 2–13. https://doi.org/10.1109/TSE.2007.256941.
- [3]Y. Yang, X. Xia, D. Lo, J. Grundy, A survey on deep learning for software engineering, ACM Computing Surveys 54 (10s) (2022) Article 206. https://doi.org/10.1145/3505243.
- [4]S. Wang, T. Liu, J. Nam, L. Tan, Deep semantic feature learning for software defect prediction, IEEE Transactions on Software Engineering 46 (12) (2020) 1267–1293. https://doi.org/10.1109/TSE.2018.2877612.
- [5]T. Hall, S. Beecham, D. Bowes, D. Gray, S. Counsell, A systematic literature review on fault prediction performance in software engineering, IEEE Transactions on Software Engineering 38 (6) (2012) 1276–1304. https://doi.org/10.1109/TSE.2011.103.
- [6]S. Lessmann, B. Baesens, C. Mues, S. Pietsch, Benchmarking classification models for software defect prediction: a proposed framework and novel findings, IEEE Transactions on Software Engineering 34 (4) (2008) 485–496. https://doi.org/10.1109/TSE.2008.35.
- [7]B. Ghotra, S. McIntosh, A.E. Hassan, Revisiting the impact of classification techniques on the performance of defect prediction models, in: Proceedings of the 37th IEEE/ACM International Conference on Software Engineering (ICSE), 2015, pp. 789–800. https://doi.org/10.1109/ICSE.2015.91.
- [8]N.V. Chawla, K.W. Bowyer, L.O. Hall, W.P. Kegelmeyer, SMOTE: synthetic minority over-sampling technique, Journal of Artificial Intelligence Research 16 (2002) 321–357. https://doi.org/10.1613/jair.953.
- [9]S. Wang, X. Yao, Using class imbalance learning for software defect prediction, IEEE Transactions on Reliability 62 (2) (2013) 434–443. https://doi.org/10.1109/TR.2013.2259203.
- [10]K.E. Bennin, J. Keung, P. Phannachitta, A. Monden, S. Mensah, MAHAKIL: diversity based oversampling approach to alleviate the class imbalance issue in software defect prediction, IEEE Transactions on Software Engineering 44 (6) (2018) 534–550. https://doi.org/10.1109/TSE.2017.2731766.
- [11]T.-Y. Lin, P. Goyal, R. Girshick, K. He, P. Dollár, Focal loss for dense object detection, in: Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2017, pp. 2999–3007. https://doi.org/10.1109/ICCV.2017.324.
- [12]J. Snell, K. Swersky, R.S. Zemel, Prototypical networks for few-shot learning, in: Advances in Neural Information Processing Systems (NeurIPS), Vol. 30, 2017, pp. 4077–4087.
- [13]P. Khosla, B. Teterwak, C. Wang, et al., Supervised contrastive learning, in: Advances in Neural Information Processing Systems (NeurIPS), Vol. 33, 2020, pp. 18661–18673.
- [14]A. Wang, Y. Zhang, H. Wu, K. Jiang, M. Wang, Few-shot learning based balanced distribution adaptation for heterogeneous defect prediction, IEEE Access 8 (2020) 32989–33001. https://doi.org/10.1109/ACCESS.2020.2973924.
- [15]S. Pal, A. Sillitti, Cross-project defect prediction: a literature review, IEEE Access 10 (2022) 118697–118717. https://doi.org/10.1109/ACCESS.2022.3221184.
- [16]Y. Kamei, E. Shihab, B. Adams, et al., A large-scale empirical study of just-in-time quality assurance, IEEE Transactions on Software Engineering 39 (6) (2013) 757–773. https://doi.org/10.1109/TSE.2012.70.
- [17]J. Nam, S.J. Pan, S. Kim, Transfer defect learning, in: Proceedings of the 35th International Conference on Software Engineering (ICSE), 2013, pp. 382–391. https://doi.org/10.1109/ICSE.2013.6606584.
- [18]T. Zimmermann, N. Nagappan, H. Gall, E. Giger, B. Murphy, Cross-project defect prediction: a large scale experiment on data vs. domain vs. process, in: Proceedings of the 7th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering (ESEC/FSE), 2009, pp. 91–100. https://doi.org/10.1145/1595696.1595713.
- [19]B. Turhan, T. Menzies, A.B. Bener, J. Di Stefano, On the relative value of cross-company and within-company data for defect prediction, Empirical Software Engineering 14 (5) (2009) 540–578. https://doi.org/10.1007/s10664-008-9103-7.
- [20]M. Shepperd, Q. Song, Z. Sun, C. Mair, Data quality: some comments on the NASA software defect data sets, IEEE Transactions on Software Engineering 39 (9) (2013) 1208–1215. https://doi.org/10.1109/TSE.2013.11.
- [21]C. Tantithamthavorn, S. McIntosh, A.E. Hassan, K. Matsumoto, An empirical comparison of model validation techniques for defect prediction models, IEEE Transactions on Software Engineering 43 (1) (2017) 1–18. https://doi.org/10.1109/TSE.2016.2584050.
