DeepDebug:使用堆栈跟踪、反向翻译和代码编译器修复Python错误
DeepDebug: Fixing Python Bugs Using Stack Traces, Backtranslation, and Code Skeletons
摘要:
缺陷定位和程序修复的联合任务是软件开发过程中不可或缺的一部分。在这项工作中,我们提出了Deepcraft,一种使用大型预训练Transformers进行自动调试的方法。我们首先在反向提交数据上训练一个错误创建模型,以生成合成错误。我们把这些合成的虫子应用到两个方面。首先,我们直接对来自20万存储库的所有函数进行反向翻译模型的训练。接下来,我们将关注10K存储库,我们可以对这些存储库执行测试,并在这些存储库中创建通过测试的所有函数的错误版本。这为我们提供了丰富的调试信息,如堆栈跟踪和打印语句,我们使用这些信息来微调我们在原始源代码上预训练的模型。最后,我们通过将上下文窗口扩展到有缺陷的函数本身之外,并添加由该函数的父类、导入、签名、文档字符串和方法体(按优先级顺序)组成的骨架来增强所有模型。在菜Bugs基准测试中,我们将发现的修复总数增加了50%以上,同时将误报率从35%降低到5%,并将超时时间从6小时减少到1分钟。在我们自己的可执行测试基准上,我们的模型在不使用跟踪的情况下第一次尝试就修复了68%的错误,在添加跟踪后,它在第一次尝试时修复了75%的错误。我们将开源我们的框架和验证集,用于评估可执行测试。
英文摘要:
The joint task of bug localization and program repair is an integral part of the software development process. In this work we present DeepDebug, an approach to automated debugging using large, pretrained transformers. We begin by training a bug-creation model on reversed commit data for the purpose of generating synthetic bugs. We apply these synthetic bugs toward two ends. First, we directly train a backtranslation model on all functions from 200K repositories. Next, we focus on 10K repositories for which we can execute tests, and create buggy versions of all functions in those repositories that are covered by passing tests. This provides us with rich debugging information such as stack traces and print statements, which we use to finetune our model which was pretrained on raw source code. Finally, we strengthen all our models by expanding the context window beyond the buggy function itself, and adding a skeleton consisting of that function's parent class, imports, signatures, docstrings, and method bodies, in order of priority. On the QuixBugs benchmark, we increase the total number of fixes found by over 50%, while also decreasing the false positive rate from 35% to 5% and decreasing the timeout from six hours to one minute. On our own benchmark of executable tests, our model fixes 68% of all bugs on its first attempt without using traces, and after adding traces it fixes 75% on first attempt. We will open-source our framework and validation set for evaluating on executable tests.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。