Multi-Agent Hierarchical Selection Method for Fault Localization Based on the Integration of SBFL and Large Language Models
(School of Computer and Information Engineering, Shanghai Polytechnic University, Shanghai 201209, China)
Abstract
To improve the localization accuracy of traditional Spectrum-Based Fault Localization (SBFL), this paper proposes MA-AFLS, a fault localization method that integrates Large Language Models (LLMs) with a hierarchical selection mechanism. The method first applies SBFL to analyze test coverage information and obtain an initial ranking of suspicious code elements. It then introduces four levels of selection modules, namely file, class, method, and line, to guide the LLM in progressively narrowing the localization scope and achieving a transition from initial ranking to precise localization. Each module is dynamically adjusted and backtracked according to confidence scores, thereby optimizing candidate results and improving the stability and accuracy of fault identification. Experimental results on the Defects4J dataset show that MA-AFLS improves the Top-1 hit rate by 3.6 percentage points over traditional SBFL and achieves a Top-5 hit rate of 86.3%, demonstrating the effectiveness of the hierarchical selection mechanism that integrates SBFL with LLMs in automated fault localization tasks.
Keywords
fault localization; spectrum-based analysis; Large Language Model; hierarchical selection
References
- [1] SARHAN Q I,BESZÉDES Á. A Survey of Challenges in Spectrum-based Software Fault Localization [J].IEEE access,2022,10:10618-10639.
- [2] Xu Pengyu, Kuang Boyu, Su Ting, etc A review of automatic code repair based on big language models [J]. Computer Research and Development, 2025, 62 (8): 2040-2057
- [3] YANG A Z H,LE GOUES C,MARTINS R,et al. Large Language Models for Test-Free Fault Localization [C]//2024 IEEE/ACM 46th International Conference on Software Engineering(ICSE).Lisbon:IEEE,2024:165-176.
- [4] KANG S,AN G,YOO S. A Quantitative and Qualitative Evaluation of LLM-Based Explainable Fault Localization [J].Proceedings of the ACM on Software Engineering,2024:1424-1446.
- [5] Wang Haoren, Yue Lei, Li Jingwen, etc Software Defect Localization Technology Integrating Static Code Features and Spectrum [J]. Computer Application Research, 2023, 40 (9): 2785-2791
- [6] Zhang Zhan Research on key technologies of 3D reconstruction based on binocular vision [D]. Shenyang: Chinese Academy of Sciences University (Chinese Academy of Sciences Shenyang Institute of Computing Technology), 2019
- [7] CAMPOS J,RIBOIRA A,PEREZ A,et al. GZoltar: an Eclipse Plug-in for Testing and Debugging [C]//2012 Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering.Essen:IEEE,2012:378-381.
- [8] Huang Lihe The generation and response of "information cocoon" in generative artificial intelligence [J]. Library and Information Work, 2026, 70 (1): 94-103
- [9] QIN Y H,WANG S W,LOU Y L,et al. SoapFL: A Standard Operating Procedure for LLM-Based Method-Level Fault Localization [J].IEEE Transactions on Software Engineering,2025,51(4):1173-1187.
- [10] Liu Junpeng, Su Jinsong, Huang Degen Multi language neural machine translation integrating specific language adaptation modules [J]. Computer Science, 2022, 49 (1): 17-23
- [11] Zhou Changhao, Sun Jingchao Research on Misleading Information Detection Method Based on Illusion Elimination Large Model [J]. Computer Science and Exploration, 2026, 20 (2): 546-560
- [12] HUANG L,YU W J,MA W T,et al. A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questions [J].ACM Transactions on Information Systems,2025,43(2):1-55.
- [13] SOBREIRA V,DURIEUX T,MADEIRAL F,et al. Dissection of A Bug Dataset: Anatomy of 395 Patches from Defects4J [C]//2018 IEEE 25th International Conference on Software Analysis, Evolution and Reengineering(SANER).Campobasso:IEEE,2018:130-140.
- [14] LOU Y L,ZHU Q H,DONG J H,et al. 2021. Boosting Coverage-Based Fault Localization Via Graph-based Representation Learning [C]//29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering.New York:Association for Computing Machinery,2021:664-676.
- [15] Huang Mingxian Research on Key Technologies for Software Error Localization Based on Program Spectrum [D]. Hangzhou: Zhejiang University of Technology, 2017
- [16] Wang Haoren, Yue Lei, Li Jingwen, etc Software Defect Localization Technology Integrating Static Code Features and Spectrum [J]. Computer Application Research, 2023, 40 (9): 2785-2791
- [17] KANIEWSKI S,HOLSTEIN D,SCHMIDT F,at al. Vulnerability Handling of AI-Generated Code-Existing Solutions and Open Challenges [C]//2024 Conference on AI, Science, Engineering and Technology(AIxSET).Laguna Hills:[ Publisher unknown, 2024: 145-148
- [18] HE J D,TREUDE C,LO DAVID. LLM-Based Multi-Agent Systems for Software Engineering: Literature Review, Vision, and the Road Ahead. ACM Trans [J].ACM Transactions on Software Engineering and Methodology,2025,34(5):124.1-124.30.
About the authors
Peng Mingyue (1999-), female, Han ethnicity, from Linyi, Shandong, is currently pursuing a master's degree in programming and software engineering; Feng Junxiang (1999-), male, Han ethnicity, from Xinxiang, Henan Province, is currently pursuing a master's degree in computer technology.