arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.21598cs.SEcs.AI
收藏

你不需要公共测试来生成正确代码

You Don't Need Public Tests to Generate Correct Code

WSO2(WSO2公司)

Kaushitha Silva, Srinath Perera

AI总结:

本文提出DryRUN框架,通过让大语言模型自主生成测试输入并模拟执行,避免依赖公共测试用例,从而减少过自信偏差并提升代码生成效率。

摘要:

多智能体系统常用于自主代码生成,展现了在复杂算法问题解决中的强大实用性。最近的研究通过利用模拟引导的规划和调试来解决生成功能正确程序的困难,其中语言模型通过执行轨迹来验证逻辑。然而,这些方法严重依赖人类编写的公共测试用例来锚定模拟和调试循环。手工编写详尽的输入输出对在软件开发生命周期中造成显著且劳动密集型的瓶颈。由于真实世界场景中在实际实现之前很少有真实情况下的地面真实示例,这种依赖限制了现有方法主要局限于受控的编程竞赛数据集。此外,我们证明依赖这些公共测试会创造一个“过自信差距”,导致框架过度拟合基本示例并在隐藏测试套件中表现不佳。相反,我们注意到外部输入样本并非成功代码生成的绝对要求。我们展示了大语言模型具备自主构建有效输入并模拟执行流程以实现自我纠正的能力。基于此,我们引入DryRUN框架,通过使LLM能够迭代规划、合成自己的测试输入并运行模拟执行,从而缓解算法过自信。使用LiveCodeBench v6数据集(2025年3月后)的评估表明,DryRUN在与CodeSIM(最先进的、依赖测试的基线)相当的性能上,完全不依赖公共测试或外部执行信号,同时减少了总体输出令牌使用量。

英文摘要:

Multi-agent systems are frequently employed for autonomous code generation, demonstrating strong utility in complex algorithmic problem-solving. Recent studies tackle the difficulty of producing functionally correct programs by leveraging simulation-guided planning and debugging, wherein language models step through execution traces to validate logic. Nevertheless, these methods rely heavily on human-authored public test cases to anchor the simulation and debugging cycles. Hand-crafting exhaustive input-output pairs creates a significant, labor-intensive bottleneck within the software development lifecycle. Since ground-truth examples are seldom accessible before actual implementation in real-world scenarios, this reliance limits existing approaches primarily to curated competitive programming datasets. Additionally, we demonstrate that depending on these public tests creates an "overconfidence gap," leading frameworks to overfit to basic examples and underperform on hidden test suites. Conversely, we note that external input samples are not an absolute requirement for successful code generation. We show that large language models possess the capability to autonomously construct valid inputs and simulate execution flows for self-correction. Building on this, we introduce DryRUN, a framework that removes the necessity for ground-truth data by enabling the LLM to iteratively plan, synthesize its own test inputs, and run simulated executions, thereby mitigating algorithmic overconfidence. Assessments using the LiveCodeBench v6 dataset (post-March 2025) reveal that DryRUN achieves comparable performance to CodeSIM, a state-of-the-art, test-dependent baseline. Notably, it does so entirely without public tests or external execution signals, all while decreasing overall output token usage.

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

↑