Quantifiable Uncertainty: A Stochastic Consensus Multi-Agent RAG Framework for Robust Malware Detection
The paper introduces MAGMA, a stochastic consensus multi-agent RAG framework that enhances robust malware detection by decoupling semantic code retrieval from probabilistic verification to quantify epistemic uncertainty and effectively reject ambiguous samples, achieving a 98.4% detection rate.
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 a security guard at a high-tech bank. Your job is to spot thieves (malware) trying to sneak in.
For a long time, security guards used a simple method: they memorized the faces of known thieves. If a face matched a photo in their book, they sounded the alarm. This is like traditional antivirus software. But clever thieves started wearing masks, changing their hair, or using fake IDs (structural mutations). The guards, who only looked at the surface, got fooled. They would confidently say, "That's a normal customer," even though it was a thief in disguise. This is what the paper calls "Confident Wrongness."
The authors of this paper, led by ElMouatez Billah Karbab, built a new system called MAGMA to fix this. Instead of just looking at a photo, MAGMA acts like a team of expert detectives who don't just guess—they investigate.
Here is how MAGMA works, broken down into simple steps:
1. The Two-Lens Camera (Dual-Stream Lifting)
When a new file arrives, MAGMA doesn't just look at the raw code (which is like a jumbled mess of numbers). It uses two different "lenses" to view the file at the same time:
- The Assembly Lens: This looks at the low-level, mechanical instructions (like the engine parts of a car). It sees exactly how the machine is built.
- The Pseudo-Code Lens: This looks at the high-level logic (like the car's manual). It understands what the code is trying to do, ignoring the messy details.
By using both lenses, MAGMA can see through tricks. If a thief changes the engine parts to look different (Assembly), the logic of the car (Pseudo-code) usually stays the same. If they change the logic, the engine parts usually give them away.
2. The Detective's Library (Retrieval-Augmented Generation)
Instead of trying to memorize every possible thief, MAGMA has a massive library of verified "Decision-Critical Functions" (DCFs). These are snippets of code that are known to be malicious, like a "Wanted" poster for specific criminal behaviors.
When a new file arrives, MAGMA doesn't guess. It immediately searches its library to see if the file's code matches any of these "Wanted" snippets. This grounds the system in real evidence rather than just guessing.
3. The Jury of Detectives (Stochastic Consensus Ensemble)
This is the most unique part. Instead of one detective making a decision, MAGMA sends the evidence to five different AI detectives (agents).
- These agents are the same, but they are asked to think with a little bit of "randomness" (like asking them to consider different possibilities).
- They all look at the evidence independently and vote: "Guilty" (Malicious) or "Not Guilty" (Benign).
4. The Two Scorecards (FES and ECS)
After the five detectives vote, MAGMA calculates two scores to decide what to do:
- Score 1: Evidence Strength (FES): This asks, "How strong is the proof?" If the detectives found a perfect match to a known "Wanted" poster, this score is high. If they are just guessing, the score is low.
- Score 2: Conflict Score (ECS): This asks, "Are the detectives arguing?"
- If all 5 detectives agree, the score is low (high confidence).
- If 3 say "Guilty" and 2 say "Not Guilty," the score is high. This means the file is confusing or tricky.
5. The "I Don't Know" Button (The Rejection Policy)
In the old system, the guard had to say "Guilty" or "Not Guilty," even if they were unsure. This led to mistakes.
MAGMA has a third option: "Uncertain."
- If the Conflict Score is too high (the detectives are arguing), MAGMA refuses to make a final call.
- Instead, it flags the file and says, "This is too confusing for a machine. Send it to a human expert to review."
The Results
The paper tested this system against thousands of real malware samples, including very tricky ones that change their shape to hide.
- Old Systems: Got confused by the tricks and made confident mistakes.
- MAGMA: Caught 98.4% of the malware.
- The Safety Net: When MAGMA wasn't sure, it stopped and asked for help, which prevented it from making "Confident Wrong" mistakes.
The Trade-off
The paper admits there is a cost. Because MAGMA uses five detectives and searches a library, it takes longer to check a file (about 42 seconds) compared to old systems that check in a fraction of a second.
The authors suggest MAGMA shouldn't replace the fast, initial scanner. Instead, it should act as a second-line expert for the tricky files that the fast scanner can't decide on. It's the difference between a security camera that just takes a photo and a team of forensic experts who analyze the photo to solve the crime.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.