Structure-Enhanced Prompt Learning for Graph-Based Code Vulnerability Detection
Recent advances in prompt learning have opened new avenues for enhancing natural language understanding in domain-specific tasks, including code vulnerability detection. Motivated by the limitations of conventional binary classification methods in capturing complex code semantics, we propose a novel framework that integrates a two-stage prompt optimization mechanism with hierarchical representation learning. Our approach leverages graphon theory to generate task-adaptive, structurally enriched prompts by encoding both contextual and graphical information into trainable vector representations. To further enhance representational capacity, we incorporate the pretrained model CodeBERTScore, a syntax-aware encoder, and Graph Neural Networks, enabling comprehensive modeling of both local syntactic features and global structural dependencies. Experimental results on three public datasets—FFmpeg+Qemu, SVulD and Reveal—demonstrate that our method performs competitively across all benchmarks, achieving accuracy rates of 64.40%, 83.44% and 90.69%, respectively. These results underscore the effectiveness of combining prompt-based learning with graph-based structural modeling, offering a more accurate and robust solution for automated vulnerability detection.
Authors
- Chunyang Ye (ORCID: https://orcid.org/0000-0002-2177-8255)
- Hui Zhou (ORCID: https://orcid.org/0000-0001-6702-2384)
- Wei Chang (ORCID: https://orcid.org/0009-0006-8892-2721)
Institutions
- Hainan University (CN)
Publication Details
- Journal
- Applied Sciences
- Published
- 2025-05-29
- DOI
- https://doi.org/10.3390/app15116128
- Primary Topic
- Software Reliability and Analysis Research
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- National Natural Science Foundation of China
- National Key Research and Development Program of China