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

多轮代码生成中的正确性与安全性基准测试

Benchmarking Correctness and Security in Multi-Turn Code Generation

University of Maryland, College Park(马里兰大学帕克分校)

Ruchit Rawal, Jeffrey Yang Fan Chiang, Chihao Shen, Jeffery Siyuan Tian, Aastha Mahajan, Tom Goldstein, Yizheng Chen

AI总结:

本文提出MT-Sec,首个系统评估多轮代码生成正确性与安全性的基准,发现模型从单轮到多轮设置中“正确且安全”输出下降20-27%,且智能体脚手架在多轮中效果有限。

摘要:

由大型语言模型(LLM)驱动的AI编码助手已经改变了软件开发,显著提高了生产力。虽然现有的基准测试评估了LLM生成代码的正确性和安全性,但它们通常局限于单轮任务,无法反映真实世界开发的迭代性质。我们引入了MT-Sec,这是第一个在多轮编码场景中系统评估正确性和安全性的基准测试。我们使用一个合成数据流水线来构建它,该流水线将现有的单轮任务转换为语义对齐的多轮交互序列,从而在模拟真实世界编码过程复杂性的同时,允许重用原始测试套件。我们在MT-Sec上评估了32个开源和闭源模型以及三种智能体脚手架,并观察到从单轮到多轮设置中,“正确且安全”的输出持续下降20-27%——即使在最先进的模型中也是如此。除了完整程序生成之外,我们还评估了模型在多轮代码差异生成上的表现——这是一个尚未探索但实际相关的设置——并发现模型在此表现更差,功能不正确和不安全输出的比率增加。最后,我们发现虽然智能体脚手架提升了单轮代码生成的性能,但在多轮评估中效果并不那么显著。总之,这些发现凸显了在多轮、真实世界的编码工作流中联合评估正确性和安全性的基准测试的必要性。

英文摘要:

AI coding assistants powered by large language models (LLMs) have transformed software development, significantly boosting productivity. While existing benchmarks evaluate the correctness and security of LLM-generated code, they are typically limited to single-turn tasks that do not reflect the iterative nature of real-world development. We introduce MT-Sec, the first benchmark to systematically evaluate both correctness and security in multi-turn coding scenarios. We construct this using a synthetic data pipeline that transforms existing single-turn tasks into semantically aligned multi-turn interaction sequences, allowing reuse of original test suites while modeling the complexity of real-world coding processes. We evaluate 32 open- and closed-source models, and three agent-scaffolding on MT-Sec and observe a consistent 20-27% drop in "correct and secure" outputs from single-turn to multi-turn settings -- even among state-of-the-art models. Beyond full-program generation, we also evaluate models on multi-turn code-diff generation -- an unexplored yet practically relevant setting -- and find that models perform worse here, with increased rates of functionally incorrect and insecure outputs. Finally, we find that while agent scaffoldings boost single-turn code generation performance, they are not quite as effective in multi-turn evaluations. Together, these findings highlight the need for benchmarks that jointly evaluate correctness and security in multi-turn, real-world coding workflows.

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

↑