arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1708.07583cs.PL
收藏

学习责备:用数据驱动诊断定位新手类型错误

Learning to Blame: Localizing Novice Type Errors with Data-Driven Diagnosis

Eric L. Seidel, Huma Sibghat, Kamalika Chaudhuri, Westley Weimer, Ranjit Jhala

摘要:

在具有全局类型推断的语言中,本地化类型错误具有挑战性,因为类型检查器必须对程序员打算做什么做出假设。我们介绍了Nate,一种基于监督学习的数据驱动的错误定位方法。Nate分析了大量的训练数据--成对的错误类型的程序和它们的“修复”版本--来自动学习一个模型,找出最有可能发现错误的地方。给定一个新的错误类型的程序,Nate执行这个模型来生成一个按可能性排序的潜在责任分配列表。我们通过比较Nate的精确度来评估Nate的最新技术水平,这些精确度来自于一个入门编程课程的两个实例,其中包含了5,000多个类型不良的OCaml程序。我们表明,当考虑排名靠前的责任分配时,Nate的数据驱动模型能够正确预测72%的时间应该改变的确切子表达式,比OCaml高28分,比最先进的SHErrLoc工具高16分。此外,当我们考虑前两个位置时,Nate的准确率超过85%,如果我们考虑前三个位置,则达到91%。

英文摘要:

Localizing type errors is challenging in languages with global type inference, as the type checker must make assumptions about what the programmer intended to do. We introduce Nate, a data-driven approach to error localization based on supervised learning. Nate analyzes a large corpus of training data -- pairs of ill-typed programs and their "fixed" versions -- to automatically learn a model of where the error is most likely to be found. Given a new ill-typed program, Nate executes the model to generate a list of potential blame assignments ranked by likelihood. We evaluate Nate by comparing its precision to the state of the art on a set of over 5,000 ill-typed OCaml programs drawn from two instances of an introductory programming course. We show that when the top-ranked blame assignment is considered, Nate's data-driven model is able to correctly predict the exact sub-expression that should be changed 72% of the time, 28 points higher than OCaml and 16 points higher than the state-of-the-art SHErrLoc tool. Furthermore, Nate's accuracy surpasses 85% when we consider the top two locations and reaches 91% if we consider the top three.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑