A Comprehensive Comparison of LLaMA 3.1 and Traditional ML Approaches in Automated Vulnerability Detection
Abstract
Software vulnerability detection has traditionally relied on classical machine learning (ML) models with handcrafted features, which are lightweight but limited in performance. Transformer-based Large Language Models (LLMs) trained on source code provide deeper semantic understanding and stronger generalization. This work presents a direct comparison between ML- and LLM-based approaches across binary and multi-label tasks. We benchmark Random Forest, SVM, and LSTM against LoRA-finetuned LLaMA 3.1 models on both synthetic and real-world datasets. Our LLaMA 3.18 B model achieves $87 \%$ macro $F 1$ in binary classification and $82 \%$ in multi-label classification on real-world data-substantially outperforming ML and DL baselines. Despite higher computational demands, parameter-efficient fine-tuning with Unsloth and LoRA makes LLMs viable for practical deployment. These findings highlight the superiority of LLMs in security-critical code analysis and establish strong baselines for future research.
BibTeX
@misc{sajwani2025comprehensive,
author = {Ahmed Sajwani and Fatima Al-Kaabi and Amr Tamer and Mohamed Yaqoob and Panos Liatsis},
title = {{A Comprehensive Comparison of LLaMA 3.1 and Traditional ML Approaches in Automated Vulnerability Detection}},
year = {2025},
doi = {10.1109/aiccsa66935.2025.11315404},
}Ask Althea to put this paper to the test.
Loading related content...