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...
Saved in:
| Main Authors: | , , |
|---|---|
| Format: | Article |
| Language: | English |
| Published: |
MDPI AG
2025-05-01
|
| Series: | Applied Sciences |
| Subjects: | |
| Online Access: | https://www.mdpi.com/2076-3417/15/11/6128 |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| _version_ | 1850129052717809664 |
|---|---|
| author | Wei Chang Chunyang Ye Hui Zhou |
| author_facet | Wei Chang Chunyang Ye Hui Zhou |
| author_sort | Wei Chang |
| collection | DOAJ |
| description | 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. |
| format | Article |
| id | doaj-art-196d3c5930744ab998f9527bd44d9779 |
| institution | OA Journals |
| issn | 2076-3417 |
| language | English |
| publishDate | 2025-05-01 |
| publisher | MDPI AG |
| record_format | Article |
| series | Applied Sciences |
| spelling | doaj-art-196d3c5930744ab998f9527bd44d97792025-08-20T02:33:07ZengMDPI AGApplied Sciences2076-34172025-05-011511612810.3390/app15116128Structure-Enhanced Prompt Learning for Graph-Based Code Vulnerability DetectionWei Chang0Chunyang Ye1Hui Zhou2School of Cybersapce Security, Hainan University, Haikou 570228, ChinaSchool of Computer Science and Technology, Hainan University, Haikou 570228, ChinaSchool of Computer Science and Technology, Hainan University, Haikou 570228, ChinaRecent 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.https://www.mdpi.com/2076-3417/15/11/6128vulnerability detectionsyntax awareprompt learninggraphoncode property graph |
| spellingShingle | Wei Chang Chunyang Ye Hui Zhou Structure-Enhanced Prompt Learning for Graph-Based Code Vulnerability Detection Applied Sciences vulnerability detection syntax aware prompt learning graphon code property graph |
| title | Structure-Enhanced Prompt Learning for Graph-Based Code Vulnerability Detection |
| title_full | Structure-Enhanced Prompt Learning for Graph-Based Code Vulnerability Detection |
| title_fullStr | Structure-Enhanced Prompt Learning for Graph-Based Code Vulnerability Detection |
| title_full_unstemmed | Structure-Enhanced Prompt Learning for Graph-Based Code Vulnerability Detection |
| title_short | Structure-Enhanced Prompt Learning for Graph-Based Code Vulnerability Detection |
| title_sort | structure enhanced prompt learning for graph based code vulnerability detection |
| topic | vulnerability detection syntax aware prompt learning graphon code property graph |
| url | https://www.mdpi.com/2076-3417/15/11/6128 |
| work_keys_str_mv | AT weichang structureenhancedpromptlearningforgraphbasedcodevulnerabilitydetection AT chunyangye structureenhancedpromptlearningforgraphbasedcodevulnerabilitydetection AT huizhou structureenhancedpromptlearningforgraphbasedcodevulnerabilitydetection |