使用贝叶斯规范查找可能的错误
Finding Likely Errors with Bayesian Specifications
摘要:
我们提出了一个贝叶斯框架,学习概率规范从大型,非结构化的代码语料库,和一种方法,使用这个框架来静态检测异常,因此可能有缺陷,程序行为。这里的独特见解是建立一个统计模型,将隐藏在语料库中的所有规范与实现这些规范的程序的语法和观察到的行为相关联。在特定程序的分析过程中,该模型被调节为后验分布,该后验分布优先考虑与该程序相关的规范。这允许精确的程序分析,即使语料库是高度异质的。发现异常的问题现在被定量地定义为计算我们的模型期望从程序中得到的程序行为的“参考分布”与程序实际产生的行为的分布之间的距离的问题。我们提出了一个具体的实施方案,我们的框架,结合了主题模型和神经网络模型来学习规范,并查询学习的模型来计算异常分数。我们评估这个实现的任务,检测Android API的异常使用。我们令人鼓舞的实验结果表明,该方法可以自动发现Android应用程序中的细微错误,并具有较高的精度和召回率相比,竞争的概率方法。
英文摘要:
We present a Bayesian framework for learning probabilistic specifications from large, unstructured code corpora, and a method to use this framework to statically detect anomalous, hence likely buggy, program behavior. The distinctive insight here is to build a statistical model that correlates all specifications hidden inside a corpus with the syntax and observed behavior of programs that implement these specifications. During the analysis of a particular program, this model is conditioned into a posterior distribution that prioritizes specifications that are relevant to this program. This allows accurate program analysis even if the corpus is highly heterogeneous. The problem of finding anomalies is now framed quantitatively, as a problem of computing a distance between a "reference distribution" over program behaviors that our model expects from the program, and the distribution over behaviors that the program actually produces. We present a concrete embodiment of our framework that combines a topic model and a neural network model to learn specifications, and queries the learned models to compute anomaly scores. We evaluate this implementation on the task of detecting anomalous usage of Android APIs. Our encouraging experimental results show that the method can automatically discover subtle errors in Android applications in the wild, and has high precision and recall compared to competing probabilistic approaches.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。