Supporting Cross-language Cross-project Bug Localization Using Pre-trained Language Models

Supporting Cross-language Cross-project Bug Localization Using Pre-trained Language Models

Mahinthan Chandramohan, Dai Nguyen, Padmanabhan Krishnan, Jovan Jancic

23 June 2024

Automatically locating a bug within a large codebase remains a significant challenge for developers. Existing techniques often struggle with generalizability and deployment due to their reliance on application-specific data and large model sizes. This paper proposes a novel pre-trained language model (PLM) based technique for bug localization that transcends project and language boundaries. Our approach leverages contrastive learning to enhance the representation of bug reports and source code. It then utilizes a novel ranking approach that combines commit messages and code segments. Additionally, we introduce a knowledge distillation technique that reduces model size for practical deployment without compromising performance. This paper presents several key benefits. By incorporating code segment and commit message analysis alongside traditional file-level examination, our technique achieves better bug localization accuracy. Furthermore, our model excels at generalizability – trained on code from various projects and languages, it can effectively identify bugs in unseen codebases. To address computational limitations, we propose a CPU-compatible solution. Our approach demonstrates great performance. On average, there is a 73-80% chance of identifying at least one correct bug location within the top 10 results for cross-language scenarios, and a 55-87% chance for cross-projects scenarios. Notably, this is achieved without fine-tuning the model on the specific datasets evaluated. The proposed fine-tuning and ranking algorithms significantly outperform off-the-shelf PLMs for bug localization. Finally, our distillation technique achieves performance comparable to the original model while offering a 4x reduction in embedding generation time. In essence, this work presents a highly effective, generalizable, and efficient bug localization technique with the potential to real-world deployment.


Venue : ArXiv

File Name : Supporting_Bug_Localization_Using_Pre_trained_Language_Models_finalv4.pdf