SpecNLP: A Pre-trained Model Enhanced with Spectrum Profile for Bug Localization
Mahdi Farzandway, Fatemeh Ghassemi · 2024
Spectrum-based fault localization approaches utilize the statistical information about the execution of test cases to rank statements denoting the most specious ones leading to the failure of test cases. We propose a new approach for software fault localization called SpecNLP, which combines natural language processing (NLP) techniques with spectrum-based fault localization (SBFL). SpecNLP uses a pre-trained NLP model called CodeBERT to extract semantic features. These features together with spectrum information from test executions are fed into a multi-layer perceptron (MLP) to predict the start and end locations of bugs. The key innovation is the integration of SBFL execution test cases with CodeBERT code embeddings, enabling more accurate bug localization. SpecNLP outperforms previous ML and NLP methods on the Codeflaws benchmark. On the key Top-N metric, SpecNLP achieves 31.9% accuracy on Top-1 predictions versus 5.4% for SBFL techniques. The results demonstrate that SpecNLP outperforms previous methods on a benchmark and achieves higher accuracy in predicting fault locations.