Neural networks can be regarded as a new programming paradigm, i.e., instead of building ever-more complex programs through (often informal) logical reasoning in the programmers' mind, complex 'AI' systems are built by optimising generic neural network models with big data. In this new paradigm, AI frameworks such as TensorFlow and PyTorch play a key role, which is as essential as the compiler for traditional programs. It is known that the lack of a proper semantics for programming languages (such as C), i.e., a correctness specification for compilers, has contributed to many problematic program behaviours and security issues. While it is in general hard to have a correctness specification for compilers due to the high complexity of programming languages and their rapid evolution, we have a unique opportunity to do it right this time for neural networks (which have a limited set of functions, and most of them have stable semantics). In this work, we report our effort on providing a correctness specification of neural network frameworks such as TensorFlow. We specify the semantics of almost all TensorFlow layers in the logical programming language Prolog. We demonstrate the usefulness of the semantics through two applications. One is a fuzzing engine for TensorFlow, which features a strong oracle and a systematic way of generating valid neural networks. The other is a model validation approach which enables consistent bug reporting for TensorFlow models.
翻译:神经网络可以被视为一个新的编程模式,即,复杂的“AI”系统不是通过程序员头脑中(往往是非正式的)逻辑推理来建立日益复杂的程序,而是通过优化通用神经网络模型和大数据来建立复杂的“AI”系统。在这个新的模式中,TensorFlow和PyTorrch等AI框架发挥着关键的作用,这与传统程序的编程者一样至关重要。众所周知,对于编程语言(如C)缺乏适当的语义(如C),即编程员的正确性规格,这促成了许多有问题的程序行为和安全问题。虽然由于编程语言高度复杂及其快速演变,通常很难为编程员有一个正确性规格,但我们有一个独特的机会来纠正这个框架对神经网络(这些网络的功能有限,其中多数具有稳定的语义性)。在这项工作中,我们报告我们的工作模式是提供神经网络框架的正确性规格,如TensorFlow等。我们指定了几乎所有的TensorFlow网络的语义性说明,这几乎都是SentFlowFlow 系统化应用系统化的精度, Procial Prodress Produal Produstrational strational or laction Produstrations) Produstrutal Produstrutal Produstrutysturding a Productions