Data and Context Matter: Towards Generalizing AI-based Software Vulnerability Detection
Not on the map. Why?
Abstract (arXiv)
AI-based solutions demonstrate remarkable results in identifying vulnerabilities in software, but research has consistently found that this performance does not generalize to unseen codebases. In this paper, we specifically investigate the impact of model architecture, parameter configuration, and quality of training data on the ability of these systems to generalize. For this purpose, we introduce VulGate, a high quality state of the art dataset that mitigates the shortcomings of prior datasets, by removing mislabeled and duplicate samples, updating new vulnerabilities, incorporating additional metadata, integrating hard samples, and including dedicated test sets. We undertake a series of experiments to demonstrate that improved dataset diversity and quality substantially enhances vulnerability detection. We also introduce and benchmark multiple encoder-only and decoder-only models. We find that encoder-based models outperform other models in terms of accuracy and generalization. Our model achieves 6.8% improvement in recall on the benchmark BigVul dataset and outperforms others on unseen projects, demonstrating enhanced generalizability. Our results highlight the role of data quality and model selection in the development of robust vulnerability detection systems. Our findings suggest a direction for future systems with high cross-project effectiveness.
Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Builds on 44 of its 92 references that are in the map. First posted on arXiv 14 Aug 2025.
Builds on
44 of 92 references.
References · 44
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2017Billion-scale similarity search with GPUscited by 2,477
- 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2020Contrastive Learning with Hard Negative Samplescited by 619
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2020Hard Negative Mixing for Contrastive Learningcited by 399
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 266
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
- 2020Deep Learning based Vulnerability Detection: Are We There Yet?cited by 142
32 more
- 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 133
- 2018Automated Vulnerability Detection in Source Code Using Deep Representation Learningcited by 114
- 2023DiverseVul: A New Vulnerable Source Code Dataset for Deep Learning Based Vulnerability Detectioncited by 98
- 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 94
- 2018SySeVR: A Framework for Using Deep Learning to Detect Software Vulnerabilitiescited by 91
- 2021CVEfixes: Automated Collection of Vulnerabilities and Their Fixes from Open-Source Softwarecited by 89
- 2024NV-Retriever: Improving text embedding models with effective hard-negative miningcited by 83
- 2023GPTScan: Detecting Logic Vulnerabilities in Smart Contracts by Combining GPT with Program Analysiscited by 65
- 2021Vulnerability Detection with Fine-grained Interpretationscited by 56
- 2023Data Quality for Software Vulnerability Datasetscited by 49
- 2021D2A: A Dataset Built for AI-Based Vulnerability Detection Methods Using Differential Analysiscited by 48
- 2022An Empirical Study of Deep Learning Models for Vulnerability Detectioncited by 44
- 2025LLMs in Software Security: A Survey of Vulnerability Detection Techniques and Insightscited by 44
- 2024Finetuning Large Language Models for Vulnerability Detectioncited by 39
- 2024ReposVul: A Repository-Level High-Quality Vulnerability Datasetcited by 35
- 2018SAFE: Self-Attentive Function Embeddings for Binary Similaritycited by 33
- 2023Uncovering the Limits of Machine Learning for Automatic Vulnerability Detectioncited by 30
- 2023How Far Have We Gone in Vulnerability Detection Using Large Language Modelscited by 27
- 2024MegaVul: A C/C++ Vulnerability Dataset with Comprehensive Code Representationcited by 27
- 2021VELVET: a noVel Ensemble Learning approach to automatically locate VulnErable sTatementscited by 20
- 2025SecVulEval: Benchmarking LLMs for Real-World C/C++ Vulnerability Detectioncited by 19
- 2023On the Theories Behind Hard Negative Sampling for Recommendationcited by 18
- 2020Predicting Defective Lines Using a Model-Agnostic Techniquecited by 14
- 2021JITLine: A Simpler, Better, Faster, Finer-grained Just-In-Time Defect Predictioncited by 14
- 2025Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled Preferencescited by 10
- 2025A Systematic Literature Review on Detecting Software Vulnerabilities with Large Language Modelscited by 8
- 2024Automatic Data Labeling for Software Vulnerability Prediction Models: How Far Are We?cited by 6
- 2023Improving Code Search with Hard Negative Sampling Based on Fine-tuningcited by 5
- 2024An Empirical Study of False Negatives and Positives of Static Code Analyzers From the Perspective of Historical Issuescited by 4
- 2025Open Source, Open Threats? Investigating Security Challenges in Open-Source Softwarecited by 4
- 2025R+R: Security Vulnerability Dataset Quality Is Criticalcited by 3
- 2025Mono: Is Your "Clean" Vulnerability Dataset Really Solvable? Exposing and Trapping Undecidable Patches and Beyondcited by 2
Built on by
Citing papers per year: 2025: 1; 2026: 1.
2 papers.