[Paper Review] An Empirical Study of Deep Learning Models for Vulnerability Detection
This paper conducts a comprehensive empirical study of 9 state-of-the-art deep learning models for vulnerability detection across the Devign and MSR datasets. It investigates model agreement, training data impact, and interpretability, revealing low inter-model agreement (only 7% consensus), high run-to-run variability (34.9% inconsistency), and that type-specific models outperform general ones, with performance stabilizing at ~1,000 vulnerable examples. The study provides reproducible code, datasets, and insights for improving model robustness and interpretability in software security.
Deep learning (DL) models of code have recently reported great progress for vulnerability detection. In some cases, DL-based models have outperformed static analysis tools. Although many great models have been proposed, we do not yet have a good understanding of these models. This limits the further advancement of model robustness, debugging, and deployment for the vulnerability detection. In this paper, we surveyed and reproduced 9 state-of-the-art (SOTA) deep learning models on 2 widely used vulnerability detection datasets: Devign and MSR. We investigated 6 research questions in three areas, namely model capabilities, training data, and model interpretation. We experimentally demonstrated the variability between different runs of a model and the low agreement among different models' outputs. We investigated models trained for specific types of vulnerabilities compared to a model that is trained on all the vulnerabilities at once. We explored the types of programs DL may consider "hard" to handle. We investigated the relations of training data sizes and training data composition with model performance. Finally, we studied model interpretations and analyzed important features that the models used to make predictions. We believe that our findings can help better understand model results, provide guidance on preparing training data, and improve the robustness of the models. All of our datasets, code, and results are available at https://doi.org/10.6084/m9.figshare.20791240.
Motivation & Objective
- To understand the reliability and consistency of deep learning models in vulnerability detection, especially across different runs and models.
- To evaluate whether training models per vulnerability type improves performance compared to a single unified model.
- To identify code features that make programs difficult for models to predict correctly.
- To examine how training data size and composition affect model performance.
- To analyze which code features models use for predictions using state-of-the-art explanation tools.
Proposed method
- Reproduced 11 SOTA deep learning models, including GNN, RNN, LSTM, CNN, and Transformer architectures, on the Devign and MSR datasets.
- Performed 5-fold cross-validation to reduce bias from project composition in training data.
- Used multiple random seeds to assess run-to-run variability and excluded unstable models with all-0s or all-1s predictions.
- Applied SOTA model interpretation tools (e.g., LIME, Grad-CAM) to extract and compare important code features across models.
- Built a logistic regression model to predict which programs are hard to classify based on code features.
- Analyzed top-10 important lines per prediction to quantify feature overlap and common patterns.
Experimental results
Research questions
- RQ1RQ1: Do models agree on vulnerability detection results? What is the variability across different runs and across different models?
- RQ2RQ2: Are certain types of vulnerabilities easier to detect? Should models be trained per vulnerability type or as a unified model?
- RQ3RQ3: Are programs with specific code features harder to predict correctly, and if so, what are those features?
- RQ4RQ4: Does increasing the training dataset size improve model performance?
- RQ5RQ5: How does the composition of projects in the training data affect model performance?
- RQ6RQ6: What source code features do models use for predictions, and do they agree on important features?
Key findings
- On average, 34.9% of test samples had inconsistent predictions across different runs of the same model, indicating high run-to-run variability.
- Only 7% of test predictions were agreed upon across all 9 models, revealing low consensus among SOTA models.
- Models trained for specific vulnerability types achieved significantly better performance than models trained on all vulnerabilities combined.
- Model performance stabilized with around 1,000 vulnerable examples, suggesting diminishing returns beyond this threshold.
- The logistic regression model trained on code features could predict which programs are hard to classify, indicating identifiable patterns in model failure.
- Interpretation tools revealed that models used overlapping code features, with 3.38 to 6.88 lines in common among the top 10 important lines per prediction.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.