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

基于元形态规范变异代理的LLM编码

LLM Assisted Coding with Metamorphic Specification Mutation Agent

York University(约克大学)

Mostafijur Rahman Akhond, Gias Uddin

AI总结:

CodeMetaAgent通过元形态关系驱动LLM代理,提升代码生成准确性与覆盖率,有效解决规范不一致问题。

摘要:

元形态关系(MRs)作为生成语义等价变异的基础机制。近年来,随着大语言模型(LLMs)的出现,软件工程取得了显著进展。然而,LLMs在软件工程中的可靠性常因不恰当的用户规范导致的歧义和不一致而受到损害。为解决这一挑战,我们提出了CodeMetaAgent(CMA),一种基于元形态关系的LLM代理,能够系统地细化任务规范并生成语义受限的测试用例。我们的框架利用MRs与LLMs来提高生成的一致性并减少由规范引起的变异性,不同于传统将MRs作为后验证的使用方式。我们的框架已在HumanEval-Pro、MBPP-Pro和SWE-Bench_Lite数据集上使用GPT-4o、Mistral Large、GPT-OSS和Qwen3-Coder模型进行评估。结果表明,代码生成准确性提高了高达17%,并实现了高达99.81%的代码覆盖率增长。这些结果表明,元形态关系可以作为简单但有效的指南,在协助基于LLM的软件开发中发挥作用。

英文摘要:

Metamorphic Relations (MRs) serve as a foundational mechanism for generating semantically equivalent mutations. Software engineering has advanced significantly in recent years with the advent of Large Language Models (LLMs). However, the reliability of LLMs in software engineering is often compromised by ambiguities and inconsistencies due to improper user specification. To address this challenge, we present CodeMetaAgent (CMA), a metamorphic relation-driven LLM agent that systematically refines task specifications and generates semantically constrained test cases. Our proposed framework uses MRs with LLMs to improve generation consistency and reduce variability caused by specifications, unlike the traditional use of MRs as post validations. Our framework has been evaluated on the HumanEval-Pro, MBPP-Pro, and SWE-Bench_Lite datasets using the GPT-4o, Mistral Large, GPT-OSS, and Qwen3-Coder models. It improved code generation accuracy by up to 17% and achieved code coverage gains of up to 99.81%. These results show that metamorphic relations can be a simple but effective guide in assisting LLM-based software development.

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

↑