Project-Bastion commited on
Commit
ed6777f
·
verified ·
1 Parent(s): 586e212

cve-severity-classifier v0.1 (exact severity-head slice of cve-triage)

Browse files
README.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: cisco-ai/SecureBERT2.0-base
4
+ pipeline_tag: text-classification
5
+ library_name: transformers
6
+ language: [en]
7
+ tags: [cve, vulnerability, cvss, severity, security, vulnerability-management, triage, nvd, onnx, transformers.js]
8
+ model-index:
9
+ - name: cve-severity-classifier
10
+ results:
11
+ - task: {type: text-classification, name: CVSS 3.1 severity band from CVE description}
12
+ dataset: {type: cve-list-v5-date-split-sealed-test, name: CVE List V5, CVEs published from 2026-08-01 (sealed test, n=45772)}
13
+ metrics:
14
+ - {type: accuracy, value: 0.664, name: severity band accuracy}
15
+ inference: false
16
+ ---
17
+
18
+ # cve-severity-classifier (experimental v0.1)
19
+
20
+ Predicts the **CVSS 3.1 severity band** of a CVE from its text description: `LOW` (< 4.0), `MEDIUM` (4.0-6.9), `HIGH` (7.0-8.9), `CRITICAL` (>= 9.0).
21
+ It is a standard `text-classification` model (plug it into a `transformers` pipeline), meant as a **triage hint before a real CVSS score exists**. It is only about 66% accurate on new CVEs, so never use it as an official score.
22
+
23
+ **This model is derived from [Project-Bastion/cve-triage](https://huggingface.co/Project-Bastion/cve-triage)**: it is the exact four-row slice of that model's severity head, packaged on its own so it works as an ordinary 4-class classifier. There was no new training and there are no new claims; the numbers below are cve-triage's sealed-test numbers for this head. On 200 validation descriptions the logits of the slice differ from the original head by at most 3e-6.
24
+
25
+ **[Try it in your browser](https://huggingface.co/spaces/Project-Bastion/cve-severity-classifier-demo)**: a static page that runs the model locally (transformers.js, ONNX; 152 MB int8 by default, 599 MB fp32 optional). The text you paste never leaves your device.
26
+
27
+ ## Usage
28
+
29
+ ```python
30
+ from transformers import pipeline
31
+ clf = pipeline("text-classification", model="Project-Bastion/cve-severity-classifier", top_k=None)
32
+ desc = ("A stack-based buffer overflow in the HTTP request parser of ExampleServer before 2.4.1 allows remote "
33
+ "unauthenticated attackers to execute arbitrary code via a long Host header.")
34
+ print(clf(desc, truncation=True, max_length=160)) # [[{'label': 'CRITICAL', 'score': ...}, {'label': 'HIGH', ...}, ...]]
35
+ ```
36
+
37
+ Input is the English CVE description only; the model was trained with a 160-token limit.
38
+
39
+ ## Evaluation (sealed test)
40
+
41
+ Data: CVE List V5 snapshot of 2026-11-20. Split **by publication date**: train = published up to 2026-03-31, validation = April-May 2026, **test = published from 2026-08-01** (June-July left out; exact-duplicate descriptions of training records removed). Target = the band of the CVSS 3.1 base score computed from the vector in the CNA or CISA-ADP record. Test records with a CVSS 3.1 vector: 45,772. The test split was scored once, on the final multi-head model (the weights of this model are a slice of it).
42
+
43
+ | System (test, n = 45,772) | Severity band accuracy |
44
+ |---|---|
45
+ | **cve-severity-classifier (this model)** | **0.664** |
46
+ | TF-IDF + linear SVM (same data) | 0.608 |
47
+ | CIRCL `vulnerability-severity-classification-roberta-base`, revision of 2026-03-30 (predates the training cutoff, so it cannot have seen the test CVEs) | 0.630 |
48
+ | Majority class | 0.406 |
49
+
50
+ **Why a particular CIRCL revision:** CIRCL retrains its model about weekly; its latest revision (2026-11-19) scores 0.786 here, but it has almost certainly been trained on these very CVEs, so that number is not a fair comparison and is not used.
51
+ A second training run of the parent model scored 0.675 against 0.672 on validation, so the run-to-run spread is under one point. Label noise is large: CNAs score differently, so part of the remaining error is disagreement between scorers.
52
+
53
+ ## ONNX / browser
54
+
55
+ `onnx/model.onnx` (fp32, **599 MB**) and `onnx/model_quantized.onnx` (**weight-only int8, 151 MB**: int8 weights with per-channel scales dequantized at load, activations stay fp32). On 200 validation descriptions, in the browser stack (transformers.js in Node) against PyTorch:
56
+ fp32 gives the same top class on 200 of 200 (probability difference 0); int8 on 99.0% (max probability difference 0.037). Standard dynamic or static int8 quantization breaks this architecture, which is why the recipe quantizes weights only.
57
+ (transformers.js keeps a text token instead of the closing `[SEP]` when it truncates; the demo restores it.)
58
+
59
+ ## Known limits
60
+
61
+ * About 66% band accuracy on new CVEs; the parent model's other heads (CWE, CVSS components) are in `cve-triage`.
62
+ * Trained on CVEs up to March 2026; the 2026 surge of bulk-reported CVEs shifts the distribution, so expect drift.
63
+ * English descriptions only; no exploitability, environment or CVSS 4.0 information; not an official score.
64
+ * The model is a 150M-parameter encoder for a 4-class task; if size matters, the TF-IDF baseline (0.608) is far smaller.
65
+
66
+ ## License and credits
67
+
68
+ Apache-2.0. Data: the CVE List (cvelistV5) used under the CVE Program Terms of Use. CVE® is a registered trademark of The MITRE Corporation; CVE content copyright © The MITRE Corporation.
69
+ Base model `cisco-ai/SecureBERT2.0-base` (Apache-2.0). CIRCL's model (CC-BY-4.0) was used only as a baseline.
config.json ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ModernBertForSequenceClassification"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 50281,
8
+ "classifier_activation": "gelu",
9
+ "classifier_bias": false,
10
+ "classifier_dropout": 0.0,
11
+ "classifier_pooling": "mean",
12
+ "cls_token_id": 50281,
13
+ "decoder_bias": true,
14
+ "deterministic_flash_attn": false,
15
+ "dtype": "float32",
16
+ "embedding_dropout": 0.0,
17
+ "eos_token_id": 50282,
18
+ "global_attn_every_n_layers": 3,
19
+ "gradient_checkpointing": false,
20
+ "hidden_activation": "gelu",
21
+ "hidden_size": 768,
22
+ "id2label": {
23
+ "0": "LOW",
24
+ "1": "MEDIUM",
25
+ "2": "HIGH",
26
+ "3": "CRITICAL"
27
+ },
28
+ "initializer_cutoff_factor": 2.0,
29
+ "initializer_range": 0.02,
30
+ "intermediate_size": 1152,
31
+ "label2id": {
32
+ "CRITICAL": 3,
33
+ "HIGH": 2,
34
+ "LOW": 0,
35
+ "MEDIUM": 1
36
+ },
37
+ "layer_norm_eps": 1e-05,
38
+ "layer_types": [
39
+ "full_attention",
40
+ "sliding_attention",
41
+ "sliding_attention",
42
+ "full_attention",
43
+ "sliding_attention",
44
+ "sliding_attention",
45
+ "full_attention",
46
+ "sliding_attention",
47
+ "sliding_attention",
48
+ "full_attention",
49
+ "sliding_attention",
50
+ "sliding_attention",
51
+ "full_attention",
52
+ "sliding_attention",
53
+ "sliding_attention",
54
+ "full_attention",
55
+ "sliding_attention",
56
+ "sliding_attention",
57
+ "full_attention",
58
+ "sliding_attention",
59
+ "sliding_attention",
60
+ "full_attention"
61
+ ],
62
+ "local_attention": 128,
63
+ "max_position_embeddings": 8192,
64
+ "mlp_bias": false,
65
+ "mlp_dropout": 0.0,
66
+ "model_type": "modernbert",
67
+ "norm_bias": false,
68
+ "norm_eps": 1e-05,
69
+ "num_attention_heads": 12,
70
+ "num_hidden_layers": 22,
71
+ "pad_token_id": 50283,
72
+ "position_embedding_type": "absolute",
73
+ "repad_logits_with_grad": false,
74
+ "rope_parameters": {
75
+ "full_attention": {
76
+ "rope_theta": 160000.0,
77
+ "rope_type": "default"
78
+ },
79
+ "sliding_attention": {
80
+ "rope_theta": 10000.0,
81
+ "rope_type": "default"
82
+ }
83
+ },
84
+ "sep_token_id": 50282,
85
+ "sparse_pred_ignore_index": -100,
86
+ "sparse_prediction": false,
87
+ "tie_word_embeddings": true,
88
+ "transformers_version": "5.24.0",
89
+ "vocab_size": 50368
90
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8808b9e4c83f51079643e148eb19278cf6521b2c82ca903ded482e3ba35dc4e
3
+ size 598445936
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccbc8cb5264290639f5b772cccf4cd5021eb33a85111536152a4c5eb3f08a9fc
3
+ size 599014897
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83bd08a23b6009fbce3661b0cb67c8ab2ab6db72e218306ce720b19547567508
3
+ size 151066825
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "clean_up_tokenization_spaces": true,
4
+ "cls_token": "[CLS]",
5
+ "is_local": true,
6
+ "local_files_only": false,
7
+ "mask_token": "[MASK]",
8
+ "max_length": 160,
9
+ "model_input_names": [
10
+ "input_ids",
11
+ "attention_mask"
12
+ ],
13
+ "model_max_length": 8192,
14
+ "pad_token": "[PAD]",
15
+ "sep_token": "[SEP]",
16
+ "stride": 0,
17
+ "tokenizer_class": "TokenizersBackend",
18
+ "truncation_side": "right",
19
+ "truncation_strategy": "longest_first",
20
+ "unk_token": "[UNK]"
21
+ }