Skip to Content
AlgorithmsAlgorithms
  • Article
  • Open Access

30 October 2026

31 Pages

Domain Adaptation for Cross-Project Defect Prediction via Transfer-Contrastive Learning with Large Language Models

,
,
,
,
and
1
Department of Computer Science, GC Women University Faisalabad, Faisalabad 38000, Pakistan
2
Department of Information Technology, GC University Faisalabad, Faisalabad 38000, Pakistan
3
Institute of Computer Science and Information Technology, The University of Agriculture, Peshawar 25000, Pakistan
4
School of Computing, Macquarie University, Sydney, NSW 2000, Australia

Abstract

Cross-project defect prediction (CPDP) is a significant solution in software defect prediction (SDP) when historical data is unavailable. In CPDP, the defect data of another project (called the source project) is used to train the model. Different training and test projects may have different feature distributions. Divergence in data distribution between source and target projects adversely affects prediction performance, and the semantic information of the tokens cannot be captured adequately. However, most of the existing deep learning approaches assume that these two projects have a uniform distribution, so the features extracted from these deep learning models are not optimal. Moreover, these approaches neglected the information about the class to which the sample belonged and were unable to discriminate the samples according to the class information. To address this issue, we proposed a framework, TC3, that exploits the combination of contrastive and transfer learning integrated with the CNN-CodeBERT model to learn class-discriminative information and obtain more transferable features for the target project. The proposed model was evaluated on PROMISE datasets. The proposed model achieved an absolute F1-score improvement of 0.047 to 0.107, corresponding to a relative improvement of 7.89% to 19.96%, and an absolute AUC improvement of 0.014 to 0.148, corresponding to a relative improvement of 2.18% to 29.19% as compared to the baseline methods.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.