[Paper Review] RLocator: Reinforcement Learning for Bug Localization
RLocator is a reinforcement learning-based approach that formulates software bug localization as a Markov Decision Process (MDP) to directly optimize ranking evaluation metrics like MRR and MAP. It achieves state-of-the-art performance, outperforming FLIM and BugLocator by 38.3% in MAP, 36.73% in MRR, and 23.68% in Top K on a benchmark of 8,316 Apache bug reports.
Software developers spend a significant portion of time fixing bugs in their projects. To streamline this process, bug localization approaches have been proposed to identify the source code files that are likely responsible for a particular bug. Prior work proposed several similarity-based machine-learning techniques for bug localization. Despite significant advances in these techniques, they do not directly optimize the evaluation measures. We argue that directly optimizing evaluation measures can positively contribute to the performance of bug localization approaches. Therefore, In this paper, we utilize Reinforcement Learning (RL) techniques to directly optimize the ranking metrics. We propose RLocator, a Reinforcement Learning-based bug localization approach. We formulate RLocator using a Markov Decision Process (MDP) to optimize the evaluation measures directly. We present the technique and experimentally evaluate it based on a benchmark dataset of 8,316 bug reports from six highly popular Apache projects. The results of our evaluation reveal that RLocator achieves a Mean Reciprocal Rank (MRR) of 0.62, a Mean Average Precision (MAP) of 0.59, and a Top 1 score of 0.46. We compare RLocator with two state-of-the-art bug localization tools, FLIM and BugLocator. Our evaluation reveals that RLocator outperforms both approaches by a substantial margin, with improvements of 38.3% in MAP, 36.73% in MRR, and 23.68% in the Top K metric. These findings highlight that directly optimizing evaluation measures considerably contributes to performance improvement of the bug localization problem.
Motivation & Objective
- To address the limitation of prior bug localization methods that optimize similarity metrics indirectly rather than the actual evaluation metrics like MRR and MAP.
- To improve the performance of software bug localization by directly optimizing ranking-based evaluation measures using reinforcement learning.
- To demonstrate that direct optimization of evaluation metrics leads to significant performance gains over similarity-based learning approaches.
- To validate the effectiveness of RLocator on a large-scale benchmark of 8,316 real-world bug reports from six Apache projects.
Proposed method
- Formulate the bug localization task as a Markov Decision Process (MDP), where each state represents a candidate source code file and actions correspond to selecting or rejecting files.
- Use MRR and MAP as dense reinforcement learning rewards to guide the agent toward optimal file ranking decisions.
- Employ the Advantage Actor-Critic (A2C) algorithm with entropy regularization to stabilize training and improve exploration.
- Train the model end-to-end using CodeBERT embeddings for both bug reports and source code files to compute similarity scores.
- Apply a XGBoost model to filter out low-confidence predictions, reducing incorrect localizations at the cost of excluding 9% of the dataset.
- Use a reward shaping mechanism that penalizes incorrect rankings and rewards correct ones based on the final ranking position.

Experimental results
Research questions
- RQ1Can direct optimization of ranking evaluation metrics such as MRR and MAP improve the performance of software bug localization compared to indirect similarity-based training?
- RQ2How does RLocator’s MDP-based reinforcement learning framework compare to state-of-the-art similarity-based approaches like FLIM and BugLocator in terms of ranking effectiveness?
- RQ3What is the impact of excluding 9% of low-confidence bug reports on the overall performance and robustness of RLocator?
- RQ4Does the use of entropy regularization in the A2C algorithm improve generalization and performance on diverse Apache projects?
Key findings
- RLocator achieves a Mean Reciprocal Rank (MRR) of 0.62, a Mean Average Precision (MAP) of 0.59, and a Top 1 score of 0.46 across all six Apache projects.
- On the 91% subset of the dataset, RLocator outperforms FLIM by 38.3% in MAP, 36.73% in MRR, and 23.68% in Top K.
- When evaluated on the full 100% dataset, RLocator surpasses FLIM in four out of six projects for MAP and two out of six for MRR.
- The performance gain is consistent across diverse Apache projects, including AspectJ, Birt, and Eclipse Platform UI, indicating strong generalization.
- The XGBoost-based filtering mechanism reduces incorrect predictions without significantly affecting overall performance, as the lower bound on full data remains negligible.
- The use of entropy regularization in the A2C algorithm improves training stability and contributes to better generalization across projects.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.