arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.09843cs.SE
收藏

对大型语言模型在变异测试中的全面研究

A Comprehensive Study on Large Language Models for Mutation Testing

Beijing Jiaotong University(北京交通大学);University College London(伦敦大学学院);University of Luxembourg(卢森堡大学);King’s College London(伦敦国王学院)

Bo Wang, Mingda Chen, Ming Deng, Youfang Lin, Mark Harman, Mike Papadakis, Jie M. Zhang

AI总结:

本文研究了大型语言模型在变异测试中的性能,发现其在故障检测率上有显著提升,但同时也带来了非可编译性等指标的下降。

摘要:

大型语言模型(LLMs)最近被用于在研究和工业实践中生成变异体。然而,迄今为止还没有对它们在日益重要的基于LLM的软件工程应用中的性能进行综合实证研究。为了解决这一问题,我们进行了综合实证研究,评估了BugFarm和LLMorpheus(两种最先进的基于LLM的方法),以及七个LLM,使用我们新设计的提示,在两个Java真实世界bug基准上的851个真实bug。我们的结果表明,与现有基于规则的方法相比,LLM生成的变异体更加多样,行为上更接近真实bug,并且最重要的是,故障检测率提高了111.29%。即,87.98%(对于LLM) vs. 41.64%(对于基于规则的方法);增加了46.34个百分点。然而,我们的结果也揭示了这些改进效果的代价:LLM生成的变异体在非可编译性、重复和等价变异体率上分别差26.60、10.14和3.51个百分点。这些发现对研究和实践都有即刻的行动价值。它们使从业者在部署基于LLM的变异测试时更有信心,而研究人员现在有了最先进的基线,可以研究技术以进一步提高效果并降低成本。

英文摘要:

Large Language Models (LLMs) have recently been used to generate mutants in both research work and in industrial practice. However, there has been no comprehensive empirical study of their performance for this increasingly important LLM-based Software Engineering application. To address this, we conduct a comprehensive empirical study evaluating BugFarm and LLMorpheus (the two state-of-the-art LLM-based approaches), alongside seven LLMs using our newly designed prompt, including both leading open- and closed-source models, on 851 real bugs from two Java real-world bug benchmarks. Our results reveal that, compared to existing rule-based approaches, LLMs generate more diverse mutants, that are behaviorally closer to real bugs and, most importantly, with 111.29% higher fault detection. That is, 87.98% (for LLMs) vs. 41.64% (for rule-based); an increase of 46.34 percentage points. Nevertheless, our results also reveal that these impressive results for improved effectiveness come at a cost: the LLM-generated mutants have worse non-compilability, duplication, and equivalent mutant rates by 26.60, 10.14, and 3.51 percentage points, respectively. These findings are immediately actionable for both research and practice. They allow practitioners to have greater confidence in deploying LLM-based mutation, while researchers now have a baseline for the state-of-the-art, with which they can research techniques to further improve effectiveness and reduce cost.

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

↑