Deep Learning (DL) is prevalently used in various industries to improve decision-making and automate processes, driven by the ever-evolving DL libraries and compilers. The correctness of DL systems is crucial for trust in DL applications. As such, the recent wave of research has been studying the automated synthesis of test-cases (i.e., DNN models and their inputs) for fuzzing DL systems. However, existing model generators only subsume a limited number of operators, lacking the ability to pervasively model operator constraints. To address this challenge, we propose NeuRI, a fully automated approach for generating valid and diverse DL models composed of hundreds of types of operators. NeuRI adopts a three-step process: (i) collecting valid and invalid API traces from various sources; (ii) applying inductive program synthesis over the traces to infer the constraints for constructing valid models; and (iii) performing hybrid model generation by incorporating both symbolic and concrete operators concolically. Our evaluation shows that NeuRI improves branch coverage of TensorFlow and PyTorch by 24% and 15% over the state-of-the-art model-level fuzzers. NeuRI finds 100 new bugs for PyTorch and TensorFlow in four months, with 81 already fixed or confirmed, and 8 high-priority bugs labeled by PyTorch, constituting 10% of all high-priority bugs of the period. Additionally, open-source developers regard error-inducing models reported by us as "high-quality" and "common in practice".
翻译:深度学习(DL)被广泛应用于各行各业,以优化决策并实现流程自动化,这得益于不断发展的DL库与编译器。DL系统的正确性对于确保DL应用的信任至关重要。因此,近期研究浪潮聚焦于自动合成用于模糊测试DL系统的测试用例(即DNN模型及其输入)。然而,现有模型生成器仅涵盖有限数量的算子,缺乏全面建模算子约束的能力。为应对这一挑战,我们提出NeuRI,一种全自动方法,用于生成由数百种算子组成的有效且多样化的DL模型。NeuRI采用三步流程:(i)从多种来源收集有效与无效的API轨迹;(ii)通过归纳程序合成推断构建有效模型的约束;(iii)通过符号算子与具体算子的混合执行生成混合模型。实验评估表明,相较于最先进的模型级模糊测试工具,NeuRI将TensorFlow与PyTorch的分支覆盖率分别提升24%与15%。在四个月内,NeuRI为PyTorch与TensorFlow发现了100个新缺陷,其中81个已被修复或确认,8个被PyTorch标记为高优先级缺陷,占同期所有高优先级缺陷的10%。此外,开源开发者将我们报告的引发错误的模型视为“高质量”且“实践中常见”。