🤖 AI Summary
This work addresses the limitation of existing learning-based vulnerability detection methods, which are often confined to single-function analysis and struggle to capture real-world vulnerabilities requiring cross-function context. The authors propose VulAgentRL, a novel framework that uniquely leverages code property graphs (CPGs) for both tool querying during inference and evidence verification during training. By employing reinforcement learning, an agent is guided to actively explore inter-procedural call relationships and data flows, while persistent graph node IDs precisely anchor evidential traces to construct a well-founded reward mechanism. To mitigate exploration difficulty in tool usage, the approach incorporates teacher policy distillation. Evaluated under a strict repository-level split that prevents data leakage, VulAgentRL significantly outperforms baseline methods—including large language models—in pairwise accuracy, achieves higher efficiency with fewer tool calls, and demonstrates robustness under out-of-distribution and class-imbalanced scenarios.
📝 Abstract
Real-world vulnerabilities often span multiple functions, yet most learning-based detectors classify each function in isolation: on a sample of real CVEs, we find that 71.7% of vulnerable functions require evidence from outside the function to be classified correctly. Agentic reinforcement learning (RL) could close this gap by enabling a model to gather that evidence itself, but it lacks a reliable reward, since a reward defined on the final verdict alone can be obtained without performing any investigation. We propose VulAgentRL, an agentic RL framework for interprocedural vulnerability detection built on a Code Property Graph (CPG). The CPG serves two roles: at inference time the policy queries it for callers, callees, dataflow, and other queries, and at training time the same graph verifies the evidence the policy cites. Because every CPG node carries a persistent integer identifier, this verification is an exact comparison rather than a textual match, so the reward credits verdicts that are supported by evidence. We further initialize the policy by distilling teacher investigations, and show that this warm start is necessary, since RL cannot acquire tool-use behavior it never samples. Under a repository-level split that prevents leakage, VulAgentRL outperforms state-of-the-art baselines, including frontier models, on the strict pair-wise-correct metric while issuing fewer tool calls, and its advantage persists on an out-of-distribution corpus and under class imbalance.