TL;DR
When a security researcher reports a software bug, they usually describe how to break the program, not where the broken code lives. Finding that exact function in a massive codebase can take developers anywhere from 24 days to 9 months. This paper introduces PrismVul, a massive benchmark of 6,851 real-world vulnerabilities, and shows that LLM agents—especially when given historical vulnerability reports as examples—can pinpoint the responsible functions with up to 86.09% Recall@5, outperforming traditional machine learning, code search, and even general bug-localization tools.
What Problem Does This Paper Address?
Imagine someone files a bug report saying they can spoof wikipedia.org in Chrome using lookalike Unicode characters. That tells engineers what went wrong, but not which file or function in a 35-million-line codebase is to blame.
Automating this "vulnerability localization" step is critical to shrinking the window where systems remain exploitable. A natural idea is to learn from past vulnerabilities—after all, public databases like the National Vulnerability Database (NVD) and open-source issue trackers are full of them. Yet, until now, nobody had systematically tested whether historical vulnerability records actually help localize new ones, largely because raw reports are messy: they mix useful technical clues with bot chatter, and later comments or patches often leak the exact fix location, which would unfairly bias any evaluation.
Methods
To test what works, the authors evaluate four families of localization techniques alongside two general-purpose bug localization tools (Agentless and CoSIL):
- Statistical Methods: A simple baseline that ranks functions by how often a given weakness type (CWE) has occurred in them before.
- Machine Learning (ML): Classical text classifiers (like TF-IDF kNN, Random Forest, and Logistic Regression) trained on past reports to predict which previously seen functions are vulnerable.
- Code Information Retrieval (CoIR): Search engines—both sparse (BM25) and dense neural retrievers (Qwen3-Embedding, SweRankEmbed) with optional rerankers—that match the report text directly against function bodies in the target repository.
- LLM Agents: Tool-using agents (powered by GPT-5.6 Sol, Qwen3.7-Plus, and DeepSeek-V4-Pro) that interactively explore the repository using shell commands (
ls,grep,cat, etc.), with version-control history blocked so they cannot cheat by looking at future fixes.
They test these techniques in two settings: within-project (using a project's own past reports) and cross-project (using reports from other projects, for codebases with little history). They also test whether post-fix summaries (NVD descriptions scrubbed of any explicit file or function names) can stand in when historical third-party reports are unavailable.
Datasets
The authors introduce PrismVul, a curated benchmark of 6,851 vulnerability entries across 831 open-source projects, spanning 11 programming languages and 253 CWE categories.
Building PrismVul required solving three data headaches:
- No future leakage: Comments posted after the earliest fix commit were stripped, and an LLM filtered out administrative noise and "fix leaks" (93.30% accuracy on human validation).
- Clean ground truth: Multiple commits fixing the same bug were linked into fix chains, and AST-level differencing (GumTree) extracted modified or removed functions. An LLM agent then separated true root cause functions from supporting fix functions and unrelated refactoring (92.31% accuracy).
- Sanitized alternatives: NVD descriptions were scrubbed of explicit code-location "anchors" to create fair post-fix summaries (96.92% accuracy).
Key Insights and Ideas
- Most vulnerabilities strike new ground: In 88.67% of within-project test cases, none of the root cause functions had ever been vulnerable before. Because statistical and classical ML methods can only predict functions they have seen in training, they are fundamentally bottlenecked.
- Historical reports make agents more thorough: Giving LLM agents up to five similar past reports via retrieval-augmented in-context learning (RAG-ICL) doesn't just give them pattern-matching hints—it encourages them to explore the repository more deeply before settling on an answer.
- Agents are resilient to sparser summaries; retrievers are not: When third-party reports are replaced with shorter post-fix summaries, LLM agents barely flinch (losing at most 3.05 percentage points in Recall@5) because they can actively inspect the code to fill in the blanks. Fine-tuned code retrievers, however, suffer a massive drop of over 27 percentage points.
- Finding one broken function is much easier than finding all of them: When a vulnerability spans three or more functions or files, agents still find at least one relevant function over 73% of the time (Hit@5), but their Recall@5 drops below 55%.
Key Results
- Within-Project Localization (Recall@5):
- LLM Agents: 86.09% (DeepSeek-V4-Pro), 85.53% (GPT-5.6 Sol), 80.62% (Qwen3.7-Plus).
- CoIR (retrieve-and-rerank): 63.08% (Qwen3), 62.17% (SweRank).
- Classical ML / Statistical: 10.26% (TF-IDF kNN) and 1.21% (CWE frequency).
- Cross-Project Localization (Recall@5):
- LLM Agents: 81.76% (DeepSeek-V4-Pro), 80.06% (GPT-5.6 Sol), 77.48% (Qwen3.7-Plus).
- CoIR (retrieve-and-rerank): 60.97% (SweRank), 60.94% (Qwen3).
- General Bug Localization: Agentless and CoSIL (using GPT-5.6 Sol) trail behind the vulnerability-focused agent, scoring 59.41% and 49.54% within-project, and 56.86% and 61.94% cross-project.
- The File-to-Function Gap: Even when techniques identify the right file, pinpointing the exact function inside it remains a hurdle—showing a ~20 percentage point gap for CoIR and ~9 percentage points for agents within projects.
Limitations and Future Work
The authors note that PrismVul relies on public reports and linked fix commits, which skews the dataset toward certain languages and projects. Additionally, because GPT-5.6 Sol helped curate the ground truth, there is a small risk of model-specific bias (though rescoring on a human-validated subset shifted agent Recall@5 by at most 0.11 percentage points).
Looking ahead, the biggest open challenge is multi-location completeness: even the best agent only recovers the complete set of root cause and supporting fix functions 55.69% of the time (Complete@10). However, the authors show that up to 38% of missed root cause functions are directly connected to already-found functions via call-graph relationships (callers, callees, or shared callers)—pointing to a promising next step of baking code structure directly into agentic search.
Summary updated