# LSTM Attention-Driven Similarity Learning for Effective Bug Localization
## 7 Conclusions  
As software systems grow in complexity, the number of source code files increases, making the process of manually identifying buggy files based on bug reports more time-consuming and error-prone. Efficiently localizing bugs is crucial for improving software quality and enhancing developer productivity. Automated bug localization systems can assist developers by predicting the most relevant buggy source code files, reducing debugging time and effort. To address this challenge, this study proposed a bug localization model that integrates LSTM-Attention with top-K code similarity learning to improve the accuracy and efficiency of buggy file prediction.  
The proposed approach preprocesses bug reports and program source code files, then retrieves the top-K most relevant source code files using the BM25 ranking algorithm. These candidate files are then input into an LSTM-Attention model, which learns relationships between bug reports and source code to refine the prediction of buggy files. By integrating information retrieval (IR) techniques with deep learning, the proposed method leverages textual similarity and contextual learning to enhance bug localization accuracy.  
Experimental results show that the proposed model outperforms existing baseline methods, including DNNLoc, Learn-to-Rank (LR), BugLocator (BL), and Naive Bayes (NB). Specifically, the proposed method achieved an average accuracy of 79.09% across six open-source projects (Tomcat, AspectJ, Birt, Eclipse, JDT, and SWT), representing a performance improvement of approximately 17.54% over the baseline DNNLoc. Additionally, the Mean Reciprocal Rank (MRR) and Mean Average Precision (MAP) improved by 0.22 and 0.26, respectively, indicating that the proposed model consistently ranks correct buggy files higher in the recommendation list.  
Statistical validation confirmed that the observed improvements were statistically significant, with \(p\)-values lower than 0.05 for all comparisons between the proposed model and baselines. These results provide strong evidence that integrating top-K code similarity learning with LSTM-Attention improves bug localization accuracy, ranking effectiveness, and retrieval precision.  
Despite its strong performance, the model's generalizability remains a key area for further research. Since the experiments were conducted on six open-source projects, future work will focus on validating the model across a wider range of software repositories to ensure its applicability to different domains. Additionally, incorporating additional contextual features, such as commit history, developer annotations, and code modification frequency, could further enhance the model's ability to predict buggy files with greater accuracy.  
Future research will also explore automatic hyperparameter tuning techniques to optimize the LSTM-Attention model for different software projects. By dynamically adjusting hyperparameters based on dataset characteristics, the model's adaptability and effectiveness can be improved.  
In conclusion, the proposed LSTM-Attention-based bug localization model with top-K code similarity learning significantly improves buggy file prediction accuracy compared with existing methods. By effectively combining information retrieval techniques with deep learn ing, this approach represents a promising direction for enhancing automated bug localization, thereby improving software maintenance efficiency and reducing debugging effort.  
Software, J.J. and E.K.; Writing--review & editing, G.Y. All authors have read and agreed to the published version of the manuscript.  
This research was funded by the Korea National University Development Project (2024) at Hankyong National University.  
Not applicable.  
The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author.  
This research was supported by Hankyong National University Korea National University Development Project (2024).  
The authors declare no conflict of interest.