The rapid advancement of Large Language Models (LLMs) presents new opportunities for automated software vulnerability detection, a crucial task in securing modern codebases. This paper presents a comparative study on the effectiveness of LLM-based techniques for detecting software vulnerabilities. The study evaluates three approaches, Retrieval-Augmented Generation (RAG), Supervised Fine-Tuning (SFT), and a Dual-Agent LLM framework, against a baseline LLM model. A curated dataset was compiled from Big-Vul and real-world code repositories from GitHub, focusing on five critical Common Weakness Enumeration (CWE) categories: CWE-119, CWE-399, CWE-264, CWE-20, and CWE-200. Our RAG approach, which integrated external domain knowledge from the internet and the MITRE CWE database, achieved the highest overall accuracy (0.86) and F1 score (0.85), highlighting the value of contextual augmentation. Our SFT approach, implemented using parameter-efficient QLoRA adapters, also demonstrated strong performance. Our Dual-Agent system, an architecture in which a secondary agent audits and refines the output of the first, showed promise in improving reasoning transparency and error mitigation, with reduced resource overhead. These results emphasize that incorporating a domain expertise mechanism significantly strengthens the practical applicability of LLMs in real-world vulnerability detection tasks.


翻译:大型语言模型(LLM)的快速发展为自动化软件漏洞检测带来了新的机遇,这是保障现代代码库安全的关键任务。本文对基于LLM的软件漏洞检测技术效果进行了比较研究。该研究评估了三种方法——检索增强生成(RAG)、监督微调(SFT)以及双智能体LLM框架,并以一个基线LLM模型作为对照。研究数据集精选自Big-Vul和GitHub的真实代码仓库,重点关注五个关键的通用缺陷枚举(CWE)类别:CWE-119、CWE-399、CWE-264、CWE-20和CWE-200。我们的RAG方法整合了来自互联网和MITRE CWE数据库的外部领域知识,取得了最高的总体准确率(0.86)和F1分数(0.85),凸显了上下文增强的价值。我们采用参数高效的QLoRA适配器实现的SFT方法也表现出色。我们的双智能体系统——一种由次级智能体审核并优化初级智能体输出的架构——在提升推理透明度和错误缓解方面展现出潜力,同时降低了资源开销。这些结果表明,融入领域专业知识机制能显著增强LLM在现实世界漏洞检测任务中的实际适用性。

0
下载
关闭预览

相关内容

LLM/智能体作为数据分析师:综述
专知会员服务
36+阅读 · 2025年9月30日
可信赖LLM智能体的研究综述:威胁与应对措施
专知会员服务
36+阅读 · 2025年3月17日
【ICLR2024】能检测到LLM产生的错误信息吗?
专知会员服务
25+阅读 · 2024年1月23日
如何检测LLM内容?UCSB等最新首篇《LLM生成内容检测》综述
智能合约的形式化验证方法研究综述
专知
16+阅读 · 2021年5月8日
Xsser 一款自动检测XSS漏洞工具
黑白之道
14+阅读 · 2019年8月26日
NLG ≠ 机器写作 | 专家专栏
量子位
13+阅读 · 2018年9月10日
用Rasa NLU构建自己的中文NLU系统
待字闺中
18+阅读 · 2017年9月18日
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
VIP会员
相关基金
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
Top
微信扫码咨询专知VIP会员