MAVUL: Multi-Agent Vulnerability Detection via Contextual Reasoning and Interactive Refinement

Youpeng Li, Kartik Joshi, Xinda Wang, Eric Wong · DOI

TL;DR

MAVUL is a novel multi-agent framework that transforms vulnerability detection from a simple classification task into an interactive, reasoning-heavy process. By pairing a "Vulnerability Analyst" agent that uses tools to explore code context with a "Security Architect" agent that provides critical feedback, MAVUL achieves a 62% improvement in accuracy over existing multi-agent systems and a staggering 600% improvement over single-agent baselines.

What Problem Does This Paper Address?

Automated vulnerability detection (VD) is a high-stakes challenge in software security. While Large Language Models (LLMs) have shown promise, the authors identify three critical gaps in current approaches:

  1. Lack of Context: Most models look at a single function in isolation. However, real-world bugs are often "cross-procedural," meaning the vulnerability only becomes apparent when you see how data flows between different functions (callers and callees).
  2. Single-Round Limitations: Standard VD is usually a "one-shot" guess. In the real world, security experts iterate, debate, and refine their findings.
  3. Evaluation Bias: Traditional benchmarks use binary labels (vulnerable vs. safe). This allows models to get the "right" answer for the "wrong" reasons (e.g., flagging a function as vulnerable but misidentifying the bug type), leading to misleadingly high performance scores.

Methods

MAVUL (Multi-Agent Vulnerability Detection) introduces a collaborative workflow involving three specialized agents:

  • Vulnerability Analyst Agent: The "worker" agent. It doesn't just read the provided code; it uses a Tool Set (get_callers, get_callees, get_function_body) to autonomously explore the repository and understand the broader context of a target function.
  • Security Architect Agent: The "reviewer" agent. It acts as a senior expert, reviewing the Analyst's reasoning and providing specific critiques. If the Architect disagrees, the Analyst must self-reflect and refine its prediction in the next round.
  • Evaluation Judge Agent: To solve the "evaluation bias" problem, this agent acts as an unbiased judge. It compares the Analyst’s final reasoning against rich ground-truth data (CWE IDs, CVE descriptions, and patches) to ensure the model actually understood the vulnerability.

The system uses GPT-4o as its backbone and employs a multi-round conversation (up to 3 rounds) to reach a consensus.

Datasets

The researchers used JitVul, a dataset derived from PrimeVul that includes high-quality labels for pre-patched (vulnerable) and post-patched (safe) code.

  • The Evaluated Set: A meticulously cleaned subset of 200 pair-wise samples (400 functions total) across 90 different projects.
  • Metadata: Unlike standard datasets, this includes CWE IDs, CVE descriptions, commit messages, and the actual patches, which are used by the Evaluation Judge to verify the model's reasoning.

Key Insights and Ideas

  • Feedback is the Catalyst: The most significant finding was that performance scales with communication. The "Pairwise-Correct" (P-C) score jumped from 3.5% in Round 1 to 17.5% in Round 3. The Architect agent prevents the Analyst from getting "lost" in irrelevant code.
  • The "LLM-as-a-Judge" Necessity: The authors found that traditional binary evaluation is highly flawed. Without the Evaluation Judge, models like VulTrial appeared to have 22% accuracy, but the Judge revealed that many of those "correct" hits had completely wrong reasoning, dropping the true accuracy significantly.
  • Tool-Use Enables Deep Reasoning: By allowing the Analyst to "walk" the call graph, MAVUL can trace a vulnerability from a suspicious "sink" (where the crash happens) back to its "source" (where the bad data enters), mimicking human expert behavior.

Key Results

MAVUL outperformed all baselines across several metrics, most notably the P-C (Pairwise-Correct) score, which requires the model to correctly identify the vulnerable version and correctly clear the safe version of a code pair:

  • MAVUL: 17.5% P-C Score.
  • GPTLens (Multi-agent): 13.5% P-C Score.
  • VulTrial (Multi-agent): 8.0% P-C Score.
  • JitVul (Single-agent): 3.5% P-C Score.
  • CoT (Chain of Thought): 1.5% P-C Score.

Ablation studies showed that removing the Security Architect caused an 80% drop in performance, proving that interactive refinement is the "secret sauce" of the system.

Limitations and Future Work

  • Token Consumption: Multi-round interactions with large code contexts are expensive and slow. Future work could involve optimizing memory management or using more efficient "summarization" agents.
  • Model Dependency: The system relies heavily on GPT-4o's superior tool-calling and reasoning. The authors noted that current open-source models (like DeepSeek-R1 at the time of writing) had lower "hit rates" for tool use in this specific framework.
  • Dataset Scale: While high-quality, the evaluation set of 200 pairs is relatively small. Expanding this to thousands of pairs would further validate the system's robustness.

Summary updated

BibTeX
@misc{li2025mavul,
  author = {Youpeng Li and Kartik Joshi and Xinda Wang and Eric Wong},
  title = {{MAVUL: Multi-Agent Vulnerability Detection via Contextual Reasoning and Interactive Refinement}},
  year = {2025},
  eprint = {2510.00317},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.00317},
}
Figure