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

基于Llama的源代码漏洞检测:提示工程与微调

Llama-based source code vulnerability detection: Prompt engineering vs Fine tuning

University of Mons(蒙斯大学)

Dyna Soumhane Ouchebara, Stéphane Dupont

AI总结:

本研究探讨了基于Llama模型的源代码漏洞检测方法,比较了提示工程与微调技术的效果,提出双微调方法并评估其性能。

摘要:

随着过去二十年开发周期的加速,软件生产显著增加,导致软件漏洞持续上升,这由每年发布的CVE程序统计数据所证实。因此,源代码漏洞检测(CVD)过程的自动化变得至关重要,已提出从已建立的程序分析技术到近期的AI方法等多种方法。我们的研究调查了被认为是目前最有效的AI模型之一的大型语言模型(LLMs)在CVD任务中的表现。目标是研究其性能,并应用不同最先进的技术来增强其在该任务中的效果。我们探索了各种微调和提示工程设置。我们特别提出了一种新的微调LLMs的方法,称为双微调,并测试了较少研究的测试时间微调方法。我们利用最近的开源Llama-3.1 8B模型,使用从BigVul和PrimeVul数据集中提取的源代码样本。我们的结论强调了微调对解决该任务的重要性,双微调的性能,以及Llama模型在CVD中的潜力。尽管提示证明无效,但检索增强生成(RAG)作为示例选择技术表现相对较好。总体而言,一些研究问题已得到回答,许多仍需暂停,这为未来的工作提供了许多视角。代码库可在此获取:https://github.com/DynaSoumhaneOuchebara/Llama-based-vulnerability-detection。

英文摘要:

The significant increase in software production, driven by the acceleration of development cycles over the past two decades, has led to a steady rise in software vulnerabilities, as shown by statistics published yearly by the CVE program. The automation of the source code vulnerability detection (CVD) process has thus become essential, and several methods have been proposed ranging from the well established program analysis techniques to the more recent AI-based methods. Our research investigates Large Language Models (LLMs), which are considered among the most performant AI models to date, for the CVD task. The objective is to study their performance and apply different state-of-the-art techniques to enhance their effectiveness for this task. We explore various fine-tuning and prompt engineering settings. We particularly suggest one novel approach for fine-tuning LLMs which we call Double Fine-tuning, and also test the understudied Test-Time fine-tuning approach. We leverage the recent open-source Llama-3.1 8B, with source code samples extracted from BigVul and PrimeVul datasets. Our conclusions highlight the importance of fine-tuning to resolve the task, the performance of Double tuning, as well as the potential of Llama models for CVD. Though prompting proved ineffective, Retrieval augmented generation (RAG) performed relatively well as an example selection technique. Overall, some of our research questions have been answered, and many are still on hold, which leaves us many future work perspectives. Code repository is available here: https://github.com/DynaSoumhaneOuchebara/Llama-based-vulnerability-detection.

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

↑