Representation Matters: An Empirical Study of Program Representations for LLM Vulnerability Reasoning
This paper introduces RepBench, an empirical study demonstrating that static-analysis-based structural representations (specifically AST+PDG) significantly outperform raw source code in LLM vulnerability detection by mitigating context dilution and offering a superior accuracy-overhead tradeoff.
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 teach a very smart, but slightly distracted, detective (the AI) how to spot a specific type of crime in a massive library of books (the computer code).
For a long time, researchers assumed the best way to help the detective was to hand them the entire raw book. The logic was: "The more pages the detective reads, the more clues they will find."
This paper, titled "Representation Matters," challenges that idea. The authors built a testing ground called RepBench to see if giving the detective a condensed, structured summary of the book works better than giving them the raw text.
Here is the breakdown of their findings using simple analogies:
1. The Experiment: Raw Text vs. The "Blueprint"
The researchers took 107 real-world examples of code vulnerabilities (like a hidden trap in a building). They asked the AI to find these traps using three different types of "input":
- Raw Source Code: The full, unedited book with all the words, comments, and formatting.
- Graphs (AST, CFG, PDG): These are like architectural blueprints or flowcharts. They strip away the words and show only the structure: how the rooms connect, where the doors are, and how water (data) flows through the pipes.
- Hybrids: A mix of the raw book and the blueprints.
2. The Big Surprise: Less is More
The results were counter-intuitive.
- The Raw Book Failed: When the AI read the raw code, it got the answer right only 53.5% of the time. It was like trying to find a specific leak in a house by reading the entire encyclopedia of plumbing theory; the AI got lost in the noise.
- The Blueprints Won: When the AI looked at the structured graphs (specifically a combination of a "Syntax Tree" and a "Dependence Graph"), it got the answer right 83.2% of the time.
- The Hybrid Backfired: When the researchers gave the AI both the raw book and the blueprints, performance actually dropped compared to just the blueprints.
3. The "Context Dilution" Effect
Why did adding more information make the AI worse? The authors call this "Context Dilution."
Think of it like trying to find a needle in a haystack.
- The Blueprint is just the needle. It's small, focused, and easy to see.
- The Raw Code is the haystack.
- The Hybrid is the haystack plus the needle.
The study found that when you give the AI the whole haystack (raw code) along with the needle (graphs), the AI gets distracted by the hay. It starts looking at irrelevant details—like a comment in the code or a helper function that has nothing to do with the bug. The "needle" gets lost in the "hay," and the AI misses the vulnerability.
4. The Efficiency Bonus
There was another benefit: Cost and Speed.
- The raw code prompts were huge (like a 500-page novel).
- The graph-only prompts were much smaller (like a 100-page summary).
- Despite being smaller and cheaper to run, the graph prompts were more accurate.
5. What This Means for the Future
The paper concludes that for AI to be good at spotting security holes, we shouldn't just dump raw code into it. Instead, we should use static analysis tools (the tools that create the blueprints) to act as a "translator."
The Analogy:
Instead of asking the AI to read a 1,000-page legal contract to find a loophole, we should ask a lawyer to read it first, summarize the critical clauses into a 2-page memo, and then give that memo to the AI. The AI can then focus on the logic without getting distracted by the fluff.
In short: The paper proves that for AI security reasoning, structured, compact evidence is far superior to raw, unfiltered data. Giving the AI "more" information often just makes it "less" effective.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.