Skip to main navigation Skip to search Skip to main content

On the value of imbalance loss functions in enhancing deep learning-based vulnerability detection

  • Xiaoxue Ma
  • , Yanzhong He
  • , Jacky Keung
  • , Cheng Tan
  • , Chuanxiang Ma
  • , Wenhua Hu
  • , Fuyang Li

Research output: Contribution to journal › Article › peer-review

5 Citations (Scopus)

Abstract

Software vulnerability detection is crucial in software engineering and information security, and deep learning has been demonstrated to be effective in this domain. However, the class imbalance issue, where non-vulnerable code snippets vastly outnumber vulnerable ones, hinders the performance of deep learning-based vulnerability detection (DLVD) models. Although some recent research has explored the use of imbalance loss functions to address this issue and enhance model efficacy, they have primarily focused on a limited selection of imbalance loss functions, leaving many others unexplored. Therefore, their conclusions about the most effective imbalance loss function may be biased and inconclusive. To fill this gap, we first conduct a comprehensive literature review of 119 DLVD studies, focusing on the loss functions used by these models. We then assess the effectiveness of nine imbalance loss functions alongside cross entropy (CE) loss (the standard balanced loss function) on two DLVD models across four public vulnerability datasets. Our evaluation incorporates six performance metrics, with results analyzed using the Scott-Knott effect size difference (ESD) test. Furthermore, we employ interpretable analysis to elucidate the impact of loss functions on model performance. Our findings provide key insights for DLVD, which mainly include the following: the LineVul model consistently outperforms the ReVeal model; label distribution aware margin (LDAM) loss achieves the highest Precision, while logit adjustment (LA) loss yields the best Recall; Class balanced focal (CB-Focal) loss excels in comprehensive performance on extremely imbalanced datasets; and LA loss is optimal for nearly balanced datasets. We recommend using LineVul with either CB-Focal loss or LA loss to enhance DLVD outcomes. Our source code and datasets are available at https://github.com/YanzhongHe/DLVD-ImbalanceLossEmpirical.

Original languageEnglish
Article number128504
JournalExpert Systems with Applications
Volume291
DOIs
Publication statusPublished - 1 Oct 2025

Keywords

  • Deep learning
  • Empirical study
  • Imbalance loss functions
  • Vulnerability detection

Fingerprint

Dive into the research topics of 'On the value of imbalance loss functions in enhancing deep learning-based vulnerability detection'. Together they form a unique fingerprint.

Cite this