← Latest papers
🤖 AI

MulVul: Retrieval-augmented Multi-Agent Code Vulnerability Detection via Cross-Model Prompt Evolution

MulVul is a retrieval-augmented multi-agent framework that addresses the limitations of single-model vulnerability detection and manual prompt engineering by employing a coarse-to-fine routing strategy and a novel cross-model prompt evolution mechanism to achieve significantly higher accuracy across diverse vulnerability types.

Original authors: Zihan Wu, Jie Xu, Yun Peng, Chun Yong Chong, Xiaohua Jia

Published 2026-01-28
📖 5 min read🧠 Deep dive

Original authors: Zihan Wu, Jie Xu, Yun Peng, Chun Yong Chong, Xiaohua Jia

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to find specific types of bugs in a massive library of computer code. This is a bit like trying to find a needle in a haystack, but the "needles" come in thousands of different shapes, sizes, and colors.

The paper introduces a new system called MulVul to solve this problem. Here is how it works, explained through simple analogies:

The Problem: One Size Doesn't Fit All

Imagine you hire a single, very smart detective to find every kind of crime in a city.

  • The Issue: Some crimes are like bank robberies (requiring knowledge of locks and alarms), while others are like identity theft (requiring knowledge of social engineering). A single detective might be great at one but terrible at the other.
  • The Old Way: Previous AI tools tried to use one "super-detective" to catch everything at once. Because there are so many different types of code vulnerabilities (over 130 types!), this single detective often gets confused, misses things, or cries wolf (false alarms).
  • The Manual Problem: You could try to write a specific set of instructions (a "prompt") for the AI for every single type of vulnerability. But with hundreds of types, writing and testing these instructions by hand is impossible—it takes too long and is too expensive.

The Solution: MulVul (The Specialized Team)

MulVul changes the game by using a team of specialists instead of one generalist. It works in two main phases:

1. The "Router" (The Traffic Cop)

When a piece of code arrives, it doesn't go to everyone. First, it goes to a Router Agent.

  • What it does: The Router looks at the code and asks, "What kind of trouble is this likely to be?" It doesn't need to know the exact bug; it just needs to guess the broad category (e.g., "This looks like a memory error" or "This looks like an injection attack").
  • The Trick: It uses a Retrieval Tool. Think of this as the Router flipping through a giant, organized encyclopedia of past crimes to find similar cases before making a guess. This helps it avoid guessing randomly.
  • The Result: It picks the top 3 most likely categories and sends the code only to the specialists who handle those specific categories. This saves time and money.

2. The "Detectors" (The Forensic Experts)

Once the Router sends the code to the right specialists, the Detector Agents take over.

  • What they do: These are highly specialized agents. One only looks for memory errors; another only looks for injection attacks.
  • The Trick: Like the Router, they also use a Retrieval Tool. But they are smarter about it. They look for "contrastive" examples. Imagine a detective comparing a suspect's story to both a true story of a similar crime and a false story of a similar crime to spot the tiny differences. This helps them pinpoint the exact bug without getting confused by similar-looking code.
  • Isolation: Crucially, these detectives work alone. They don't talk to each other. If one detective makes a mistake, it doesn't spread to the others, preventing a chain reaction of errors.

The Secret Sauce: "Cross-Model Prompt Evolution"

Writing the instructions (prompts) for these AI agents is the hardest part. If you ask one AI to write instructions for itself, it might get stuck in a loop, thinking its own bad ideas are good.

MulVul uses a clever two-AI system to fix this:

  1. The Generator (The Architect): One AI (like Claude) tries to write and improve the instructions. It guesses, "Maybe if I say it this way, the AI will do better."
  2. The Executor (The Tester): A different AI (like GPT-4o) actually tries to follow those instructions to find bugs. It reports back: "That instruction worked well" or "That one failed."
  3. The Loop: The Generator uses this feedback to write better instructions, and the Tester checks them again. Because they are different models, the "Architect" can't trick the "Tester" into thinking a bad idea is good. This creates a cycle of constant improvement until the instructions are perfect.

The Results

The authors tested this system on a massive dataset of real-world code vulnerabilities (called PrimeVul).

  • The Score: MulVul achieved a score of 34.79%, which is 41.5% better than the best previous method.
  • Why it matters: It found more real bugs and made fewer false alarms than anything else tested.
  • The "Evolution" Boost: The part where the two AIs improved the instructions together made the system 51.6% better than if humans had just written the instructions manually.

Summary

MulVul is like a high-tech security firm that doesn't rely on one overworked guard. Instead, it uses a smart traffic cop to direct suspects to the right forensic expert, and those experts use a library of past cases to solve the puzzle. To make sure the experts know exactly what to do, the firm uses two different AI brains to constantly rewrite and perfect their rulebooks, ensuring they catch the most dangerous bugs with high accuracy.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →