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

如何比较人类编写的代码与LLM生成代码的安全性

How to Compare the Security of Code Written by Humans to LLM-generated Code

Zurich University of Applied Sciences(苏黎世应用科学大学)

Jasmine Egli, Rebecca Balebako

AI总结:

提出一个自动化框架,通过静态和动态质量分析,在人类单独、LLM单独和人类-LLM混合条件下进行可重复的“物种公平”比较实验,以评估LLM生成代码相对于人类代码的安全性。

摘要:

大型语言模型(LLMs)正在迅速改变软件的创建和维护方式。将LLM生成的代码与人类编写的标准进行比较,对于确定这些新工具是维持还是削弱专业开发者建立的安全基线至关重要。然而,我们缺乏一种标准化的方法,用于实证比较通过人类-LLM协作、仅LLM或传统仅人类方法产生的代码的安全性。为此,我们提出了一个自动化框架,用于在仅人类、仅LLM和混合条件下进行对比研究。我们的方法自动化了提示、时间和实验设置的日志记录,并通过多维静态和动态质量分析来衡量结果。我们提供了该框架的开源实现,以确保未来的研究人员能够进行可重复的、物种公平的实验。重要的是,我们通过一项可行性研究验证了该框架,为人类和AI主体之间的“物种公平”比较提供了实验蓝图。通过分享经验教训,我们为人类和LLM生成的代码在软件安全性方面的实证研究奠定了基础。

英文摘要:

Large language models (LLMs) are rapidly transforming how software is created and maintained. Comparing LLM-generated code against human-written standards is essential to determine whether these new tools uphold or erode the security baselines established by professional developers. Yet, we lack a standardized method for empirically comparing the security of code produced through human-LLM collaboration against LLM-only, or traditional human-only methods. To facilitate this, we propose an automated framework for conducting comparative studies across human-only, LLM-only, and hybrid conditions. Our approach automates the logging of prompts, timing, and experimental settings, measuring outcomes through multi-dimensional static and dynamic quality analysis. We provide an open-source implementation of this framework to ensure that future researchers can conduct reproducible, species-fair experiments. Importantly, we validate the framework via a feasibility study, providing an experimental blueprint for ``species-fair'' comparisons between human and AI subjects. By sharing lessons learned, we establish a foundation for empirical research on human and LLM-generated code for software security.

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

↑