arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2503.01449cs.SE
收藏

用于多语言软件漏洞检测的大型语言模型基准测试

Benchmarking Large Language Models for Multi-Language Software Vulnerability Detection

Ting Zhang, Chengran Yang, Yindu Su, Martin Weyssow, Hung Nguyen, Tan Bui, Hong Jin Kang, Yikun Li, Eng Lieh Ouh, Lwin Khin Shar, David Lo

AI总结:

针对LLMs在多语言软件漏洞检测中缺乏全面评估的问题,本文构建了包含Python、Java和JavaScript的大规模数据集,通过多种方法评估LLMs并探索数据与模型视角的改进策略,揭示了SVD任务的挑战性。

摘要:

生成式AI的最新进展促使大型语言模型(LLMs)在软件工程中得到广泛应用,解决了许多长期存在的挑战。然而,目前缺乏一项全面的研究来考察LLMs在软件漏洞检测(SVD)这一软件安全关键方面的能力。现有研究主要侧重于使用C/C++数据集评估LLMs,且通常仅探讨提示工程、指令微调和序列分类微调这三种策略中的一到两种用于开源LLMs。因此,关于不同LLMs在多种编程语言漏洞检测中的有效性存在显著的知识空白。为填补这一空白,我们提出了一项全面的实证研究,评估LLMs在SVD任务上的表现。我们编制了一个综合数据集,包含8,260个Python易受攻击函数、7,505个Java易受攻击函数和28,983个JavaScript易受攻击函数。我们采用包括提示工程、指令微调和序列分类微调在内的多种方法评估了五个开源LLMs。这些LLMs与五个微调过的小型语言模型和两个开源静态应用安全测试(SAST)工具进行了基准对比。此外,我们探索了提升LLMs在SVD上性能的两个途径:a)数据视角:使用降采样的平衡数据集重新训练模型;b)模型视角:研究结合多个LLMs预测结果的集成学习方法。我们的全面实验表明,SVD对LLMs而言仍是一项具有挑战性的任务。本研究深入理解了LLMs在SVD中的作用,并为未来利用生成式AI增强软件安全实践提供了实用见解。

英文摘要:

Recent advancements in generative AI have led to the widespread adoption of large language models (LLMs) in software engineering, addressing numerous long-standing challenges. However, a comprehensive study examining the capabilities of LLMs in software vulnerability detection (SVD), a crucial aspect of software security, is currently lacking. Existing research primarily focuses on evaluating LLMs using C/C++ datasets. It typically explores only one or two strategies among prompt engineering, instruction tuning, and sequence classification fine-tuning for open-source LLMs. Consequently, there is a significant knowledge gap regarding the effectiveness of diverse LLMs in detecting vulnerabilities across various programming languages. To address this knowledge gap, we present a comprehensive empirical study evaluating the performance of LLMs on the SVD task. We have compiled a comprehensive dataset comprising 8,260 vulnerable functions in Python, 7,505 in Java, and 28,983 in JavaScript. We assess five open-source LLMs using multiple approaches, including prompt engineering, instruction tuning, and sequence classification fine-tuning. These LLMs are benchmarked against five fine-tuned small language models and two open-source static application security testing tools. Furthermore, we explore two avenues to improve LLM performance on SVD: a) Data perspective: Retraining models using downsampled balanced datasets. b) Model perspective: Investigating ensemble learning methods that combine predictions from multiple LLMs. Our comprehensive experiments demonstrate that SVD remains a challenging task for LLMs. This study provides a thorough understanding of the role of LLMs in SVD and offers practical insights for future advancements in leveraging generative AI to enhance software security practices.

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

↑