Context-Enhanced Vulnerability Detection Based on Large Language Models
Y. Yang, Binwei Xu, Xiang Gao, Hailong Sun
Beihang University
Key points
From the paper's conclusion- Recently, vulnerability detection approaches leveraging deep learning and large language models (LLMs) have garnered increasing attention.
Abstract
Accurate vulnerability detection is essential to prevent potential security breaches and protect software systems from malicious attacks. Recently, vulnerability detection approaches leveraging deep learning and large language models (LLMs) have garnered increasing attention. However, existing approaches often focus on analyzing individual files or functions, limiting their ability to detect complex and inter-procedural vulnerabilities. Analyzing entire repositories to gather context introduces significant noise and computational overhead. To address these challenges, we propose a context-enhanced approach for vulnerability detection by combining program analysis with LLMs. This method extracts contextual information at multiple abstraction levels to filter out noise, and feeds both the abstracted context and source code into an LLM. Our goal is to strike a balance between providing sufficient detail to accurately capture vulnerabilities and minimizing unnecessary complexity that could hinder model performance. Based on an extensive study using GPT, DeepSeek, and CodeLLaMA with various prompting strategies, our key findings include: First, incorporating abstracted context significantly enhances vulnerability detection effectiveness; Second, different models benefit from distinct levels of abstraction depending on their code understanding capabilities; Third, capturing program behavior through program analysis for general LLM-based code analysis tasks can be a direction that requires further attention.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Modern Approaches to Software Vulnerability Detection: A Survey of Machine Learning, Deep Learning, and Large Language ModelsElectronics · 2025
- Reva: Real-Time Vulnerability Detection through Contextual Probing of Large Language ModelsarXiv · 2026
- Enhancing LLM-Based Vulnerability Detection via Representation-Aware Logical EnsemblearXiv · 2026
- Assessing and Improving Prompting Large Language Models for Software Vulnerability AnalysisACM Transactions on Software Engineering and Methodology · 2026
- Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAGACM Transactions on Software Engineering and Methodology · 2026
- PAGENT: Program Analysis Guided LLM Agent for Proof-of-Concept GenerationProceedings of the ACM on Software Engineering · 2026