通过学习执行具有外部资源描述的程序静态预测编译错误
Static Prediction of Runtime Errors by Learning to Execute Programs with External Resource Descriptions
摘要:
程序的执行行为通常依赖于外部资源,例如程序输入或文件内容,因此不能孤立地运行。然而,软件开发人员受益于快速迭代循环,其中自动化工具尽可能早地识别错误,甚至在程序可以编译和运行之前。这提出了一个有趣的机器学习挑战:我们能否在“静态”设置中预测运行时错误,在这种情况下,程序执行是不可能的?在这里,我们介绍了一个真实世界的数据集和预测运行时错误的任务,我们表明这对于像Transformers这样的通用模型是困难的。我们通过开发一个解释器启发的架构,模仿程序执行,模型异常处理和“学习执行”的描述外部资源的内容的归纳偏见,我们接近这个任务。令人惊讶的是,我们发现该模型也可以预测错误的位置,尽管只在指示错误的存在/不存在和类型的标签上进行训练。总之,我们提出了一个实际的和困难的,但可接近的挑战问题,学习程序执行,我们展示了有前途的新功能的解释器启发的机器学习模型的代码。
英文摘要:
The execution behavior of a program often depends on external resources, such as program inputs or file contents, and so cannot be run in isolation. Nevertheless, software developers benefit from fast iteration loops where automated tools identify errors as early as possible, even before programs can be compiled and run. This presents an interesting machine learning challenge: can we predict runtime errors in a "static" setting, where program execution is not possible? Here, we introduce a real-world dataset and task for predicting runtime errors, which we show is difficult for generic models like Transformers. We approach this task by developing an interpreter-inspired architecture with an inductive bias towards mimicking program executions, which models exception handling and "learns to execute" descriptions of the contents of external resources. Surprisingly, we show that the model can also predict the location of the error, despite being trained only on labels indicating the presence/absence and kind of error. In total, we present a practical and difficult-yet-approachable challenge problem related to learning program execution and we demonstrate promising new capabilities of interpreter-inspired machine learning models for code.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。