Research Article

H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection

Volume: 30 Number: 2 August 25, 2026
EN TR

H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection

Abstract

Software vulnerabilities remain a critical threat to modern software systems, while existing detection approaches often suffer from high computational cost, limited scalability, and severe class imbalance in real-world datasets. To address these challenges, this study proposes H-LLM-IM, an adaptive imbalance-aware hybrid framework for efficient software vulnerability detection. The proposed framework leverages semantic code embeddings extracted from a pre-trained code language model (CodeBERT) and integrates them with lightweight machine learning classifiers, thereby avoiding expensive fine-tuning of large language models. A key contribution of H-LLM-IM is an adaptive imbalance-aware learning mechanism that dynamically regulates imbalance mitigation intensity through controlled oversampling and adaptive reweighting based on minority-class performance feedback. Extensive experiments conducted on the Big-Vul benchmark dataset evaluate four classifiers (Logistic Regression, SVM, Random Forest, and XGBoost) under multiple imbalance-handling scenarios, including static and adaptive strategies. The results demonstrate that the proposed adaptive framework substantially improves minority-class vulnerability detection, achieving up to a 2.5-fold increase in F1-score and up to 83% improvement in MCC compared to the no-imbalance baseline. Importantly, these performance gains are obtained while maintaining practical training time and controlled memory growth. In particular, Logistic Regression and XGBoost exhibit the most favorable performance–efficiency trade-off, highlighting the scalability and practical applicability of H-LLM-IM for large-scale vulnerability analysis under severe class imbalance.

Keywords

References

  1. [1] Ni, C., Yin, X., Shen, L., Wang, S. 2025. Learning-based models for vulnerability detection: An extensive study. Empirical Software Engineering, 31(1).
  2. [2] Pearce, H., Ahmad, B., Tan, B., Dolan-Gavitt, B., Karri, R. 2025. Asleep at the keyboard? Assessing the security of GitHub Copilot’s code contributions. Communications of the ACM, 68(2), 96–105.
  3. [3] Su, H., Xu, Z., Zhang, Y., et al. 2026. Source code vulnerability detection based on deep learning: A review. Cybersecurity, 9(2).
  4. [4] Guo, Y., Hu, Q., Tang, Q., Le Traon, Y. 2023. An empirical study of the imbalance issue in software vulnerability detection. Lecture Notes in Computer Science, 14514, 371–390.
  5. [5] Ma, X., He, Y., Keung, J., Tan, C., Ma, C., Hu, W., Li, F. 2025. On the value of imbalance loss functions in enhancing deep learning-based vulnerability detection. Expert Systems with Applications, 291, 128504.
  6. [6] 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).
  7. [7] Farasat, T., Posegga, J. 2025. Optimizing code embeddings and ML classifiers for Python source code vulnerability detection. Proceedings of the IEEE/ACM International Conference on Big Data Computing, Applications and Technologies, 1–8.
  8. [8] Bagheri, A., Hegedűs, P. 2021. A comparison of different source code representation methods for vulnerability prediction in Python. Communications in Computer and Information Science, 1439.

Details

Primary Language

English

Subjects

Classification Algorithms, Empirical Software Engineering

Journal Section

Research Article

Publication Date

August 25, 2026

Submission Date

February 23, 2026

Acceptance Date

April 27, 2026

Published in Issue

Year 2026 Volume: 30 Number: 2

APA
Altınsoy, F. (2026). H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection. Süleyman Demirel Üniversitesi Fen Bilimleri Enstitüsü Dergisi, 30(2), 108-127. https://doi.org/10.19113/sdufenbed.1895789
AMA
1.Altınsoy F. H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection. J. Nat. Appl. Sci. 2026;30(2):108-127. doi:10.19113/sdufenbed.1895789
Chicago
Altınsoy, Fatma. 2026. “H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection”. Süleyman Demirel Üniversitesi Fen Bilimleri Enstitüsü Dergisi 30 (2): 108-27. https://doi.org/10.19113/sdufenbed.1895789.
EndNote
Altınsoy F (August 1, 2026) H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection. Süleyman Demirel Üniversitesi Fen Bilimleri Enstitüsü Dergisi 30 2 108–127.
IEEE
[1]F. Altınsoy, “H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection”, J. Nat. Appl. Sci., vol. 30, no. 2, pp. 108–127, Aug. 2026, doi: 10.19113/sdufenbed.1895789.
ISNAD
Altınsoy, Fatma. “H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection”. Süleyman Demirel Üniversitesi Fen Bilimleri Enstitüsü Dergisi 30/2 (August 1, 2026): 108-127. https://doi.org/10.19113/sdufenbed.1895789.
JAMA
1.Altınsoy F. H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection. J. Nat. Appl. Sci. 2026;30:108–127.
MLA
Altınsoy, Fatma. “H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection”. Süleyman Demirel Üniversitesi Fen Bilimleri Enstitüsü Dergisi, vol. 30, no. 2, Aug. 2026, pp. 108-27, doi:10.19113/sdufenbed.1895789.
Vancouver
1.Fatma Altınsoy. H-LLM-IM: An Adaptive Imbalance-Aware Hybrid Framework Using LLM-Based Code Embeddings for Software Vulnerability Detection. J. Nat. Appl. Sci. 2026 Aug. 1;30(2):108-27. doi:10.19113/sdufenbed.1895789

e-ISSN :1308-6529
Linking ISSN (ISSN-L): 1300-7688

All published articles in the journal can be accessed free of charge and are open access under the Creative Commons CC BY-NC (Attribution-NonCommercial) license. All authors and other journal users are deemed to have accepted this situation. Click here to access detailed information about the CC BY-NC license.