Recently, neural networks have spread into numerous fields including many safety-critical systems. Neural networks are built (and trained) by programming in frameworks such as TensorFlow and PyTorch. Developers apply a rich set of pre-defined layers to manually program neural networks or to automatically generate them (e.g., through AutoML). Composing neural networks with different layers is error-prone due to the non-trivial constraints that must be satisfied in order to use those layers. In this work, we propose an approach to automatically repair erroneous neural networks. The challenge is in identifying a minimal modification to the network so that it becomes valid. Modifying a layer might have cascading effects on subsequent layers and thus our approach must search recursively to identify a "globally" minimal modification. Our approach is based on an executable semantics of deep learning layers and focuses on four kinds of errors which are common in practice. We evaluate our approach for two usage scenarios, i.e., repairing automatically generated neural networks and manually written ones suffering from common model bugs. The results show that we are able to repair 100% of a set of randomly generated neural networks (which are produced with an existing AI framework testing approach) effectively and efficiently (with an average repair time of 21.08s) and 93.75% of a collection of real neural network bugs (with an average time of 3min 40s).
翻译:最近,神经网络已扩展到众多领域,其中包括许多安全关键系统。神经网络通过TensorFlow和PyTorch等框架进行编程(和训练)而构建。开发者利用丰富预定义层的集合来手动编程神经网络或自动生成它们(例如,通过AutoML)。由于使用这些层必须满足非平凡约束,因此组合不同层的神经网络容易出错。在这项工作中,我们提出了一种自动修复错误神经网络的方法。挑战在于识别对网络的最小修改以使其变得有效。修改某一层可能对后续层产生级联效应,因此我们的方法必须递归搜索以识别"全局"最小修改。该方法基于深度学习层的可执行语义,并聚焦于实践中常见的四类错误。我们针对两种使用场景评估了该方法,即修复自动生成的神经网络和存在常见模型错误的手动编写神经网络。结果表明,我们能够有效且高效地修复100%的随机生成神经网络集(通过现有AI框架测试方法生成,平均修复时间为21.08秒),以及93.75%的真实神经网络错误集合(平均修复时间为3分40秒)。