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

提升LLM用于变异生成

Boosting LLMs for Mutation Generation

Beijing Jiaotong University(北京交通大学);Beijing Key Laboratory of Traffic Data Mining and Embodied Intelligence(北京市交通数据挖掘与具身智能重点实验室);Singapore Management University(新加坡管理大学);University College London(伦敦大学学院);University of Luxembourg(卢森堡大学);King’s College London(伦敦国王学院)

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

AI总结:

本文提出SMART方法,通过整合检索增强生成、代码片段分割和监督微调,提升变异生成的有效性和效率,实验显示其在变异有效性、非重复率和可编译率等方面均有显著提升。

摘要:

基于LLM的变异测试是一种有前景的测试技术,但现有方法通常依赖固定的变异集作为少样本示例或根本不使用,导致通用低质量变异、遗漏上下文特定变异模式、大量冗余和不可编译的变异以及与真实bug语义相似性有限。为克服这些限制,我们引入SMART(语义变异与自适应检索和调优)。SMART整合了在向量化的现实bug数据集上的检索增强生成(RAG)、聚焦代码片段分割和使用变异与现实bug结合的监督微调。我们使用1991个现实Java bug从Defects4J和ConDefects数据集进行了广泛的实证研究,将SMART与最先进的基于LLM的方法LLMut和LLMorpheus进行比较。结果表明,SMART显著提高了变异的有效性、效果和效率(甚至使小型7B规模模型能够匹配或超越大型模型如GPT-4o)。我们还证明SMART显著提高了下游软件工程应用,包括测试用例优先级和故障定位。更具体地说,SMART将有效性(加权平均生成率)从42.89%提高到65.6%。它将非重复率从87.38%提高到95.62%,可编译率从88.85%提高到90.21%。在有效性方面,它实现了92.61%的真实bug检测率(相比LLMut的57.86%),并提高了平均Ochiai系数从25.61%到38.44%。在故障定位方面,SMART在MUSE下将64个bug排名为Top-1,在Metallaxis下增加57个。

英文摘要:

LLM-based mutation testing is a promising testing technology, but existing approaches typically rely on a fixed set of mutations as few-shot examples or none at all. This can result in generic low-quality mutations, missed context-specific mutation patterns, substantial numbers of redundant and uncompilable mutants, and limited semantic similarity to real bugs. To overcome these limitations, we introduce SMART (Semantic Mutation with Adaptive Retrieval and Tuning). SMART integrates retrieval-augmented generation (RAG) on a vectorized dataset of real-world bugs, focused code chunking, and supervised fine-tuning using mutations coupled with real-world bugs. We conducted an extensive empirical study of SMART using 1,991 real-world Java bugs from the Defects4J and ConDefects datasets, comparing SMART to the state-of-the-art LLM-based approaches, LLMut and LLMorpheus. The results reveal that SMART substantially improves mutation validity, effectiveness, and efficiency (even enabling small-scale 7B-scale models to match or even surpass large models like GPT-4o). We also demonstrate that SMART significantly improves downstream software engineering applications, including test case prioritization and fault localization. More specifically, SMART improves validity (weighted average generation rate) from 42.89% to 65.6%. It raises the non-duplicate rate from 87.38% to 95.62%, and the compilable rate from 88.85% to 90.21%. In terms of effectiveness, it achieves a real bug detection rate of 92.61% (vs. 57.86% for LLMut) and improves the average Ochiai coefficient from 25.61% to 38.44%. For fault localization, SMART ranks 64 more bugs as Top-1 under MUSE and 57 more under Metallaxis.

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

↑