Out of Distribution, Out of Luck: How Well Can LLMs Trained on Vulnerability Datasets Detect Top 25 CWE Weaknesses?
Not on the map. Why?
Abstract (arXiv)
Automated vulnerability detection research has made substantial progress, yet its real-world impact remains limited. Prior work found that current vulnerability datasets suffer from issues including label inaccuracy rates of 20%-71%, extensive duplication, and poor coverage of critical Common Weakness Enumeration (CWE). These issues create a significant generalization gap where models achieve misleading In-Distribution (ID) accuracies (testing on splits from the same dataset) by exploiting spurious correlations rather than learning true vulnerability patterns. To address these limitations, we present a three-part solution. First, we introduce BenchVul, which is a manually curated and balanced test dataset covering the MITRE Top 25 Most Dangerous CWEs, to enable fair model evaluation. Second, we construct a high-quality training dataset, TitanVul, comprising 38,548 functions by aggregating seven public sources and applying deduplication and validation using a novel multi-agent LLM pipeline. Third, we propose a Realistic Vulnerability Generation (RVG) pipeline, which synthesizes context-aware vulnerability examples for underrepresented but critical CWE types through simulated development workflows. Our evaluation reveals that In-Distribution (ID) performance does not reliably predict Out-of-Distribution (OOD) performance on BenchVul. For example, a model trained on BigVul achieves the highest 0.703 ID accuracy but fails on BenchVul's real-world samples (0.493 OOD accuracy). Conversely, a model trained on our TitanVul achieves the highest OOD performance on both the real-world (0.881) and synthesized (0.785) portions of BenchVul, improving upon the next-best performing dataset by 5.3% and 11.8% respectively, despite a modest ID score (0.590). Augmenting TitanVul with our RVG further boosts this leading OOD performance, improving accuracy on real-world data by 5.8% (to 0.932).
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). First posted on arXiv 29 Jul 2025.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 1; 2026: 5.
6 papers.
- 2026Sifting the Noise: A Comparative Study of LLM Agents in Vulnerability False Positive Filteringcited by 5
- 2026From SFT to RL: Demystifying the Post-Training Pipeline for LLM-based Vulnerability Detectioncited by 4
- 2026TitanCA: Lessons from Orchestrating LLM Agents to Discover 100+ CVEscited by 2
- 2025On the Difficulty of Selecting Few-Shot Examples for Effective LLM-based Vulnerability Detectioncited by 0
- 2026Lost in the Flow with Code Talkers: Unveiling the Instruction-Tuning Tax of Large Language Models in Code Taskscited by 0
- 2026Diagnosing Generalization Boundaries in AI-Based Vulnerability Detection via Calibrated Embedding Distancescited by 0
- 2026Diagnosing Generalization Boundaries in AI-Based Vulnerability Detection via Calibrated Embedding Distances9 Oct 2026
- 2026Lost in the Flow with Code Talkers: Unveiling the Instruction-Tuning Tax of Large Language Models in Code Tasks7 Jun 2026
- 2026TitanCA: Lessons from Orchestrating LLM Agents to Discover 100+ CVEs20 Apr 2026
- 2026From SFT to RL: Demystifying the Post-Training Pipeline for LLM-based Vulnerability Detection15 Feb 2026
- 2026Sifting the Noise: A Comparative Study of LLM Agents in Vulnerability False Positive Filtering30 Jan 2026
- 2025On the Difficulty of Selecting Few-Shot Examples for Effective LLM-based Vulnerability Detection31 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2026Calibration Without Comprehension: Diagnosing the Limits of Fine-Tuning LLMs for Vulnerability Detection in Systems Software
- 2025Think Broad, Act Narrow: CWE Identification with Multi-Agent Large Language Models
- 2025FORGE: An LLM-driven Framework for Large-Scale Smart Contract Vulnerability Dataset Construction
- 2026An Empirical Evaluation of LLM-Based Approaches for Code Vulnerability Detection: RAG, SFT, and Dual-Agent Systems
- 2024Software Vulnerability and Functionality Assessment using LLMs
- 2026RAVEN: Retrieval-Augmented Vulnerability Exploration Network for Memory Corruption Analysis in User Code and Binary Programs
- 2024LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoning
- 2025Automated Vulnerability Validation and Verification: A Large Language Model Approach