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

LLM生成代码的安全性与质量:多语言、多模型分析

Security and Quality in LLM-Generated Code: A Multi-Language, Multi-Model Analysis

Department of Computer Science, University of Central Florida(计算机科学系,中央佛罗里达大学);Department of Computer Science, Birzeit University(计算机科学系,比尔宰特大学)

Mohammed Kharma, Soohyeon Choi, Mohammed AlKhanafseh, David Mohaisen

AI总结:

本文研究了LLM生成代码在不同编程语言中的安全性和质量,发现其安全性因语言而异,且未能充分利用现代安全特性,需进一步改进以提升安全性和质量。

摘要:

人工智能(AI)驱动的代码生成工具正被越来越多地用于软件开发生命周期中,以加速编码任务。然而,使用大型语言模型(LLMs)生成的代码的安全性仍处于研究的边缘,已有研究揭示了各种风险和弱点。本文分析了不同编程语言中LLMs生成代码的安全性。我们引入了一个包含200个任务的 dataset,分为六个类别,以评估LLMs在生成安全且可维护代码方面的性能。我们的研究显示,尽管LLMs可以自动化代码生成,但其安全性在不同语言中表现不一。许多模型未能利用现代编译器和工具包更新中的最新安全特性,例如Java 17。此外,过时的方法仍被广泛使用,特别是在C++中。这突显了需要改进LLMs,以在整合编程语言新兴最佳实践的同时提升安全性和质量。

英文摘要:

Artificial Intelligence (AI)-driven code generation tools are increasingly used throughout the software development lifecycle to accelerate coding tasks. However, the security of AI-generated code using Large Language Models (LLMs) remains underexplored, with studies revealing various risks and weaknesses. This paper analyzes the security of code generated by LLMs across different programming languages. We introduce a dataset of 200 tasks grouped into six categories to evaluate the performance of LLMs in generating secure and maintainable code. Our research shows that while LLMs can automate code creation, their security effectiveness varies by language. Many models fail to utilize modern security features in recent compiler and toolkit updates, such as Java 17. Moreover, outdated methods are still commonly used, particularly in C++. This highlights the need for advancing LLMs to enhance security and quality while incorporating emerging best practices in programming languages.

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

↑