Skip to main content
QUICK REVIEW

[论文解读] RLocator: Reinforcement Learning for Bug Localization

Partha Sarathi Chakraborty, Mahmoud Alfadel|arXiv (Cornell University)|May 9, 2023
Software Engineering ResearchComputer Science被引用 3
一句话总结

RLocator 是一种基于强化学习的方法,将软件错误定位问题建模为马尔可夫决策过程(MDP),以直接优化 MRR 和 MAP 等排名评估指标。该方法在 8,316 个 Apache 错误报告的基准测试中达到最先进性能,相较于 FLIM 和 BugLocator,MAP 提升 38.3%,MRR 提升 36.73%,Top K 提升 23.68%。

ABSTRACT

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.

研究动机与目标

  • 解决先前错误定位方法间接优化相似度度量而非实际评估指标(如 MRR 和 MAP)的局限性。
  • 通过使用强化学习直接优化基于排名的评估指标,提升软件错误定位性能。
  • 证明直接优化评估指标相较于基于相似度的学习方法可带来显著的性能提升。
  • 在来自六个 Apache 项目的 8,316 个真实世界错误报告的大规模基准上验证 RLocator 的有效性。

提出的方法

  • 将错误定位任务建模为马尔可夫决策过程(MDP),其中每个状态代表一个候选源代码文件,动作对应于选择或拒绝文件。
  • 使用 MRR 和 MAP 作为密集的强化学习奖励,引导智能体做出最优的文件排序决策。
  • 采用带熵正则化的优势行动-评论者(A2C)算法,以稳定训练并提升探索能力。
  • 使用 CodeBERT 嵌入表示对错误报告和源代码文件进行端到端训练,以计算相似度得分。
  • 应用 XGBoost 模型过滤低置信度预测,以减少错误定位,代价是排除 9% 的数据集。
  • 采用奖励塑造机制,根据最终排序位置对错误排序进行惩罚,对正确排序进行奖励。
Figure 1: Sample bug report.
Figure 1: Sample bug report.

实验结果

研究问题

  • RQ1与基于相似度的间接训练相比,直接优化 MRR 和 MAP 等排名评估指标是否能提升软件错误定位的性能?
  • RQ2RLocator 基于 MDP 的强化学习框架在排名有效性方面,相较于最先进的基于相似度的方法(如 FLIM 和 BugLocator)表现如何?
  • RQ3排除 9% 的低置信度错误报告对 RLocator 整体性能和鲁棒性有何影响?
  • RQ4在 A2C 算法中使用熵正则化是否能提升模型在多样化 Apache 项目中的泛化能力和性能?

主要发现

  • 在全部六个 Apache 项目中,RLocator 的平均倒数排名(MRR)为 0.62,平均平均精度(MAP)为 0.59,Top 1 得分为 0.46。
  • 在数据集的 91% 子集中,RLocator 在 MAP 上相比 FLIM 提升 38.3%,在 MRR 上提升 36.73%,在 Top K 上提升 23.68%。
  • 在完整 100% 数据集上评估时,RLocator 在六个项目中的四个项目中 MAP 表现优于 FLIM,在两个项目中 MRR 表现更优。
  • 性能提升在包括 AspectJ、Birt 和 Eclipse Platform UI 在内的多样化 Apache 项目中保持一致,表明其具有强大的泛化能力。
  • 基于 XGBoost 的过滤机制有效减少了错误预测,且对整体性能影响较小,因为完整数据上的下限仍可忽略。
  • 在 A2C 算法中使用熵正则化提升了训练稳定性,并有助于在不同项目间实现更好的泛化。
Figure 2: Bug Localization as Markov Decision Process.
Figure 2: Bug Localization as Markov Decision Process.

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。