journal article·2025-02-04Open access

LSTM Attention-Driven Similarity Learning for Effective Bug Localization

Geunseok Yang, Jinfeng Ji, Eontae Kim

Applied Sciences· Volume 15· Issue 3

Abstract

Objective: The complexity of software systems, with their multifaceted functionalities and intricate source code structures, poses significant challenges for developers in identifying and resolving bugs. This study aims to address these challenges by proposing an efficient bug localization method that improves the accuracy and effectiveness of identifying faulty code based on bug reports. Method: We introduce a novel bug localization approach that integrates a Long Short-Term Memory (LSTM) attention mechanism with top-K code similarity learning. The proposed method preprocesses bug reports and source code files, calculates top-K code similarities using the BM25 algorithm, and trains an LSTM-Attention model to predict the most relevant buggy source code files. Results: The model was evaluated on six open-source projects (Tomcat, AspectJ, Birt, Eclipse, JDT, SWT) and demonstrated significant improvements over the baseline method, DNNLoc. Notably, the proposed approach improved accuracy across all projects, with average gains of 18% in prediction accuracy compared to the baseline. Conclusion: This study highlights the efficacy of combining similarity learning with attention mechanisms for bug localization. By streamlining debugging workflows and enhancing predictive accuracy, the proposed method offers a practical solution for improving software quality and reducing development costs.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Software Engineering Research · Software Testing and Debugging Techniques · Computational Physics and Python Applications

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Department of Computer Applied Mathematics, Computer System Institute, Hankyong National University, Anseong-si 17579, Republic of Korea

Department of Computer Applied Mathematics, Hankyong National University, Anseong-si 17579, Republic of Korea

Department of Computer Engineering, Kyungnam University, Changwon-si 51767, Republic of Korea

Funding

Korea National University Development Project (2024) at Hankyong National University

References (44)

Show source-provided references
1. Huo, X., and Li, M. (2015, January 25–31). Enhancing the Unified Features to Locate Buggy Files by Exploiting the Sequential Nature of Source Code. Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI), Buenos Aires, Argentina.
2. Lam, A.N., Nguyen, A.T., Nguyen, H.A., and Nguyen, T.N. (2017, January 22–23). Bug Localization with Combination of Deep Learning and Information Retrieval. Proceedings of the IEEE/ACM 25th International Conference on Program Comprehension (ICPC), Buenos Aires, Argentina.10.1109/ICPC.2017.24 ↗
3. Ye, X., Bunescu, R., and Liu, C. (2014, January 16–21). Learning to Rank Relevant Files for Bug Reports Using Domain Knowledge. Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE), Hong Kong, China.10.1145/2635868.2635874 ↗
4. Zhou, J., Zhang, H., and Lo, D. (2012, January 2–9). Where Should the Bugs Be Fixed? More Accurate Information Retrieval-Based Bug Localization Based on Bug Reports. Proceedings of the 34th International Conference on Software Engineering (ICSE), Zurich, Switzerland.10.1109/ICSE.2012.6227210 ↗
5. Improved Bug Localization Based on Code Change Histories and Bug Reports10.1016/j.infsof.2016.11.002 ↗
6. Lam, A.N., Nguyen, A.T., Nguyen, H.A., and Nguyen, T.N. (2015, January 9–13). Combining Deep Learning with Information Retrieval to Localize Buggy Files for Bug Reports. Proceedings of the 30th IEEE/ACM International Conference on Automated Software Engineering (ASE), Lincoln, NE, USA.10.1109/ASE.2015.73 ↗
7. Dao, T., Zhang, L., and Meng, N. (2017, January 22–23). How Does Execution Information Help with Information-Retrieval Based Bug Localization?. Proceedings of the IEEE/ACM 25th International Conference on Program Comprehension (ICPC), Buenos Aires, Argentina.10.1109/ICPC.2017.29 ↗
8. Query Expansion Based on Crowd Knowledge for Code Search10.1109/TSC.2016.2560165 ↗
9. Lemos, O.A.L., de Paula, A.C., Zanichelli, F.C., and Lopes, C.V. (June, January 31). Thesaurus-Based Automatic Query Expansion for Interface-Driven Code Search. Proceedings of the 11th Working Conference on Mining Software Repositories (MSR), Hyderabad, India.
10. Lu, M., Sun, X., Wang, S., Lo, D., and Duan, Y. (2015, January 2–6). Query Expansion via WordNet for Effective Code Search. Proceedings of the IEEE 22nd International Conference on Software Analysis, Evolution and Reengineering (SANER), Montreal, QC, Canada.
11. Rahman, M.M., and Roy, C. (2018, January 23–29). Effective Reformulation of Query for Code Search Using Crowdsourced Knowledge and Extra-Large Data Analytics. Proceedings of the IEEE International Conference on Software Maintenance and Evolution (ICSME), Madrid, Spain.10.1109/ICSME.2018.00057 ↗
12. Kim, M., Kim, Y., and Lee, E. (2021, January 25–28). A Novel Automatic Query Expansion with Word Embedding for IR-Based Bug Localization. Proceedings of the IEEE 32nd International Symposium on Software Reliability Engineering (ISSRE), Wuhan, China.10.1109/ISSRE52982.2021.00038 ↗
13. Chaparro, O., Florez, J.M., and Marcus, A. (2017, January 17–22). Using Observed Behavior to Reformulate Queries During Text Retrieval-Based Bug Localization. Proceedings of the IEEE International Conference on Software Maintenance and Evolution (ICSME), Shanghai, China.10.1109/ICSME.2017.100 ↗
14. Rath, M., Lo, D., and Mäder, P. (June, January 27). Analyzing Requirements and Traceability Information to Improve Bug Localization. Proceedings of the 15th International Conference on Mining Software Repositories (MSR), Gothenburg, Sweden.
15. Sachdev, S., Li, H., Luan, S., Kim, S., Sen, K., and Chandra, S. (2018, January 18–22). Retrieval on Source Code: A Neural Code Search. Proceedings of the 2nd ACM SIGPLAN International Workshop on Machine Learning and Programming Languages, Philadelphia, PA, USA.10.1145/3211346.3211353 ↗
16. LaProb: A Label Propagation-Based Software Bug Localization Method10.1016/j.infsof.2020.106410 ↗
17. SBugLocater: Bug Localization Based on Deep Matching and Information Retrieval10.1155/2022/3987981 ↗
18. Haiduc, S., Bavota, G., Marcus, A., Oliveto, R., De Lucia, A., and Menzies, T. (2013, January 18–26). Automatic Query Reformulations for Text Retrieval in Software Engineering. Proceedings of the 35th International Conference on Software Engineering (ICSE), San Francisco, CA, USA.10.1109/ICSE.2013.6606630 ↗
19. Anh, B.T.M., and Luyen, N.V. (2021, January 6–9). An Imbalanced Deep Learning Model for Bug Localization. Proceedings of the 28th Asia-Pacific Software Engineering Conference Workshops (APSEC Workshops), Taipei, Taiwan.10.1109/APSECW53869.2021.00017 ↗
20. FineLocator: A Novel Approach to Method-Level Fine-Grained Bug Localization by Query Expansion10.1016/j.infsof.2019.03.001 ↗
21. Kim, M., and Lee, E. (2019, January 8–12). A Novel Approach to Automatic Query Reformulation for IR-Based Bug Localization. Proceedings of the 34th ACM/SIGAPP Symposium on Applied Computing, New York, NY, USA.10.1145/3297280.3297451 ↗
22. Le, T.D.B., Lo, D., Goues, C.L., and Grunske, L. (2016, January 18–20). A Learning-to-Rank Based Fault Localization Approach Using Likely Invariants. Proceedings of the 25th International Symposium on Software Testing and Analysis (ISSTA), Saarbrücken, Germany.10.1145/2931037.2931049 ↗
23. Enhancing Supervised Bug Localization with Metadata and Stack-Trace10.1007/s10115-019-01426-2 ↗
24. Koyuncu, A., Bissyandé, T.F., Kim, D., Liu, K., Klein, J., Monperrus, M., and Le Traon, Y. (2019). D&C: A Divide-and-Conquer Approach to IR-Based Bug Localization. arXiv.
25. Yuan, W., Qi, B., Sun, H., and Liu, X. (2020, January 1–4). DependLoc: A Dependency-Based Framework for Bug Localization. Proceedings of the 27th Asia-Pacific Software Engineering Conference (APSEC), Singapore.10.1109/APSEC51365.2020.00014 ↗
26. DreamLoc: A Deep Relevance Matching-Based Framework for Bug Localization10.1109/TR.2021.3104728 ↗
27. Where Should We Fix This Bug? A Two-Phase Recommendation Model10.1109/TSE.2013.24 ↗
28. Moser, R., Pedrycz, W., and Succi, G. (2008, January 10–18). A Comparative Analysis of the Efficiency of Change Metrics and Static Code Attributes for Defect Prediction. Proceedings of the 30th International Conference on Software Engineering (ICSE), Leipzig, Germany.10.1145/1368088.1368114 ↗
29. Rahman, M.M., and Roy, C.K. (2018, January 4–9). Improving IR-Based Bug Localization with Context-Aware Query Reformulation. Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE), Lake Buena Vista, FL, USA.10.1145/3236024.3236065 ↗
30. Cheng, S., Yan, X., and Khan, A.A. (2020, January 11–14). A Similarity Integration Method Based on Information Retrieval and Word Embedding in Bug Localization. Proceedings of the IEEE 20th International Conference on Software Quality, Reliability, and Security (QRS), Macau, China.10.1109/QRS51102.2020.00034 ↗
31. Wang, S., Liu, T., and Tan, L. (2016, January 14–22). Automatically Learning Semantic Features for Defect Prediction. Proceedings of the IEEE/ACM 38th International Conference on Software Engineering (ICSE), Austin, TX, USA.10.1145/2884781.2884804 ↗
32. A Deep Learning Model for Estimating Story Points10.1109/TSE.2018.2792473 ↗
33. Improving Bug Localization with Word Embedding and Enhanced Convolutional Neural Networks10.1016/j.infsof.2018.08.002 ↗
34. Deep Transfer Bug Localization10.1109/TSE.2019.2920771 ↗
35. Network-Clustered Multi-Modal Bug Localization10.1109/TSE.2018.2810892 ↗
36. Yang, Z., Shi, J., Wang, S., and Lo, D. (2021, January 15–19). IncBL: Incremental Bug Localization. Proceedings of the 36th IEEE/ACM International Conference on Automated Software Engineering (ASE), Melbourne, Australia.10.1109/ASE51524.2021.9678546 ↗
37. PathIdea: Improving Information Retrieval-Based Bug Localization by Reconstructing Execution Paths Using Logs10.1109/TSE.2021.3071473 ↗
38. (2023, January 23). Eclipse #423718. Available online: https://bugs.eclipse.org/bugs/show_bug.cgi?id=423718.
39. Kao, A., and Poteet, S.R. (2007). Natural Language Processing and Text Mining, Springer Science & Business Media.10.1007/978-1-84628-754-1 ↗
40. Binkley, D., Davis, M., Lawrie, D., and Morrell, C. (2009, January 17–19). To CamelCase or Under_Score. Proceedings of the IEEE 17th International Conference on Program Comprehension (ICPC), Vancouver, BC, USA.10.1109/ICPC.2009.5090039 ↗
41. Whissell, J.S., and Clarke, C.L.A. (November, January 27). Effective Measures for Inter-Document Similarity. Proceedings of the 22nd ACM International Conference on Information and Knowledge Management (CIKM), San Francisco, CA, USA.
42. Moravvej, S.V., Mousavirad, S.J., Moghadam, M.H.H., and Saadatmand, M. (2021, January 8–12). An LSTM-Based Plagiarism Detection via Attention Mechanism and a Population-Based Approach for Pre-Training Parameters with Imbalanced Classes. Proceedings of the International Conference on Neural Information Processing (ICONIP), Sanur, Indonesia.10.1007/978-3-030-92238-2_57 ↗
43. Gravetter, F.J., and Wallnau, L.B. (2014). Introduction to the t Statistic. Essentials of Statistics for the Behavioral Sciences, Cengage Learning. [8th ed.].
44. Woolson, R.F. (2007). Wilcoxon Signed-Rank Test. Wiley Encyclopedia of Clinical Trials, Wiley.10.1002/9780471462422.eoct979 ↗