Abstract
Automated vulnerability detection remains a significant challenge in software security, primarily due to a "generalization gap" where models excel on training data but fail on real-world code. This paper identifies critical flaws in existing datasets, including high redundancy and poor label quality. To address these, the authors introduce TitanVul, a curated training set, and BenchVul, a balanced benchmark for the MITRE Top 25 CWEs. Their findings demonstrate that high-quality data curation and synthetic augmentation are essential for bridging the gap between laboratory performance and real-world utility.
The Generalization Gap in Vulnerability Detection
Automated vulnerability detection is often evaluated using In-Distribution (ID) settings, where models are tested on a subset of their training data. However, this approach masks a massive failure in real-world, Out-of-Distribution (OOD) performance. The authors identify three primary drivers of this gap:
- Unreliable Evaluation: Many existing datasets suffer from extreme redundancy and noisy labels. Overlaps between datasets can reach as high as 71%, leading models to memorize specific code patterns rather than learning underlying security principles.
- Poor Data Quality: Datasets often include non-security-related code changes, such as refactoring, which confuses the learning process.
- The Long Tail Problem: Critical but rare vulnerabilities (the MITRE Top 25) are often underrepresented, leaving models unprepared for high-risk scenarios.
Methods: TitanVul and BenchVul
To solve these issues, the authors developed a three-pronged approach:
- TitanVul (Training Set): An aggregation of seven public datasets subjected to rigorous deduplication and a multi-agent LLM verification pipeline. This pipeline (Auditor, Critic, and Consensus agents) ensures that each sample represents a genuine security fix, resulting in a high-quality set of 38,548 functions.
- BenchVul (Benchmark): A manually verified, balanced test set covering the MITRE Top 25 CWEs. By providing exactly 50 samples per category, BenchVul ensures that rare vulnerabilities are given equal weight in evaluation.
- Realistic Vulnerability Generation (RVG): A pipeline that uses LLMs to simulate development workflows, creating high-quality synthetic data for rare vulnerabilities that are otherwise scarce in public datasets.
Key Insights and Results
The ID vs. OOD Disconnect
The study reveals a stark contrast between leaderboard performance and real-world efficacy. For instance, the BigVul dataset achieved a high ID accuracy of 0.703 but plummeted to 0.493 on OOD samples—essentially no better than a coin flip. This confirms that high scores on standard benchmarks often indicate overfitting to dataset-specific quirks.
The Power of Quality and Augmentation
TitanVul significantly outperformed existing datasets, achieving an OOD accuracy of 0.881. When augmented with synthetic data from the RVG pipeline, performance on real-world vulnerabilities rose to 0.932. This improvement was particularly notable for rare types like hard-coded credentials (CWE-798), proving that synthetic data can act as a force multiplier for specialized security tasks.
LLM Baselines
Interestingly, general-purpose models like GPT-4 and Claude-3.7 showed modest performance (0.5–0.7 accuracy) in zero-shot or few-shot settings. This highlights that while LLMs are powerful, specialized fine-tuning on high-quality, verified security data remains necessary for reliable vulnerability detection.
Limitations and Future Work
The current research focuses on function-level analysis, whereas many real-world vulnerabilities are inter-procedural, involving interactions across multiple files. Future work will aim to expand the benchmark to include these complex scenarios and broader industrial codebases, while also addressing potential biases inherent in LLM-generated synthetic data.
Summary updated