TRANSMISSION // 2407.17053v4
Can AI judge how serious a code vulnerability is?
Source published
A study of vulnerable C/C++ functions finds that a tuned machine-learning model performed competitively with separate deep-learning models, while multi-task deep learning improved prediction scores.

Finding a vulnerable function is only part of the security challenge: teams may also need to estimate how it could be exploited and what effects it could have. Researchers compared machine-learning approaches that predict historical CVSSv2 assessment labels from C/C++ code.
A warning that code may be vulnerable does not, by itself, tell developers how urgently to fix it. For example, a flaw that can be exploited remotely without login and affect sensitive data might be prioritized differently from one requiring unusual access. That is an illustration of why assessment can matter—not a finding about any particular vulnerability in this study.
In a study published in the proceedings of the 2024 Empirical Software Engineering and Measurement conference, Anh The Nguyen, Triet Huynh Minh Le and M. Ali Babar tested whether machine-learning (ML) and deep-learning (DL) models could predict vulnerability assessment labels from individual C/C++ functions. The targets were seven CVSS version 2 (CVSSv2) metrics: access vector, access complexity, authentication, confidentiality, integrity, availability and severity. These are historical labels associated with reported vulnerabilities. They are not independent measurements of what an exploit will actually do in every system or deployment.
Learning from vulnerable functions
The researchers started with Big-Vul, a dataset of C/C++ functions associated with vulnerability fixes. They filtered for vulnerable functions that remained available in their source projects, then collected the seven CVSSv2 labels, obtaining 9,993 records. Access-vector information was added using public vulnerability records. This curated set is not a basis for assuming the results apply to every codebase or vulnerability.
The team compared six ML models and five DL models. The ML systems used several ways of representing code, including token counts and sub-token features, which divide code tokens into smaller pieces. The DL systems included sequence models, graph-based models and CodeBERT, a model pretrained on programming and natural language.
In one setup, separate models predicted each assessment metric. In another, DL models used multi-task learning: a single model predicted all seven labels, sharing what it learned across related tasks. The researchers randomly split the data into training, validation and test sets in an 80:10:10 ratio, and removed duplicate or inconsistent functions across the sets. They measured performance with Matthews correlation coefficient (MCC), which reflects correct and incorrect predictions across classes, and macro F1.
Competitive results from different approaches
Among the separate-task models, LightGBM with sub-token features (LGBM + BoST) was the best ML combination, with an average MCC of 0.680 across the seven metrics. CodeBERT was the best separate-task DL model, with an average MCC of 0.673. The paper reports that LGBM + BoST took about one-quarter as long to train as this separate-task CodeBERT setup. This is a comparison of reported training time, not inference or total deployment cost. CodeBERT did better on access vector, one of the seven prediction tasks.
When DL models predicted all seven metrics together, their MCC improved compared with the corresponding separate-task versions. The reported average relative improvements were 8–22%, depending on the DL model. The best multi-task CodeBERT model had an MCC 8% higher than the best ML model. It also took nearly 23% less total training time than training seven separate CodeBERT models.
The results therefore point to different trade-offs within the tested models: the best separate-task ML combination was competitive and faster to train in this experiment, while the best multi-task CodeBERT model scored higher than the best ML model on the reported comparison. These results do not establish that either approach will perform best in other settings, or that its predictions can replace security review.
What the scores can—and cannot—show
The experiment predicts CVSSv2 labels for functions already identified as vulnerable; it does not test whether the models can discover vulnerabilities in arbitrary code. Nor does agreement with historical labels verify real-world exploit outcomes. The researchers used a random split, which is not the same as testing on entirely new projects or future vulnerabilities. They note that results may not generalize to all C/C++ projects, and that their hyperparameter search could not cover every possible configuration.
The study used CVSSv2 Base metrics, excluding optional Temporal and Environmental metrics that can reflect changing exploit conditions or a particular system’s environment. Its findings should therefore be understood in the context of those selected CVSSv2 targets, not as a comparison of current scoring versions.
The paper appeared in conference proceedings, and its authors report releasing data, code and models for further research. It remains one empirical study with a particular dataset, model set and evaluation design. Testing the approach on different projects and evaluation splits would help show how well the results transfer beyond this experiment.
- software security
- vulnerability assessment
- C/C++
- machine learning
- deep learning
- CVSSv2
Related reading
Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.
A New Way to Decide When Neural Networks Update
Source published
Shared keywords: deep learning, machine learning
A more direct route to predicting electronic Hamiltonians
Source published
Shared keywords: deep learning
Neural networks may have broad regions where outputs barely change
Source published
Shared keywords: deep learning, machine learning
How AI coding teams can hide malicious behavior
Source published
Shared keywords: software security
Can LLMs Find Vulnerabilities for the Right Reasons?
Source published
Shared keywords: software security