arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2106.09242cs.SE
收藏

CoCoFuzzing:使用覆盖引导模糊测试神经代码模型

CoCoFuzzing: Testing Neural Code Models with Coverage-Guided Fuzzing

Moshi Wei, Yuchao Huang, Jinqiu Yang, Junjie Wang, Song Wang

摘要:

基于深度学习的代码处理模型在预测方法名称、总结程序和注释生成等任务上表现出了良好的性能。然而,尽管取得了巨大的进步,但深度学习模型往往容易受到对抗攻击,这可能会导致这些模型对意外输入的错误分类,从而严重威胁到这些模型的鲁棒性和可推广性。为了解决上述问题,已经提出了许多深度学习测试方法,然而,这些方法主要集中在测试图像、音频和文本分析等领域中的深度学习应用,由于程序的独特性质,其不能直接应用于神经模型以用于代码。在本文中,我们提出了一个基于覆盖率的模糊框架CoCoFuzzing,用于测试基于深度学习的代码处理模型。特别是,我们首先提出了十个变异算子自动生成有效的和语义保持源代码的例子作为测试,然后我们提出了一个基于神经元覆盖的方法来指导测试的生成。我们研究了CoCoFuzzing在三种最先进的神经代码模型上的性能,即,NeuralCodeSum、CODE2SEQ和CODE2VEC。我们的实验结果表明,CoCoFuzzing可以生成有效的和语义保留的源代码的例子,用于测试这些模型的鲁棒性和泛化能力,并提高神经元的覆盖率。此外,这些测试可用于通过对抗性再训练来提高目标神经代码模型的性能。

英文摘要:

Deep learning-based code processing models have shown good performance for tasks such as predicting method names, summarizing programs, and comment generation. However, despite the tremendous progress, deep learning models are often prone to adversarial attacks, which can significantly threaten the robustness and generalizability of these models by leading them to misclassification with unexpected inputs. To address the above issue, many deep learning testing approaches have been proposed, however, these approaches mainly focus on testing deep learning applications in the domains of image, audio, and text analysis, etc., which cannot be directly applied to neural models for code due to the unique properties of programs. In this paper, we propose a coverage-based fuzzing framework, CoCoFuzzing, for testing deep learning-based code processing models. In particular, we first propose ten mutation operators to automatically generate valid and semantically preserving source code examples as tests; then we propose a neuron coverage-based approach to guide the generation of tests. We investigate the performance of CoCoFuzzing on three state-of-the-art neural code models, i.e., NeuralCodeSum, CODE2SEQ, and CODE2VEC. Our experiment results demonstrate that CoCoFuzzing can generate valid and semantically preserving source code examples for testing the robustness and generalizability of these models and improve the neuron coverage. Moreover, these tests can be used to improve the performance of the target neural code models through adversarial retraining.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑