A Review of Source Code Vulnerability Detection Methods Based on Large Language Models: Models, Techniques, and Evaluation
Main Article Content
Keywords
large language models, source code vulnerability detection, code pretraining models, prompt engineering, reliability evaluation
Abstract
In source code vulnerability detection, large language models (LLMs) are no longer used only as substitutes for traditional fixed classifiers. With prompt design, parameter fine-tuning, and program-context information, they can judge whether code contains vulnerabilities and can also provide suspicious locations and explanatory evidence. This paper takes lightweight code Transformers and large-scale language models as two main lines of discussion. It reviews methods for input construction, task adaptation, the use of program-analysis information, and multi-model collaboration, and compares them in terms of datasets, evaluation metrics, and deployment conditions. Existing studies show that code pretraining, prompt engineering, supervised fine-tuning, and structural-information enhancement can improve detection or explanation results on specific benchmarks. However, such improvements are easily affected by duplicate samples, label noise, random splits, temporal leakage, and changes in model versions, which may lead to overestimated performance. Therefore, model evaluation should not rely on a single metric alone. It should also report the data source, detection granularity, temporal or project-level isolation, false-positive cost, and whether generated explanations can be verified by program evidence. On this basis, this paper further discusses an application approach centered on data governance, strict data splitting, uncertainty calibration, and SAST-LLM-human collaboration. The discussion is limited to source-code-level vulnerability detection, localization, and classification, and does not cover network intrusion detection, malware analysis, smart-contract-specific detection, vulnerability generation, or automatic repair.
References
- [1]Li, Z., Liu, Z., Wong, W. K., Ma, P., & Wang, S. (2024). Evaluating C/C++ vulnerability detectability of query-based static application security testing tools. IEEE Transactions on Dependable and Secure Computing, 21(5), 4600-4618. https://doi.org/10.1109/TDSC.2024.3354789
- [2]Liang, C., Wei, Q., Du, J., Wang, Y., & Jiang, Z. (2025). Survey of source code vulnerability analysis based on deep learning. Computers & Security, 148, 104098. https://doi.org/10.1016/j.cose.2024.104098
- [3]Shiri Harzevili, N., Boaye Belle, A., Wang, J., Wang, S., Jiang, Z. M., & Nagappan, N. (2024). A systematic literature review on automated software vulnerability detection using machine learning. ACM Computing Surveys, 57(3), 1-36.
- [4]Su, H., Xu, Z., Zhang, Y., & Tan, Q. (2026). Source code vulnerability detection based on deep learning: a review. Cybersecurity, 9(1), 2. https://doi.org/10.1186/s42400-025-00518-7
- [5]Fu, M., & Tantithamthavorn, C. (2022, May). Linevul: A transformer-based line-level vulnerability prediction. In Proceedings of the 19th international conference on mining software repositories (pp. 608-620). https://doi.org/10.1145/3524842.3528452
- [6]Mao, Q., Li, Z., Hu, X., Liu, K., Xia, X., & Sun, J. (2025). Towards explainable vulnerability detection with large language models. IEEE Transactions on Software Engineering, 51(10). https://doi.org/10.1109/TSE.2025.3605442
- [7]Zhou, Y., Liu, S., Siow, J., Du, X., & Liu, Y. (2019). Devign: Effective vulnerability identification by learning comprehensive program semantics via graph neural networks. Advances in neural information processing systems, 32. arXiv:1909.03496
- [8]Feng, Z., Guo, D., Tang, D., Duan, N., Feng, X., Gong, M., ... & Zhou, M. (2020, November). Codebert: A pre-trained model for programming and natural languages. In Findings of the association for computational linguistics: EMNLP 2020 (pp. 1536-1547). https://doi.org/10.18653/v1/2020.findings-emnlp.139
- [9]Guo, D., Ren, S., Lu, S., Feng, Z., Tang, D., Liu, S., ... & Zhou, M. (2020). Graphcodebert: Pre-training code representations with data flow. arXiv preprint arXiv:2009.08366.
- [10]Zhou, X., Zhang, T., & Lo, D. (2024, April). Large language model for vulnerability detection: Emerging results and future directions. In Proceedings of the 2024 ACM/IEEE 44th International Conference on Software Engineering: New Ideas and Emerging Results (pp. 47-51). https://doi.org/10.1145/3639476.3639762
- [11]Lu, G., Ju, X., Chen, X., Pei, W., & Cai, Z. (2024). GRACE: Empowering LLM-based software vulnerability detection with graph structure and in-context learning. Journal of Systems and Software, 212, 112031. https://doi.org/10.1016/j.jss.2024.112031
- [12]Yang, Y., Zhou, X., Mao, R., Xu, J., Yang, L., Zhang, Y., ... & Zhang, H. (2025). Dlap: A deep learning augmented large language model prompting framework for software vulnerability detection. Journal of Systems and Software, 219, 112234. https://doi.org/10.1016/j.jss.2024.112234
- [13]Wang, Z., Li, G., Li♂, J., Li, J., Yan, M., Xiong, Y., & Jin, Z. (2026). M2CVD: Enhancing vulnerability understanding through multi-model collaboration for code vulnerability detection. ACM Transactions on Software Engineering and Methodology, 35(7), 1-25. https://doi.org/10.1145/3771923
- [14]Ding, Y., Fu, Y., Ibrahim, O., Sitawarin, C., Chen, X., Alomair, B., ... & Chen, Y. (2024). Vulnerability detection with code language models: How far are we?. arXiv preprint arXiv:2403.18624.
- [15]Gnieciak, D., & Szandala, T. (2025). Large language models versus static code analysis tools: A systematic benchmark for vulnerability detection. IEEE Access, 13, 198410-198422. https://doi.org/10.1109/ACCESS.2025.3635168
- [16]Haque, R., Ali, A., McClean, S., & Khan, N. (2026). A zero-shot framework for cross-project vulnerability detection in source code. Empirical Software Engineering, 31(1), 3. https://doi.org/10.1007/s10664-025-10749-4
- [17]Chen, Y., Ding, Z., Alowain, L., Chen, X., & Wagner, D. (2023, October). Diversevul: A new vulnerable source code dataset for deep learning based vulnerability detection. In Proceedings of the 26th international symposium on research in attacks, intrusions and defenses (pp. 654-668). https://doi.org/10.1145/3607199.3607242
- [18]Jiang, Y., Yang, Z.‑H., Su, X.‑H., Huang, S., & Wang, T.‑T. (2026). A survey of source code vulnerability detection methods based on large language models. Chinese Journal of Computers, 49(6), 1385–1423. https://doi.org/10.11897/SP.J.1016.2026.01385.
- [19]Liu, J., Tian, X., Shu, Y., Zhu, X., Liu, Y., & Liu, Q. (2024). A review of security research in the development stage of software supply chain enhanced by large models. Journal of Cyber Security, 9(5), 87–109. https://doi.org/10.19363/J.cnki.cn10‑1380/tn.2024.09.11.
- [20]Taghavi Far, S. M., & Feyzi, F. (2025). Large language models for software vulnerability detection: a guide for researchers on models, methods, techniques, datasets, and metrics. International Journal of Information Security, 24(2), 78. https://doi.org/10.1007/s10207-025-00992-7
- [21]Sheng, Z., Chen, Z., Gu, S., Huang, H., Gu, G., & Huang, J. (2025). Llms in software security: A survey of vulnerability detection techniques and insights. ACM Computing Surveys, 58(5), 1-35. https://doi.org/10.1145/3769082
- [22]Wang, L., Lu, G., Chen, X., Dai, X., & Qiu, J. (2025). SIFT: enhance the performance of vulnerability detection by incorporating structural knowledge and multi-task learning. Automated Software Engineering, 32(2), 38. https://doi.org/10.1007/s10515-025-00507-7
- [23]Yin, X., Ni, C., & Wang, S. (2024). Multitask-based evaluation of open-source llm on software vulnerability. IEEE Transactions on Software Engineering, 50(11), 3071-3087. https://doi.org/10.1109/TSE.2024.3470333
- [24]Shestov, A., Levichev, R., Mussabayev, R., Maslov, E., Zadorozhny, P., Cheshkov, A., ... & Krassovitskiy, A. (2025). Finetuning large language models for vulnerability detection. IEEE Access, 13, 38889-38900. https://doi.org/10.1109/ACCESS.2025.3546700
- [25]Li, J., Cui, L., Zhang, J., Fei, H., Chen, Y., & Zhu, H. (2025, April). Steering large language models for vulnerability detection. In ICASSP 2025-2025 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP) (pp. 1-5). IEEE. https://doi.org/10.1109/ICASSP49660.2025.10887736
- [26]Xuan, C. D., Quang, D. B., & Quang, V. D. (2025). Large language models based vulnerability detection: How does it enhance performance? International Journal of Information Security, 24(1), 69. https://doi.org/10.1007/s10207-025-00983-8
- [27]Ingemann Tuffveson Jensen, R., Tawosi, V., & Alamir, S. (2024, April). Software Vulnerability and Functionality Assessment using Large Language Models. In Proceedings of the Third ACM/IEEE International Workshop on NL-based Software Engineering (pp. 25-28). https://doi.org/10.1145/3643787.3648036
- [28]Mahyari, A. A. (2024, October). Harnessing the power of llms in source code vulnerability detection. In MILCOM 2024-2024 IEEE Military Communications Conference (MILCOM) (pp. 251-256). IEEE. https://doi.org/10.1109/MILCOM61039.2024.10774025
- [29]Yang, Y., Xu, B., Gao, X., & Sun, H. (2026). Context-enhanced vulnerability detection based on large language models. ACM Transactions on Software Engineering and Methodology, 35(8), 1-47. https://doi.org/10.1145/3779222
- [30]Ridoy, S. Z., Shaon, M. S. H., Cuzzocrea, A., & Akter, M. S. (2024, December). Enstack: An ensemble stacking framework of large language models for enhanced vulnerability detection in source code. In 2024 IEEE International Conference on Big Data (BigData) (pp. 6356-6364). IEEE. https://doi.org/10.1109/BIGDATA62323.2024.10825609
- [31]Tamberg, K., & Bahsi, H. (2025). Harnessing large language models for software vulnerability detection: A comprehensive benchmarking study. IEEE Access, 13, 29698-29717. https://doi.org/10.1109/ACCESS.2025.3541146
- [32]Yu, J., Shu, H., Fu, M., Wang, D., Tantithamthavorn, C., Kamei, Y., & Chen, J. (2025, June). A preliminary study of large language models for multilingual vulnerability detection. In Proceedings of the 34th ACM SIGSOFT International Symposium on Software Testing and Analysis (pp. 161-168). https://doi.org/10.1145/3713081.3731746
