Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAG
Xueying Du, Geng Zheng, Kaixin Wang, Yi Zou, Yujia Wang, Wentai Deng, Jiayi Feng, Mingwei Liu,
Fudan University · Alibaba Group (China)
Key points
From the paper's conclusion- We design a novel knowledge-level Retrieval-Augmented Generation framework Vul-RAG, which improves LLMs with an accuracy increase of 16% - 24% in identifying vulnerable and patched code.
Abstract
Although LLMs have shown promising potential in vulnerability detection, this study reveals their limitations in distinguishing between vulnerable and similar-but-benign patched code (only 0.06 - 0.14 accuracy). It shows that LLMs struggle to capture the root causes of vulnerabilities during vulnerability detection. To address this challenge, we propose enhancing LLMs with multi-dimensional vulnerability knowledge distilled from historical vulnerabilities and fixes. We design a novel knowledge-level Retrieval-Augmented Generation framework Vul-RAG, which improves LLMs with an accuracy increase of 16% - 24% in identifying vulnerable and patched code. Additionally, vulnerability knowledge generated by Vul-RAG can further (1) serve as high-quality explanations to improve manual detection accuracy (from 60% to 77%), and (2) detect 10 previously-unknown bugs in the recent Linux kernel release with 6 assigned CVEs.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Retrieve, Reproduce, Reveal: Dissecting Retrieval-Augmented Software Vulnerability DetectionarXiv · 2026
- Assessing and Improving Prompting Large Language Models for Software Vulnerability AnalysisACM Transactions on Software Engineering and Methodology · 2026
- Context-Enhanced Vulnerability Detection Based on Large Language ModelsACM Transactions on Software Engineering and Methodology · 2025
- Enhancing LLM-Based Vulnerability Detection via Representation-Aware Logical EnsemblearXiv · 2026
- Reva: Real-Time Vulnerability Detection through Contextual Probing of Large Language ModelsarXiv · 2026
- Fine-Grained Reasoning Enhanced Vulnerability Patch Generation with Multi-View Fix KnowledgeACM Transactions on Software Engineering and Methodology · 2026