Search papers, labs, and topics across Lattice.
This paper introduces DREA, a novel framework for repository-level vulnerability detection that separates reasoning from exploration through two specialized agents: a planning agent utilizing a large language model (LLM) for hypothesis generation and an explorer agent leveraging a lightweight model for context retrieval. By enabling goal-directed context acquisition, DREA significantly enhances detection reliability, achieving a Pair-Correctness improvement from 19-26% to 30-42% while drastically reducing API costs by offloading over 93% of token usage to the explorer. The findings also highlight a critical issue in security reasoning quality, revealing that a substantial portion of true positives are based on flawed rationales, underscoring the need for improved reasoning mechanisms in LLMs.
DREA not only boosts vulnerability detection accuracy but also slashes API costs by up to 48%, revealing a hidden flaw in LLM reasoning that could reshape security assessments.
Large language models (LLMs) are increasingly applied to vulnerability detection due to their strong code comprehension capabilities, but most existing approaches rely on isolated functions or context extracted by fixed program-analysis rules. These methods cannot adaptively explore repository-level dependencies to gather sufficient context when vulnerabilities span multiple functions or files, compromising detection reliability. We present DREA (Decoupled Reasoning and Exploration Agents), a hypothesis-driven framework for repository-level vulnerability detection. DREA decouples reasoning from exploration through two collaborating agents: a planning agent backed by an advanced LLM that forms vulnerability hypotheses and directs the investigation, and an explorer agent powered by a lightweight model that retrieves repository-level context on demand. Goal-directed context acquisition is the primary source of detection improvement in this design, while offloading token-heavy exploration to the local model keeps inference economically tractable. To support evaluation, we construct RepoPairBench, a repository-grounded benchmark of validated Python vulnerability-fix pairs from real-world projects. Beyond binary detection accuracy, we introduce a reasoning correctness evaluation to assess whether a model's rationale matches the documented vulnerability mechanism. Across three LLMs, DREA improves Pair-Correctness from 19-26% to 30-42% while offloading over 93% of tokens to the explorer, reducing estimated billable API cost by a factor of 16-48. Reasoning correctness analysis further reveals that 26-55% of true positives, for both DREA and the function-only baseline, are correct predictions supported by flawed rationales, identifying security reasoning quality as a shared bottleneck for current LLMs.