Journals / Süleyman Demirel Üniversitesi Fen Bilimleri Enstitüsü Dergisi / 2026 / Cilt: 30 Sayı: 2

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

H-LLM-IM: LLM Tabanlı Kod Gömme Temsilleri ile Yazılım Güvenlik Açığı Tespiti için Uyarlanabilir Sınıf Dengesizliğine Duyarlı Hibrit Bir Çerçeve

Fatma Altınsoy(Süleyman Demirel Üniversitesi)0000-0001-5225-7906
Pages
350–369
Publication Date
2026-08-25
🏛️Bibliographic metadata and full text access for this article are provided via DergiPark.
DergiPark Record ↗
✨

AI Summary & Key Takeaways

AI Insight
⚡ TL;DR(Too Long; Didn't Read)

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.

📌 3 Key Takeaways

🎯
Objective & Hypothesis: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.
📊
Key Findings & Data: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.
💡
Conclusion & Impact: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.
🔬Design:Modeling & Simulation
📍Scope:Comprehensive Sample
⚙️Variables:CodeBERT · yazılım zafiyet tespiti · sınıf dengesizliğiyle öğrenme

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.

Özet

Yazılım zafiyetleri, modern yazılım sistemleri için kritik bir tehdit olmaya devam etmektedir. Mevcut zafiyet tespit yaklaşımları ise çoğu zaman yüksek hesaplama maliyeti, sınırlı ölçeklenebilirlik ve gerçek dünya veri kümelerinde görülen ciddi sınıf dengesizliği sorunlarından etkilenmektedir. Bu zorlukların üstesinden gelmek amacıyla bu çalışmada, verimli yazılım zafiyet tespiti için uyarlanabilir ve dengesizlik-duyarlı hibrit bir çerçeve olan H-LLM-IM önerilmektedir. Önerilen çerçeve, önceden eğitilmiş bir kod dil modeli (CodeBERT) aracılığıyla elde edilen anlamsal kod gömülerini kullanmakta ve bunları hafif makine öğrenmesi sınıflandırıcıları ile entegre etmektedir. Böylece büyük dil modellerinin maliyetli ince ayar (fine-tuning) süreçlerinden kaçınılmaktadır. H-LLM-IM’in temel katkılarından biri, azınlık sınıf performans geri bildirimine dayalı olarak kontrollü aşırı örnekleme ve uyarlanabilir yeniden ağırlıklandırma yoluyla dengesizlik giderme yoğunluğunu dinamik biçimde düzenleyen uyarlanabilir bir öğrenme mekanizmasıdır. Big-Vul kıyaslama veri kümesi üzerinde gerçekleştirilen kapsamlı deneylerde, dört farklı sınıflandırıcı (Lojistik Regresyon, SVM, Rastgele Orman ve XGBoost) statik ve uyarlanabilir stratejiler dâhil olmak üzere çeşitli dengesizlik ele alma senaryoları altında değerlendirilmiştir. Elde edilen sonuçlar, önerilen uyarlanabilir çerçevenin azınlık sınıf zafiyet tespit performansını önemli ölçüde iyileştirdiğini göstermektedir. Özellikle, dengesizlik uygulanmayan temel modele kıyasla F1-skorunda 2,5 kata kadar artış ve MCC değerinde %83’e varan iyileşme sağlanmıştır. Önemli olarak, bu performans kazanımları makul eğitim süresi ve kontrollü bellek artışı korunarak elde edilmiştir. Özellikle Lojistik Regresyon ve XGBoost, performans-verimlilik dengesi açısından en avantajlı sonuçları göstermiştir. Bu durum, H-LLM-IM’in şiddetli sınıf dengesizliği altında büyük ölçekli zafiyet analizi için ölçeklenebilir ve pratik olarak uygulanabilir bir çözüm sunduğunu ortaya koymaktadır.

🔖

Cite This Article

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, Cilt: 30 Sayı: 2, 350–369. https://doi.org/10.19113/sdufenbed.1895789

📄 Full Text PDF Viewer

📄

PDF görüntüleyici hazırlanıyor...

References (38)

  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. 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. Su, H., Xu, Z., Zhang, Y., et al. 2026. Source code vulnerability detection based on deep learning: A review. Cybersecurity, 9(2).
  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. 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. 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. 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. 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.
  9. Shaon, M. S. H., Akter, M. S. 2025. Modern approaches to software vulnerability detection: A survey of machine learning, deep learning, and large language models. Electronics, 14(22), 4449.
  10. Wu, F., Wang, J., Liu, J., Wang, W. 2017. Vulnerability detection with deep learning. Proceedings of the IEEE International Conference on Computer and Communications, 1298–1302.
  11. Li, Z., Zou, D., Xu, S., Ou, X., Jin, H., Wang, S., Deng, Z. 2018. VulDeePecker: A deep learning-based system for vulnerability detection. Proceedings of the Network and Distributed System Security Symposium (NDSS).
  12. Li, Z., Zou, D., Xu, S., Jin, H., Zhu, Y., Chen, Z. 2022. SySeVR: A framework for using deep learning to detect software vulnerabilities. IEEE Transactions on Dependable and Secure Computing, 19(4), 2244–2258.
  13. Feng, Z., Guo, D., Tang, D., Duan, N., Feng, X., Gong, M., et al. 2020. CodeBERT: A pre-trained model for programming and natural languages. Proceedings of EMNLP, 1536–1547.
  14. Guo, D., Ren, S., Lu, S., Feng, Z., Tang, D., Liu, S., Zhou, L., Duan, N. 2020. GraphCodeBERT: Pre-training code representations with data flow. Proceedings of the International Conference on Learning Representations (ICLR).
  15. Mim, R., Satter, A., Ahammed, T., Sakib, K. 2024. Automated software vulnerability detection using CodeBERT and convolutional neural network. Proceedings of ENASE, 156–167.
  16. Zhou, Y., Liu, S., Siow, J., Du, X., Liu, Y. 2019. Devign: Effective vulnerability identification via graph neural networks. Advances in Neural Information Processing Systems, 32.
  17. Zheng, W., Jiang, Y., Su, X. 2021. Vulnerability detection based on slice property graph representation learning. IEEE ISSRE, 457–467.
  18. Jin, D., He, C., Zou, Q., Qin, Y., Wang, B. 2025. Source code vulnerability detection based on joint graph and multimodal feature fusion. Electronics, 14(5), 975.
  19. Li, Z., Zou, D., Xu, S., Chen, Z., Zhu, Y., Jin, H. 2022. VulDeeLocator: A fine-grained vulnerability detector. IEEE Transactions on Dependable and Secure Computing, 19(4), 2821–2837.
  20. Fu, M., Tantithamthavorn, C. 2022. LineVul: A transformer-based line-level vulnerability prediction. Proceedings of MSR, 608–620.
  21. Hanif, H., Maffeis, S. 2022. VulBERTa: Simplified source code pre-training for vulnerability detection. IEEE IJCNN.
  22. Wang, Y., Wang, W., Joty, S., Hoi, S. C. 2021. CodeT5: Identifier-aware encoder–decoder models for code understanding. Proceedings of EMNLP, 8696–8708.
  23. Mandal, D., Kosesoy, I. 2023. Prediction of software security vulnerabilities using machine learning. Proceedings of ASYU, 1–6.
  24. Harzevili, N. S., Belle, A. B., Wang, J., Wang, S., Jiang, Z. M. J., Nagappan, N. 2024. A systematic literature review on automated vulnerability detection. ACM Computing Surveys, 57(3).
  25. Chawla, N. V., Bowyer, K. W., Hall, L. O., Kegelmeyer, W. P. 2002. SMOTE: Synthetic minority over-sampling technique. Journal of Artificial Intelligence Research, 16, 321–357.
  26. Steenhoek, B., Rahman, M. M., Jiles, R., Le, W. 2023. An empirical study of deep learning models for vulnerability detection. Proceedings of ICSE, 2237–2248.
  27. Sejfia, A., Das, S., Shafiq, S., Medvidović, N. 2024. Toward improved deep learning-based vulnerability detection. Proceedings of ICSE, 1–12.
  28. Steenhoek, B., Gao, H., Le, W. 2024. Dataflow analysis-inspired deep learning for vulnerability detection. Proceedings of ICSE, 1–13.
  29. Risse, N., Liu, J., Böhme, M. 2025. On benchmarking in machine learning for vulnerability detection. ACM Software Engineering, 2, 388–410.
  30. Kumral, C. D., Topal, A., Ersoy, M., Çolak, R., Yiğit, T. 2022. Random forest performance analysis on FPGA. El-Cezeri Journal of Science and Engineering, 9(4), 1315–1327.
  31. Chakraborty, P., Arumugam, K. K., Alfadel, M., Nagappan, M., McIntosh, S. 2024. Revisiting deep learning-based vulnerability detection. IEEE Transactions on Software Engineering, 50(8), 2163–2177.
  32. Lin, C.-Y., Zhao, H., Liu, J.-H. 2025. Lightweight vulnerability detection for smart contracts. Cybersecurity, 8(1), 28.
  33. Chernis, B., Verma, R. 2018. Machine learning methods for software vulnerability detection. Proceedings of IWSPA, 31–39.
  34. Fan, J., Li, Y., Wang, S., Nguyen, T. N. 2020. A C/C++ vulnerability dataset with code changes and CVE summaries. Proceedings of MSR, 508–512.
  35. Hosmer, D. W., Lemeshow, S., Sturdivant, R. X. 2013. Applied Logistic Regression. Wiley.
  36. Cortes, C., Vapnik, V. 1995. Support-vector networks. Machine Learning, 20, 273–297.
  37. Breiman, L. 2001. Random forests. Machine Learning, 45, 5–32.
  38. Chen, T., Guestrin, C. 2016. XGBoost: A scalable tree boosting system. Proceedings of KDD, 785–794.