English

VULPO: Context-Aware Vulnerability Detection via On-Policy LLM Optimization

Cryptography and Security 2026-05-28 v3 Artificial Intelligence Software Engineering

Abstract

Large language models (LLMs) have recently shown strong potential in vulnerability detection (VD). However, accurately detecting vulnerabilities in real-world repositories requires reasoning over complex contextual interactions. Existing LLM-based VD approaches remain limited because current datasets lack complete contextual information and high-quality reasoning supervision, while existing optimization methods primarily rely on coarse outcome-centric supervision signals that fail to model the vulnerability reasoning process. To address these limitations, we first construct ContextVul, a new dataset that augments high-quality function-level vulnerability benchmarks with repository-level contextual information and curated vulnerability reasoning traces. Building upon ContextVul, we introduce a two-stage optimization framework consisting of lightweight cold-start supervised fine-tuning followed by vulnerability-adaptive on-policy optimization (VULPO). VULPO incorporates multidimensional rewards that jointly evaluate vulnerability identification, vulnerability-relevant localization, and causal reasoning quality, along with difficulty-adaptive reward scaling to mitigate reward hacking and improve RL effectiveness. Extensive experiments demonstrate the superiority of VULPO for context-aware VD. Our VULPO-4B, the first specialized vulnerability reasoning LLM, substantially outperforms existing VD baselines, improving Pairwise Pass@1 by 203% relative to Qwen3-4B and achieving competitive performance against a 150% larger-scale LLM, DeepSeek-V3.1.

Keywords

Cite

@article{arxiv.2511.11896,
  title  = {VULPO: Context-Aware Vulnerability Detection via On-Policy LLM Optimization},
  author = {Youpeng Li and Fuxun Yu and Weiliang Qi and Xinda Wang},
  journal= {arXiv preprint arXiv:2511.11896},
  year   = {2026}
}
R2 v1 2026-07-01T07:38:29.247Z