arrow
Return

Llama-Based Source Code Vulnerability Detection: Prompt Engineering vs Fine Tuning

delete2026-01-01
delete1
PRE
AI
D
Dyna Soumhane Ouchebara *
S
Stéphane Dupont
DOI:10.1007/978-3-032-07884-1_15delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
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 Finetuning, 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/Llamabased- vulnerability- detection.
Keywords:
Software vulnerability detection
Source code analysis
Deep learning
Large language models
Cybersecurity

Journal

C
COMPUTER SECURITY-ESORICS 2025, PT I
IF:
0
Papers:
22
Citations:
0

Organization

U
University of Mons
Scholars:
381
Papers: 179
Citations: 4.0K