arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.23448cs.SEcs.AIcs.CLcs.LG
收藏

作为变异算子的语义保持变换:在缺陷检测中的有效性研究

Semantic-Preserving Transformations as Mutation Operators: A Study on Their Effectiveness in Defect Detection

Simula Research Laboratory(西穆拉研究院)

Max Hort, Linas Vidziunas, Leon Moonen

AI总结:

本研究探讨在测试阶段使用语义保持变换作为变异算子来提升缺陷检测工具性能的可行性,发现复用现有共享变换困难且未能提高模型准确率。

摘要:

缺陷检测的最新进展使用了语言模型。现有工作通过增强训练数据来提升模型在应用于语义相同代码(即预测结果应相同)时的鲁棒性。然而,在工具应用阶段利用语义相同代码以改进工具性能的做法尚未被考虑——这一概念与蜕变测试密切相关。本研究旨在确定能否使用类似于变异算子的语义保持变换,在测试阶段提升缺陷检测工具的性能。我们首先收集了实现语义保持变换并公开其实现的现有出版物,以便复用。我们实证研究了三种不同集成策略在增强缺陷检测工具方面的有效性。我们将收集到的变换应用于Devign数据集(将漏洞视为一种缺陷),并使用两个微调的大型语言模型(VulBERTa、PLBART)进行缺陷检测。我们发现了28篇包含94种不同变换的出版物。我们选择实现其中4篇文献的39种变换,但人工检查发现39种中有23种会改变代码语义。使用剩余的16种正确变换和三种集成策略,我们未能提高缺陷检测模型的准确率。结果表明,复用共享的语义保持变换很困难,有时甚至会错误地改变语义。

英文摘要:

Recent advances in defect detection use language models. Existing works enhanced the training data to improve the models' robustness when applied to semantically identical code (i.e., predictions should be the same). However, the use of semantically identical code has not been considered for improving the tools during their application - a concept closely related to metamorphic testing. The goal of our study is to determine whether we can use semantic-preserving transformations, analogue to mutation operators, to improve the performance of defect detection tools in the testing stage. We first collect existing publications which implemented semantic-preserving transformations and share their implementation, such that we can reuse them. We empirically study the effectiveness of three different ensemble strategies for enhancing defect detection tools. We apply the collected transformations on the Devign dataset, considering vulnerabilities as a type of defect, and two fine-tuned large language models for defect detection (VulBERTa, PLBART). We found 28 publications with 94 different transformations. We choose to implement 39 transformations from four of the publications, but a manual check revealed that 23 out 39 transformations change code semantics. Using the 16 remaining, correct transformations and three ensemble strategies, we were not able to increase the accuracy of the defect detection models. Our results show that reusing shared semantic-preserving transformation is difficult, sometimes even causing wrongful changes to the semantics. Keywords: defect detection, language model, semantic-preserving transformation, ensemble

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

↑