VulTriage: Triple-Path Context Augmentation for LLM-Based Vulnerability Detection

Wenxin Tang 1 Xiang Zhang 2 Junliang Liu 3 Jingyu Xiao 4 Xi Xiao 1 Jinlong Yang 5 Yuehe Ma 6 Zhenyu Liu 5 Zhengheng Li 7 Zicheng Wang 8 Wang Luo 9 Qing Li 10 Lei Wang 11 Peng Xiangli 12 1 Tsinghua University 2 Henan University 3 Dalian Maritime University 4 The Chinese University of Hong Kong 5 Northwestern Polytechnical University 6 BNU-HKBU United International College 7 Southeast University 8 Jilin University 9 Sun Yat-sen University 10 Peng Cheng Laboratory 11 Guangzhou Intelligence Communications Technology Co., Ltd. 12 The Fifth Electronic Research Institute of MIIT [email protected] [email protected] [email protected] · 2026

Read VulTriage: Triple-Path Context Augmentation for LLM-Based Vulnerability Detection by Wenxin Tang 1 Xiang Zhang 2 Junliang Liu 3 Jingyu Xiao 4 Xi Xiao 1 Jinlong Yang 5 Yuehe Ma 6 Zhenyu Liu 5 Zhengheng Li 7 Zicheng Wang 8 Wang Luo 9 Qing Li 10 Lei Wang 11 Peng Xiangli 12 1 Tsinghua University 2 Henan University 3 Dalian Maritime University 4 The Chinese University of Hong Kong 5 Northwestern Polytechnical University 6 BNU-HKBU United International College 7 Southeast University 8 Jilin University 9 Sun Yat-sen University 10 Peng Cheng Laboratory 11 Guangzhou Intelligence Communications Technology Co., Ltd. 12 The Fifth Electronic Research Institute of MIIT [email protected] [email protected] [email protected] (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-09461.txt.

Introduction

Tang and thirteen colleagues build VulTriage, a three-path context booster for LLM-based vulnerability detection. It targets a fundamental software security task where learning-based methods still struggle with structural dependencies, vulnerability knowledge, and program semantics. Prompting LLMs with source code often misses vulnerabilities or raises false alarms, above all when flawed and clean functions differ only in fine semantic details.

VulTriage enriches LLM input through three paths. A Control Path turns AST, CFG, and DFG structure into words to reveal control and data links. A Knowledge Path pulls CWE-derived vulnerability patterns and examples with mixed dense-sparse search, and a Semantic Path sums up what the code does before the final judgment. These contexts join in one instruction guiding the LLM toward sounder vulnerability reasoning. On the PrimeVul pair test set, VulTriage reaches state-of-the-art performance, beating deep learning and LLM baselines.

Catalog record

CREATORWenxin Tang 1 Xiang Zhang 2 Junliang Liu 3 Jingyu Xiao 4 Xi Xiao 1 Jinlong Yang 5 Yuehe Ma 6 Zhenyu Liu 5 Zhengheng Li 7 Zicheng Wang 8 Wang Luo 9 Qing Li 10 Lei Wang 11 Peng Xiangli 12 1 Tsinghua University 2 Henan University 3 Dalian Maritime University 4 The Chinese University of Hong Kong 5 Northwestern Polytechnical University 6 BNU-HKBU United International College 7 Southeast University 8 Jilin University 9 Sun Yat-sen University 10 Peng Cheng Laboratory 11 Guangzhou Intelligence Communications Technology Co., Ltd. 12 The Fifth Electronic Research Institute of MIIT [email protected] [email protected] [email protected]
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE46 KB
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2605.09461

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

VulTriage: Triple-Path Context Augmentation for LLM-Based Vulnerability Detection Wenxin Tang 1 Xiang Zhang 2 Junliang Liu 3 Jingyu Xiao 4 Xi Xiao 1 Jinlong Yang 5 Yuehe Ma 6 Zhenyu Liu 5 Zhengheng Li 7 Zicheng Wang 8 Wang Luo 9 Qing Li 10 Lei Wang 11 Peng Xiangli 12 1 Tsinghua University 2 Henan University 3 Dalian Maritime University 4 The Chinese University of Hong Kong 5 Northwestern Polytechnical University 6 BNU-HKBU United International College 7 Southeast University 8 Jilin University 9 Sun Yat-sen University 10 Peng Cheng Laboratory 11 Guangzhou Intelligence Communications Technology Co., Ltd. 12 The Fifth Electronic Research Institute of MIIT [email protected] [email protected] [email protected] Abstract Automated vulnerability detection is a fundamental task in software security, yet existing learning-based methods still struggle to capture the structural dependencies, domain-specific vulnerability knowledge, and complex program semantics required for accurate detection. Recent Large Language Models (LLMs) have shown strong code understanding ability, but directly prompting them with raw source code often leads to missed vulnerabilities or false alarms, especially when vulnerable and benign functions differ only in subtle semantic details. To address this, we propose VulTriage, a triple-path context augmentation framework for LLM-based vulnerability detection. VulTriage enhances the LLM input through three complementary paths: a Control Path that extracts and verbalizes AST, CFG, and DFG information to expose control and data dependencies; a Knowledge Path that retrieves relevant CWE-derived vulnerability patterns and examples through hybrid dense–sparse retrieval; and a Semantic Path that summarizes the functional behavior of the code before the final judgment. These contexts are integrated into a unified instruction to guide the LLM toward more reliable vulnerability reasoning. Experiments on the PrimeVul pair test set show that VulTriage achieves state-of-the-art performance, outperforming existing deep learning and LLM-based baselines on key pair-wise and classification metrics. Further ablation studies verify the effectiveness of each path, and additional experiments on the Kotlin dataset demonstrate the generalization ability of VulTriage under low-resource and class-imbalanced settings. Our code is available at https://github.com/vinsontang1/VulTriage 1 Introduction Software vulnerabilities remain a fundamental threat to modern software systems, and automated vulnerability detection has long been an important research topic in both academia and industry. Existing deep learning-based methods, including GNN-based models and pre-trained code models, have made substantial progress 35 ; 2 ; 6 . However, these methods still face practical limitations: GNN-based methods often require complex graph construction and high-quality labels 4 , while pre-trained code models usually treat source code as a linear token sequence and struggle to capture structural dependencies and execution semantics 7 ; 34 . Recent advances in Large Language Models (LLMs) have shown strong capabilities across diverse domains, such as visual understanding 15 ; 31 ; 17 , code generation 23 ; 22 ; 32 , and security analysis 36 . Building on this progress, LLM-driven vulnerability detection has become a promising direction. Recent methods such as VulTrial 30 and ConColl 24 further improve vulnerability detection through multi-agent reasoning, and staged decision making. Despite their effectiveness, directly relying on LLMs to judge raw source code still leaves several important challenges unaddressed. First, LLMs suffer from structural blindness. Source code is usually processed as a token sequence, while many vulnerabilities are determined by cross-statement control-flow paths and data-propagation chains. For example, a buffer overflow may depend on whether user-controlled data reaches a sensitive write operation without proper boundary checks. Such structural evidence is difficult to recover from raw tokens alone. Second, LLMs face knowledge deficiency. The security knowledge acquired during general-purpose pre-training is implicit and scattered, whereas vulnerability detection often requires explicit domain priors, such as vulnerability taxonomies, definitions, and vulnerable code examples. The Common Weakness Enumeration (CWE) database 19 provides a systematic collection of such knowledge, but it is not explicitly grounded in ordinary LLM prompting. Third, LLMs still have a semantic gap when analyzing complex program logic. Real-world vulnerable code often involves pointer operations, nested branches, implicit type conversions, and subtle boundary checks. Even a small semantic misunderstanding, such as overlooking a check or misinterpreting a data dependency, can reverse the final vulnerability judgment. To address the aforementioned limitations, we introduce VulTriage , an LLM-based vulnerability detection framework built upon Triple-Path Context Augmentation. The core idea is to avoid asking the LLM to directly judge raw source code; instead, VulTriage first constructs three complementary contexts for the final decision. First, the Control Path extracts AST, CFG, and Data-Flow Graph (DFG) information and converts them into compact natural-language structural descriptions. Second, the Knowledge Path retrieves relevant vulnerability descriptions and vulnerable code examples from the CWE knowledge base through hybrid dense–sparse retrieval 14 ; 3 . Third, the Semantic Path summarizes the functional behavior of the input code, providing a denoised semantic view before the final judgment. These contexts are integrated into a unified prompt to guide the LLM toward more reliable vulnerability reasoning. Our contributions are summarized as follows: • We propose VulTriage, an LLM-based vulnerability detection framework driven by Triple-Path Context Augmentation, which integrates structural context, vulnerability knowledge, and semantic explanation into a unified decision context for vulnerability reasoning. • We design a Control Path that compresses AST, CFG, and DFG information into LLM-friendly natural-language descriptions, enabling LLMs to better perceive vulnerability-relevant control and data dependencies. • We introduce a Knowledge Path based on hybrid dense–sparse retrieval, which dynamically retrieves CWE-derived vulnerability descriptions and examples to provide explicit domain priors. • We conduct extensive experiments on PrimeVul and additional analyses on ablation settings, low-resource Kotlin data, and attention-based context utilization. The results demonstrate the effectiveness and generalization ability of VulTriage. 2 Related Work 2.1 DL-Based Vulnerability Detection DL-based vulnerability detection methods mainly rely on semantic or structural code representations. Semantic methods treat source code as token sequences and use pre-trained code models such as CodeBERT 6 , CodeT5 26 , UniXCoder 9 , and LineVul 7 for vulnerability prediction. Some later studies further enhance semantic representations through comments 27 , identifier perturbation, counterfactual augmentation 12 , or noisy-label learning 28 . Structure-aware methods instead introduce ASTs, CFGs, DFGs, PDGs, slices 35 ; 11 ; 16 ; 29 , or execution paths 34 ; 21 to capture syntactic, control-flow, and data-flow dependencies, often using GNNs, hybrid Transformer–GNN models 25 , or dependency-aware attention mechanisms. However, these methods usually require task-specific training, complex graph construction, or customized architectures. VulTriage differs by converting structural information into compact natural-language contexts that can directly support LLM reasoning. 2.2 LLM-Based Vulnerability Detection Recent work has explored LLMs for vulnerability detection through direct prompting, chain-of-thought reasoning 5 , multi-agent collaboration 30 ; 24 , or retrieval-augmented generation. These methods improve flexibility and interpretability, especially when external vulnerability knowledge such as CWE 19 descriptions and examples is introduced. Nevertheless, directly prompting LLMs with raw code can be unstable, since the model must simultaneously understand program semantics, trace dependencies, and recall security knowledge. Existing knowledge-augmented or multi-agent methods also often lack explicit structural evidence or introduce additional inference cost. In contrast, VulTriage integrates structural context, retrieved vulnerability knowledge, and semantic explanation into a unified prompt, enabling more reliable LLM-based vulnerability detection. Figure 1: The framework of VulTriage. 3 Methodology In this section, we introduce VulTriage, a framework that augments LLM-driven vulnerability detection with three complementary context streams. Given a

Read the complete text