A Comparative Evaluation of Large Language Models for Real-World Vulnerability Detection: An Empirical Study on Big-Vul and CVEfixes
Keywords:
Large language models, vulnerability detection, source code analysis, Big-Vul, CVEfixes, static analysis, CWE, strict F1, AUC-ROCAbstract
Large language models are increasingly used in source code understanding, bug detection, and secure software development workflows. However, their effectiveness in vulnerability detection is often evaluated on synthetic benchmarks or short code snippets, leaving open questions about their reliability on real-world software artifacts. This study presents a comparative empirical evaluation of three large language models — GPT-4.1, GPT-4o, and Claude Sonnet 4.6 — on two real-world vulnerability datasets: Big-Vul and CVEfixes. The experiments evaluate zero-shot, few-shot, and structured chain-of-thought (CoT) prompts on balanced samples from both datasets and compare model performance against static analysis baselines. Strict F1 is used as the primary metric, treating parse failures as prediction errors. Probability-based metrics (AUC-ROC, AP) are also reported. On Big-Vul, Claude Sonnet 4.6 with structured CoT achieves the highest strict F1 of 0.574, whereas on CVEfixes, GPT-4.1 with structured CoT obtains the highest strict F1 of 0.667. However, AUC-ROC values remain between 0.49 and 0.56 across all Big-Vul configurations, indicating near-random confidence calibration despite higher F1 scores. McNemar tests show no statistically significant differences between model pairs on Big-Vul, while on CVEfixes, GPT-4.1 CoT significantly outperforms GPT-4o zero-shot after Bonferroni correction (p=0.0026). These findings indicate that large language models can provide useful vulnerability detection signals in real-world code; however, the near-random AUC values on Big-Vul show that their confidence scores are poorly calibrated, and these models should therefore be considered assistive components for expert review rather than standalone security auditing mechanisms.