Bug localization is a labor-intensive task, particularly in large software systems. When abnormal behavior occurs, developers must perform repetitive and time-consuming steps to identify faulty files. Previous studies have mainly focused on single-objective localization methods, many of which are limited to specific programming languages. In addition, relying solely on lexical similarity between source code and bug reports is often insufficient due to the natural language nature of bug descriptions. In this study, we propose a class-level automated multi-objective search-based system to identify and rank potentially buggy classes from bug reports. The main objective is to maximize similarity while minimizing the number of suggested faulty files. The evolutionary optimization algorithm SPEA-2 was applied to six open-source Java projects comprising more than 22,000 bug reports. The proposed approach was evaluated against two widely used algorithms, NSGA-II and MOEA/D. Results indicate that SPEA-2 achieved higher precision and recall than both multi-objective and single-objective baseline methods. The proposed recommender system successfully identified buggy classes or files for 88.5% of bug reports within the top 10 recommendations and 94% within the top 20. The effectiveness of the model was further validated on an industrial Android project written in Kotlin, demonstrating its adaptability across programming languages.
Figures & tables
Figure 1: An Eclipse Bug Report Example (ID 378535)
Figure 2: A snippet extracted from the StackRenderer class
Figure 3: Specification for the API
Author and Reference
Year
Algorithm
Technique
Dataset
Saha et al. [ 8 ]
2013
BLUiR (Bug Localization Using Information Retrieval )
Information Retrieval
Four Eclipse open source datasets [ 9 ]
Pandiyan et al. [ 10 ]
2015
Tabu Search Fault Localization with Path Branch and Bound (TSFL-PBB)
Search-based Software Engineering
2 UCI datasets
Rahman et al. [ 11 ]
2015
Improved Vector Space Model
Information Retrieval
ZXing, SWT, and Guava
Almhana et al. [ 1 ]
2016
NSGA-II
Search-based Software Engineering
Six open source datasets [ 7 ]
Lam et al. [ 42 ]
2017
DNNLOC (rVSM + DNN)
Combining IR with DNN
Six Benchmark datasets [ 7 ]
Xiao et al. [ 12 ]
2017
DeepLocator: Enchaned CNN using rTF-IDuF(Revised term frequency-user focused inverse document frequency)
Machine Learning
AspectJ, Eclipse, JDT, SWT and Tomcat projects
Table 1: Summary of Literature Review
Figure 4: An overview of the proposed multi-objective Search Recommendation System for bug reports
Figure 5: Flowchart of proposed SPEA-2 through opposition based learning
Figure 6: An example of vectors space model for text, each vocabulary word represents a dimension
Project Name
No. of Bug Reports
No. of files in project
No. of fixed classes per bug report
No. of API
SWT
4151
2056
3
161
AspectJ
593
4439
2
54
Tomcat
1056
1552
1
389
Birt
4178
6841
1
957
JDT
6274
8184
2
1329
Eclipse UI
6495
3464
2
1314
Table 2: Dataset Description
Figure 7: A code fragment written in XML programming language
Figure 8: A code fragment from class AdmissionActivity written in Kotlin programming language
Figure 9: Average Precision@10, Recall@10, and Accuracy@10 for NSGA-II, MOEA/D, and SPEA-2 on six open source java datasets listed in Table 2
Figure 10: Average Precision@10, Recall@10, and Accuracy@10 for NSGA-II and NSGA-II(Improved tokenization) on six open source java datasets listed in Table 2
k
NSGA-II
NSGA-II using proposed tokenization
Lexical similarity
History-based Similarity
MOEA/D
SPEA-2
5
76
83
67
68
75
86
10
72.5
80
60
60
72
82
15
65
71
57
51
69
76
20
61.4
68
48
47
64
71
Table 3: Precision@k
k
NSGA-II
NSGA-II using proposed tokenization
Lexical similarity
History-based Similarity
MOEA/D
SPEA-2
5
67
71
53
61
69.5
73
10
74
81
43
57
76
81
15
79.5
86
57
63
81.4
86.5
20
83
90
71
68
87
91.3
Table 4: Recall@k
k
NSGA-II
NSGA-II using proposed tokenization
Lexical similarity
History-based Similarity
MOEA/D
SPEA-2
5
61
65
49
32
62
68
10
74.4
85
72
63
83.5
88.5
15
82
92
81
70
90.8
91
20
87.3
95
86
69
92
94
Table 5: Accuracy@k
k
Precision
Recall
Accuracy
NSGA-II
MOEA /D
SPEA-2
NSGA-II
MOEA /D
SPEA-2
NSGA-II
MOEA /D
SPEA-2
5
42.9
39
44
18.8
17
20.4
42
39
45
10
50
47
53.5
43.8
41.3
46.2
64
62.5
67
15
52.7
49.5
56
62.5
59
65
72
67
74
20
44.5
41
48
75
71.8
78.2
84
75.3
88.5
Table 6: Results on Industrial Android project
Figure 11: Precision@10, Recall@10, and Accuracy@10 for Lexical similarity, history-based similarity, MOEA/D, and SPEA-2 on six open source java datasets listed in Table 2
Figure 12: Precision@10, Recall@10, and Accuracy@10 for NSGA-II (Improved version), MOEA/D, and SPEA-2 on Kotlin-based Industrial Android project
NSGA-II (Improved version)
SPEA-2
MOEA/D
Lexical similarity
History-based Similarity
2874
3410
3123
5982
6863
Table 7: Efficiency of proposed algorithms (Running Time in milliseconds)
We introduce C2C (From Codebase to Culprit), a framework for precise bug localization that progressively reduces the debugging search space across multiple levels of granularity: files, functions, and lines of code. To mirror developer's natural top-down debugging workflows, C2C integrates semantic retrieval and Hierarchical Reinforcement Learning (HRL) in a two-stage process. First, it performs recall-oriented retrieval of buggy candidates via semantic vector similarity search using bug-report text, including available stack-trace information, against a database of embeddings, where the embeddings are fine-tuned via contrastive learning with CodeBERT. Building on this reduced search space, the HRL framework incrementally localizes bugs, reasoning from files to functions and ultimately to individual lines of code. Unlike prior approaches which operate at a single granularity, C2C enables multi-resolution localization while maintaining contextual consistency across decisions. Experiments on real-world Java and Python datasets demonstrate that C2C improves retrieval precision and localization accuracy. Ablation studies further highlight the contributions of hierarchical decomposition, structured learning signals, and reward shaping in advancing multi-level bug localization.
Bug localization remains a key bottleneck for large language model (LLM)-based software maintenance, where accurately identifying faulty code is essential for debugging, root cause analysis, triage, and automated program repair (APR). File-level bug localization is especially critical in hierarchical localization and repair pipelines, where incorrect file selection can propagate to downstream stages such as function-level localization and patch generation. While Retrieval-Augmented Generation (RAG) offers a promising way to ground LLMs in repository context, existing RAG pipelines often rely on static retrieval and lack the reasoning needed to accurately identify faulty code. In this work, we present BLAgent, a novel agentic RAG framework for file-level bug localization that integrates three key ideas: (i) code structure-aware repository encoding with path-augmented AST-based chunking, (ii) dual-perspective query transformation that captures both structural and behavioral signals from bug reports, and (iii) two-phase agentic reranking that combines symbolic inspection with evidence-grounded reasoning. Unlike prior graph-based or multi-hop agentic approaches, BLAgent adopts a bounded reasoning strategy that limits LLM-based inspection and reranking to a compact, retrieval-filtered set of candidate files, avoiding open-ended repository traversal. This design balances localization accuracy with computational cost. On SWE-bench-Lite, BLAgent attains over 78% Top-1 accuracy with open-source models and over 86% with a closed-source model, while being over 18x cheaper than the strongest baseline using the same model. When integrated into an APR framework, BLAgent improves end-to-end repair success by up to 25%.
Md Afif Al Mamun, Gias Uddin
University of Calgary, Canada · York University, Canada
The rapid adoption of LLM-powered code generation has dramatically accelerated software development, yet effective verification methods remain severely underdeveloped. Existing bug localization techniques are either prohibitively expensive, requiring minutes of agentic reasoning and thousands of generated tokens per file, and/or operate at coarse function-level granularity unsuitable for precise debugging. While works that focus on line-level granularity and are more light-weight are often limited in their performance or context size. We introduce a novel line-level bug localization approach that addresses these limitations through three key contributions: (1) a token alignment algorithm that overcomes fundamental tokenization challenges in previous work, (2) a lightweight multi-task LLM for bug localization (MLC) enabling efficient line-level bug classification, and (3) an optimized training recipe for multi-line prediction. Our method achieves state-of-the-art performance among similar setups on line-level bug localization with full-file context. At the same time we reach comparable performance to agentic approaches on Defects4J and PypiBugs benchmarks while reducing inference latency by orders of magnitudes, requiring only a single generated token per file. We further demonstrate strong generalization by introducing and evaluating on a small out-of-domain evaluation datasets in Python. We will open source our code, models, and datasets upon acceptance.
Nikolai Rozanov
Department of Computing, Imperial College London, London, UK