Next Article in Journal
Continued Electromagnetic Signal Classification Based on Vector Space Separation
Previous Article in Journal
Real-Time Adaptive Optimization for Underwater Optical Wireless Communications Using LSTM–NSGA-II
Previous Article in Special Issue
TextShelter: Text Adversarial Example Defense Based on Input Reconstruction
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
This is an early access version, the complete PDF, HTML, and XML versions will be available soon.
Article

Retrieval-Augmented Semantic Mapping for Vulnerability Detection via Multi-View Code Similarity

1
School of Computer Science and Technology, Harbin University of Science and Technology, Harbin 150080, China
2
Faculty of Computing, Harbin Institute of Technology, Harbin 150001, China
*
Author to whom correspondence should be addressed.
Electronics 2026, 15(3), 612; https://doi.org/10.3390/electronics15030612
Submission received: 23 November 2025 / Revised: 25 December 2025 / Accepted: 19 January 2026 / Published: 30 January 2026
(This article belongs to the Special Issue Advancements in AI-Driven Cybersecurity and Securing AI Systems)

Abstract

With the rapid growth in the scale and complexity of software systems, automated vulnerability detection has become increasingly important. Although Large Language Models (LLMs) demonstrate strong code comprehension capabilities, their abilities in vulnerability detection are still limited by issues such as hallucinations, high fine-tuning costs, and difficulties in effectively leveraging fine-grained historical vulnerability patterns and domain knowledge. To address these challenges, we propose Retrieval-Augmented Semantic Mapping for Vulnerability Detection (RASM-Vul), a retrieval-augmented framework that enhances LLM detection capability through multi-perspective semantic mapping. The core of our approach is the construction of a comprehensive knowledge base composed of vulnerability–fix pairs and structured knowledge. We leverage multi-view (e.g., code, AST, knowledge) similarity retrieval to accurately match the most relevant vulnerability patterns with repair examples for the code under analysis. Our designed Weighted Reciprocal Ranking Fusion (WRRF) algorithm adaptively integrates contributions from different retrieval channels according to the problem type, significantly improving the relevance and accuracy of retrieval. Experiments show that RASM-Vul achieves an F1-score of 66.79%, outperforming existing baselines on the PrimeVul paired dataset. Our study demonstrates that knowledge-enhanced semantic mapping and retrieval can improve the robustness and reliability of automated vulnerability detection.
Keywords: vulnerability detection; code augmentation; retrieval-augmented generation; software security vulnerability detection; code augmentation; retrieval-augmented generation; software security

Share and Cite

MDPI and ACS Style

Zhao, T.; Ma, C.; Zhang, L.; Yang, J.; Nie, L. Retrieval-Augmented Semantic Mapping for Vulnerability Detection via Multi-View Code Similarity. Electronics 2026, 15, 612. https://doi.org/10.3390/electronics15030612

AMA Style

Zhao T, Ma C, Zhang L, Yang J, Nie L. Retrieval-Augmented Semantic Mapping for Vulnerability Detection via Multi-View Code Similarity. Electronics. 2026; 15(3):612. https://doi.org/10.3390/electronics15030612

Chicago/Turabian Style

Zhao, Tiancheng, Chao Ma, Luogang Zhang, Jinbo Yang, and Lili Nie. 2026. "Retrieval-Augmented Semantic Mapping for Vulnerability Detection via Multi-View Code Similarity" Electronics 15, no. 3: 612. https://doi.org/10.3390/electronics15030612

APA Style

Zhao, T., Ma, C., Zhang, L., Yang, J., & Nie, L. (2026). Retrieval-Augmented Semantic Mapping for Vulnerability Detection via Multi-View Code Similarity. Electronics, 15(3), 612. https://doi.org/10.3390/electronics15030612

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop