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.