On Predicting Vulnerability Severity Using In-Context Learning: An Industrial Case Study
Authors: Daniel Rodriguez-Cardenas, David Nader Palacio, Anna Schmedding, Yiyang Lu, Aadil Mallick, Bill Hudson, Chris Gourley, Michael Roytman, Chris Shenefiel, Evgenia Smirni, Denys Poshyvanyk
Organizations: William & Mary Williamsburg, VA, USA · Microsoft Seattle, WA, USA · Cisco Systems San Jose, CA, USA
Modern software systems require earlier and more scalable vulnerability severity assessment to reduce exposure to high-impact security flaws. Security analysts typically assign CVSS scores, but this manual triage does not scale with the growth of disclosed vulnerabilities and often depends on cloud LLM services that raise confidentiality concerns. This paper presents an industrial case study on predicting CVSS v3.1 scores directly from vulnerable C/C++ snippets using in-context learning with locally deployable, open-source LLMs. We compare proprietary data with the Big-Vul dataset, showing sufficiently aligned CVSS distributions to justify Big-Vul as a proxy for industrial data when constructing prompt-based testbeds. We then vary in-context configurations and model parameters, evaluating CodeLlama2-7B, CodeLlama2-13B, Mistral-7B, gpt-oss, and GPT4o-mini using mean squared error (MSE) and feasibility metrics. Our results show that medium-sized open-source code models, particularly CodeLlama2-7B, can approximate the best cloud performance for CVSS regression when guided by lightweight, output-constraining prompts, offering a practical, privacy-preserving building block for severity triage in industrial settings.
Figures & tables
Fig. 1 : In-Context Learning Solution as a Severity Score Prediction Pipeline
Fig. 2 : In-Context Learning Configuration. C3 aggregates a specific output format to answer the question compared to C2 .
Fig. 3 : Big-Vul dataset: on the left, the sequence size frequency; on the right, the CVSS score distribution for raw data and filtered dataset.
Training
Test
Sequence Size
medium
43856
5524
short
10425
1334
Documentation
Snippet + Summary
139607
17568
Total
150908
18864
TABLE I : Open-data Big-Vul size after curation
Severity
Train Count
Test Count
None (0)
530
63
Low (0.1–3.9)
3853
472
Medium (4–6.9)
31386
3926
High (7–8.9)
14749
1889
Critical (9–10)
3763
508
TABLE II : Counts per severity impact for train and test datasets with combined sequence size
Fig. 4 : Proprietary dataset frequencies: on the left, the KCVSS score, on the right, the assigned CVSS to the proprietary snippets.
Fig. 5 : Propietary CVSS correlation with KCVSS and kenna risk, color represents the frequency.
Model
C
T
MSE Mean
Std. MSE
Gt. Mean
Gt. Std.
% Non Feasible
CodeLlama2 7B
C1
0.001
7.91
13.01
6.14
1.82
0.00
0.300
6.69
9.63
6.44
1.33
0.00
C2
0.001
8.36
12.74
6.13
1.83
0.50
0.300
6.98
10.35
6.10
1.89
0.00
C3
0.001
10.00
16.21
6.06
1.88
4.00
0.300
10.87
15.76
6.21
1.73
4.50
TABLE III : Mean Squared Error calculated for each model with sequences short and medium size combined with 3-shots, varying the temperature T
Model
i
C
Seq. Size
MSE Mean
Std. MSE
% Non Feasible
Gt. Mean
Gt. Std.
Ex. Mean
Ex. Std.
short
18.46
20.48
0.34
6.36
1.79
-
0.00
C1
medium
11.38
14.93
2.34
5.96
2.00
-
0.00
short
30.16
24.20
0.00
6.36
1.71
-
0.00
C2
medium
14.22
18.17
0.00
6.16
1.71
-
0.00
short
10.18
12.80
0.00
6.47
1.92
-
0.00
0
C3
medium
11.55
12.50
0.00
5.93
1.82
-
0.00
TABLE IV : Mean Squared Error calculated for C1 , C2 , and C3 among shots i=0,1,3 and temperature T=0.3
Model
C
Seq. Size
l
Avg. MSE
Std. MSE
Non Feasible
Out-Of- Range
Ex. Mean
Ex. Std.
Gt. Mean
Gt. Std.
0
19.88
6.51
22.61%
0.23%
-
-
6.08
1.79
1
7.65
6.52
0.00%
0.10%
6.08
1.96
6.09
1.85
2
8.20
6.68
0.00%
0.01%
5.95
1.89
6.19
1.84
medium
3
9.01
7.20
0.00%
0.04%
6.01
1.91
6.12
1.86
0
32.08
4.99
16.00%
0.07%
-
-
6.11
1.70
1
11.53
9.27
0.00%
0.19%
6.13
2.08
6.13
2.08
TABLE V : Mean Squared Error calculated for each model and sequence sizes with temperature of T=0.9
Fig. 6 : Confusion matrix for stratified CVSS classification using CodeLlama2-7B , CodeLlama2-13B and GPT4o-mini with n=600 datapoints.
Until April 2026, the National Vulnerability Database labeled nearly every published Common Vulnerabilities and Exposures (CVE) entry with a Common Vulnerability Scoring System (CVSS) v3.1 vector, a severity tier, and a Common Weakness Enumeration (CWE) weakness type. Now, NIST enriches only the high priority CVEs, leaving many newly published vulnerabilities unlabelled with the classifiers that security teams use for patch triage. In CVE enrichment, we predict the eight base components of CVSS v3.1 vector, base score, severity tier, and CWE from the vulnerability's textual description alone. To prevent leakage between near-duplicate descriptions, all systems are trained only on CVEs published in 2022 and 2023. Results are evaluated on all 36,325 usable 2024 CVEs in the pinned NVD snapshot. All scores are either directly predicted, or calculated from predicted vectors using the CVSS formula. A fine-tuned 3.8B-parameter model Phi-3.5-mini, trained with LoRA in 2.5 hours on a single Apple M5 Pro chip, achieves 69.9% accuracy on severity and 70.9% on CWE. It matches the official vector exactly for 48.8% of test CVEs, outperforming TF-IDF logistic regression by 2.8 to 4.7 points on all accuracy metrics based on zero-exclusion paired bootstrap intervals. When we evaluate the base model with a zero-shot prompt, it achieves 20.8% accuracy on severity in a sample of 2,000 CVEs. In this same sample, its stated scores match its own vector precisely for only 3.4% of CVEs. However, deriving scores from predicted vectors boosts the critical recall of TF-IDF logistic regression from 50.7% to 73.3% with no additional cost. And since the errors of the fine-tuned model and TF-IDF affect different CVEs, at least one system matches the correct severity tier for 75.8% of test CVEs.
Automated vulnerability detection is a fundamental task in software security, yet existing learning-based methods still struggle to capture the structural dependencies, domain-specific vulnerability knowledge, and complex program semantics required for accurate detection. Recent Large Language Models (LLMs) have shown strong code understanding ability, but directly prompting them with raw source code often leads to missed vulnerabilities or false alarms, especially when vulnerable and benign functions differ only in subtle semantic details. To address this, we propose VulTriage, a triple-path context augmentation framework for LLM-based vulnerability detection. VulTriage enhances the LLM input through three complementary paths: a Control Path that extracts and verbalizes AST, CFG, and DFG information to expose control and data dependencies; a Knowledge Path that retrieves relevant CWE-derived vulnerability patterns and examples through hybrid dense--sparse retrieval; and a Semantic Path that summarizes the functional behavior of the code before the final judgment. These contexts are integrated into a unified instruction to guide the LLM toward more reliable vulnerability reasoning. Experiments on the PrimeVul pair test set show that VulTriage achieves state-of-the-art performance, outperforming existing deep learning and LLM-based baselines on key pair-wise and classification metrics. Further ablation studies verify the effectiveness of each path, and additional experiments on the Kotlin dataset demonstrate the generalization ability of VulTriage under low-resource and class-imbalanced settings. Our code is available at https://github.com/vinsontang1/VulTriage
Wenxin Tang, Xiang Zhang, Junliang Liu +11
Tsinghua University · Henan University · Dalian Maritime University +8
Large language models are increasingly used for vulnerability detection, yet their reliability under different prompt formulations remains uncharacterized. We present PromptAudit, a controlled evaluation framework that isolates prompt effects by fixing the dataset, decoding, and parsing while varying only the prompting strategy. Using five prompting strategies across five open-weight models on 1,000 CVEs (6,074 code samples spanning 16 programming languages), we evaluate accuracy, recall, abstention, coverage, and effective F1. We find that standard chain-of-thought prompting achieves the strongest overall operational performance, while few-shot prompting provides model-dependent benefits that are most pronounced for prompt-sensitive models. In contrast, adaptive chain-of-thought frequently suppresses recall and self-consistency induces excessive abstention, sharply reducing effective performance. These results show that vulnerability detection behavior is jointly determined by the model and the prompt, and that prompt sensitivity is a first-class system property that must be explicitly characterized in evaluation and deployment.
Steffen J. Camarato, Yahya Hmaiti, Mandana Ghadamian +1
University of Central Florida Orlando, Florida, USA