AI
New AI Framework Improves Detection of Software Vulnerabilities Using Graph Analysis and Multi-Task Learning
Researchers introduce GRAML, a method that combines program graph reasoning with large language models to identify security flaws in code more accurately than existing approaches.
A research team has developed GRAML, a framework designed to enhance how large language models detect vulnerabilities in software by grounding their reasoning in program structure and improving the explanations they generate.
The Core Problem#
LLMs show promise for identifying software vulnerabilities, but existing graph-based approaches struggle with a persistent challenge: distinguishing relevant from irrelevant connections in program structure. When analyzing code, these models often encounter excessive or weakly connected graph relations that obscure which lines of code are actually vulnerable and how they relate to one another. Additionally, vulnerability descriptions produced by LLMs frequently miss critical details or make claims that aren't supported by the actual source code.
How GRAML Works#
The framework tackles these issues through two main innovations:
- Graph Refinement: GRAML uses structural propagation, relation diversity analysis, and redundancy filtering to isolate vulnerability-relevant code segments and their meaningful connections within the program graph.
- Improved Reasoning: The team developed a "Tree-of-Thought-based Vulnerability Reasoning" (ToT-VR) approach that generates multiple candidate explanations for vulnerabilities, then evaluates which ones align with the source code—a step up from simpler chain-of-thought methods.
The resulting descriptions are combined with detection, localization, and assessment tasks to create four-task fine-tuning across code LLMs.
Performance Results#
Evaluation across seven vulnerability detection datasets showed substantial gains. GRAML achieved F1 scores between 67.08% and 69.32%, outperforming baseline methods by 2 to 31 percentage points. ToT-VR explanations improved results by 4.43 to 6.99 percentage points over conventional reasoning, while multi-task training delivered gains of 8.03 to 18.26 percentage points compared to detection-only approaches.
Why It Matters#
As software vulnerabilities pose growing security risks, automated detection tools that reliably identify flaws while providing trustworthy explanations become increasingly valuable for developers and security teams.

