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

基于量子引导的LLM代码生成测试用例最小化方法

Quantum-Guided Test Case Minimization for LLM-Based Code Generation

Lakehead University(劳里埃湖大学);Memorial University of Newfoundland(纽芬兰纪念大学)

Huixiang Zhang, Mahzabeen Emu

AI总结:

针对精确控制LLM生成高效简洁代码的挑战,提出基于TDD的量子引导框架,将TCM转化为QUBO模型,量子退火求解速度比模拟退火快16倍,减少36.5%token消耗并提升代码质量。

摘要:

精确控制大型语言模型(LLMs)生成高效简洁的代码是软件工程中的核心挑战。我们提出了一个基于测试驱动开发(TDD)的框架,将代码规范转化为组合优化任务。该框架首先提示LLM生成测试套件,然后将测试用例最小化(TCM)问题表述为二次无约束二进制优化(QUBO)模型。这种QUBO范式兼容经典求解器和量子退火器等新兴硬件。实验表明,量子退火解决核心TCM任务的速度比模拟退火快16倍。该性能支撑了我们的端到端框架,减少了36.5%的总token消耗,并显著提高了代码质量。这项工作展示了生成式AI与组合优化在软件工程中的强大协同作用,强调了精确模型构建的关键重要性。

英文摘要:

Precisely controlling Large Language Models (LLMs) to generate efficient and concise code is a central challenge in software engineering. We introduce a framework based on Test-Driven Development (TDD) that transforms code specification into a combinatorial optimization task. The framework first prompts an LLM to generate a test suite, then formulates the Test Case Minimization (TCM) problem as a Quadratic Unconstrained Binary Optimization (QUBO) model. This QUBO paradigm is compatible with both classical solvers and emerging hardware such as quantum annealers. Experimentally, quantum annealing solves the core TCM task 16 times faster than simulated annealing. This performance underpins our end-to-end framework, which reduces total token consumption by 36.5\% and significantly improves code quality. This work demonstrates a powerful synergy between generative AI and combinatorial optimization in software engineering, highlighting the critical importance of precise model formulation.

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

↑