一句话:提出基于搜索的深度学习框架测试与缺陷定位方法 Audee,可检测逻辑错误、崩溃和 NaN 错误。
现有深度学习质量分析主要关注模型本身,而忽视了所有模型所依赖的底层框架,尤其缺乏对框架实现缺陷的测试与定位。本文提出 Audee,一种面向深度学习框架的测试与缺陷定位方法。Audee 采用基于搜索的方法,并实现三种变异策略,通过探索模型结构、参数、权重和输入的组合来生成多样化测试用例。它能够检测逻辑错误、崩溃和 Not-a-Number 错误:对逻辑错误采用跨框架交叉引用检查,发现 TensorFlow 与 PyTorch 等框架间的行为不一致;对 NaN 采用启发式方法生成易输出极端值的 DNN。Audee 还利用因果测试定位导致不一致或错误的层与参数。作者在 TensorFlow、PyTorch、CNTK 和 Theano 四个框架上覆盖 25 个 API 进行评估,共发现 26 个未知 bug,其中 7 个已被开发者确认或修复。
Deep learning (DL) has been applied widely, and the quality of DL system becomes crucial, especially for safety-critical applications. Existing work mainly focuses on the quality analysis of DL models, but lacks attention to the underlying frameworks on which all DL models depend. In this work, we propose Audee, a novel approach for testing DL frameworks and localizing bugs. Audee adopts a search-based approach and implements three different mutation strategies to generate diverse test cases by exploring combinations of model structures, parameters, weights and inputs. Audee is able to detect three types of bugs: logical bugs, crashes and Not-a-Number (NaN) errors. In particular, for logical bugs, Audee adopts a cross-reference check to detect behavioural inconsistencies across multiple frameworks (e.g., TensorFlow and PyTorch), which may indicate potential bugs in their implementations. For NaN errors, Audee adopts a heuristic-based approach to generate DNNs that tend to output outliers (i.e., too large or small values), and these values are likely to produce NaN. Furthermore, Audee leverages a causal-testing based technique to localize layers as well as parameters that cause inconsistencies or bugs. To evaluate the effectiveness of our approach, we applied Audee on testing four DL frameworks, i.e., TensorFlow, PyTorch, CNTK, and Theano. We generate a large number of DNNs which cover 25 widely-used APIs in the four frameworks. The results demonstrate that Audee is effective in detecting inconsistencies, crashes and NaN errors. In total, 26 unique unknown bugs were discovered, and 7 of them have already been confirmed or fixed by the developers.