Skip to main content
QUICK REVIEW

[论文解读] Can we learn from developer mistakes? Learning to localize and repair real bugs from real bug fixes

Cedric Richter, Heike Wehrheim|arXiv (Cornell University)|Jul 1, 2022
Software Engineering Research被引用 8
一句话总结

本文提出 RealiT,一种预训练-微调框架,通过结合大规模代码变异体与真实世界的错误修复,提升神经模型在 Python 中定位和修复真实错误的能力。通过在比以往工作多 20 倍的变异体上进行预训练,并在 33,000 个真实错误修复上进行微调,RealiT 在真实错误上的定位性能近乎翻倍,同时保持或提升了修复准确率。

ABSTRACT

Real bug fixes found in open source repositories seem to be the perfect source for learning to localize and repair real bugs. However, the absence of large scale bug fix collections has made it difficult to effectively exploit real bug fixes in the training of larger neural models in the past. In contrast, artificial bugs -- produced by mutating existing source code -- can be easily obtained at a sufficient scale and are therefore often preferred in the training of existing approaches. Still, localization and repair models that are trained on artificial bugs usually underperform when faced with real bugs. This raises the question whether bug localization and repair models trained on real bug fixes are more effective in localizing and repairing real bugs. We address this question by introducing RealiT, a pre-train-and-fine-tune approach for effectively learning to localize and repair real bugs from real bug fixes. RealiT is first pre-trained on a large number of artificial bugs produced by traditional mutation operators and then fine-tuned on a smaller set of real bug fixes. Fine-tuning does not require any modifications of the learning algorithm and hence can be easily adopted in various training scenarios for bug localization or repair (even when real training data is scarce). In addition, we found that training on real bug fixes with RealiT is empirically powerful by nearly doubling the localization performance of an existing model on real bugs while maintaining or even improving the repair performance.

研究动机与目标

  • 探究在真实错误修复上进行训练是否能提升神经模型在定位和修复真实软件错误方面的性能。
  • 通过提出一种预训练-微调方法,将合成变异体与真实修复相结合,以应对真实错误修复数据集稀缺的问题。
  • 评估真实错误修复是否能提升模型在真实世界场景中的泛化能力,尤其是超越人工变异体的能力。
  • 证明真实修复数据的质量与数量在错误定位与修复任务中对模型性能具有显著影响。

提出的方法

  • RealiT 采用两阶段训练流程:首先在大规模代码变异体语料上进行预训练,这些变异体通过传统变异操作符生成。
  • 随后在较小但高质量的 33,000 个真实错误修复数据集上进行微调,这些数据来自公开的 Python 代码仓库。
  • 微调过程无需架构修改,可轻松集成到现有的错误定位与修复训练流程中。
  • 该方法支持对变异体预训练与真实修复微调的独立评估,便于进行消融研究。
  • 该方法在 PyPIBugs 基准上进行评估,该基准包含超过 2,000 个 Python 中的真实单标记错误。
  • 模型被训练用于定位和修复四种常见单标记错误类型:变量误用、操作符误用、比较误用和函数误用。

实验结果

研究问题

  • RQ1与仅在人工变异体上训练的模型相比,在真实错误修复上训练是否能显著提升神经模型在真实世界错误上的定位与修复性能?
  • RQ2预训练-微调策略是否能有效结合人工变异体的规模与真实错误修复的真实性,从而提升模型泛化能力?
  • RQ3真实错误修复的数量如何影响最终模型在定位和修复真实错误方面的性能?
  • RQ4在变异体上进行预训练是否为实现高性能所必需,还是仅在真实修复上进行微调即可满足性能需求?

主要发现

  • 与仅在变异体上训练的模型相比,RealiT 在真实错误上的成功定位数量近乎翻倍,显著提升了定位性能。
  • 在大量变异体上进行预训练的前提下,通过真实错误修复进行微调,能保持或提升修复性能。
  • 在大量变异体(最多比以往工作多 20 倍)上进行预训练的模型,在变异体和真实错误上均表现出显著更优的性能,凸显了训练数据规模的重要性。
  • 真实错误修复带来的性能增益具有显著的量化效果:真实修复越多,结果越好,即使少量子集也能优于仅使用变异体的训练。
  • RealiT 是首个成功修复 PyPIBugs 基准中显著比例错误的模型,证明了其在真实世界单标记错误上的有效性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。