Text Classification
Transformers
Safetensors
Chinese
bert
vulnerability
severity
cybersecurity
cnvd
text-embeddings-inference
Instructions to use CIRCL/vulnerability-severity-classification-chinese-macbert-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CIRCL/vulnerability-severity-classification-chinese-macbert-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="CIRCL/vulnerability-severity-classification-chinese-macbert-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("CIRCL/vulnerability-severity-classification-chinese-macbert-base") model = AutoModelForSequenceClassification.from_pretrained("CIRCL/vulnerability-severity-classification-chinese-macbert-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
End of training
Browse files- README.md +54 -63
- config.json +1 -1
- emissions.csv +1 -1
- model.safetensors +1 -1
- training_args.bin +1 -1
README.md
CHANGED
|
@@ -1,84 +1,75 @@
|
|
| 1 |
---
|
| 2 |
-
language:
|
| 3 |
-
- zh
|
| 4 |
-
license: cc-by-4.0
|
| 5 |
library_name: transformers
|
| 6 |
-
|
| 7 |
-
- text-classification
|
| 8 |
-
- vulnerability
|
| 9 |
-
- severity
|
| 10 |
-
- cybersecurity
|
| 11 |
-
- cnvd
|
| 12 |
-
datasets:
|
| 13 |
-
- CIRCL/Vulnerability-CNVD
|
| 14 |
base_model: hfl/chinese-macbert-base
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
---
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
A fine-tuned [hfl/chinese-macbert-base](https://huggingface.co/hfl/chinese-macbert-base) model for classifying Chinese vulnerability descriptions from the [China National Vulnerability Database (CNVD)](https://www.cnvd.org.cn/) into three severity levels: **Low**, **Medium**, and **High**.
|
| 21 |
-
|
| 22 |
-
Trained on the [CIRCL/Vulnerability-CNVD](https://huggingface.co/datasets/CIRCL/Vulnerability-CNVD) dataset as part of the [VulnTrain](https://github.com/vulnerability-lookup/VulnTrain) project.
|
| 23 |
-
|
| 24 |
-
## Evaluation results
|
| 25 |
-
|
| 26 |
-
Evaluated on a **deduplicated test set** (25,878 samples) where no description text appears in both train and test splits, preventing data leakage from CNVD's reuse of boilerplate descriptions across different vulnerability IDs.
|
| 27 |
-
|
| 28 |
-
| Class | Precision | Recall | F1-score | Support |
|
| 29 |
-
|--------|-----------|--------|----------|---------|
|
| 30 |
-
| Low | 0.5995 | 0.4203 | 0.4942 | 2,315 |
|
| 31 |
-
| Medium | 0.7902 | 0.8141 | 0.8020 | 14,358 |
|
| 32 |
-
| High | 0.7637 | 0.7850 | 0.7742 | 9,205 |
|
| 33 |
-
|
| 34 |
-
- **Overall accuracy**: 76.85%
|
| 35 |
-
- **Macro F1**: 0.6901
|
| 36 |
|
| 37 |
-
#
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
##
|
| 42 |
|
| 43 |
-
|
| 44 |
-
from transformers import pipeline
|
| 45 |
|
| 46 |
-
|
| 47 |
-
"text-classification",
|
| 48 |
-
model="CIRCL/vulnerability-severity-classification-chinese-macbert-base"
|
| 49 |
-
)
|
| 50 |
|
| 51 |
-
|
| 52 |
-
result = classifier(description)
|
| 53 |
-
print(result)
|
| 54 |
-
```
|
| 55 |
|
| 56 |
-
##
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
- **Base model**: [hfl/chinese-macbert-base](https://huggingface.co/hfl/chinese-macbert-base)
|
| 71 |
-
- **Dataset**: [CIRCL/Vulnerability-CNVD](https://huggingface.co/datasets/CIRCL/Vulnerability-CNVD)
|
| 72 |
-
- **Train/test split**: deduplicated on description text (no leakage), 80/20 split
|
| 73 |
-
- **Loss**: uniform cross-entropy (no class weighting)
|
| 74 |
-
- **Learning rate**: 3e-05
|
| 75 |
-
- **Batch size**: 16
|
| 76 |
-
- **Epochs**: 5
|
| 77 |
-
- **Best model selection**: by accuracy
|
| 78 |
|
| 79 |
-
##
|
| 80 |
|
| 81 |
-
-
|
| 82 |
-
-
|
| 83 |
-
-
|
| 84 |
-
-
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
base_model: hfl/chinese-macbert-base
|
| 5 |
+
tags:
|
| 6 |
+
- generated_from_trainer
|
| 7 |
+
metrics:
|
| 8 |
+
- accuracy
|
| 9 |
+
model-index:
|
| 10 |
+
- name: vulnerability-severity-classification-chinese-macbert-base
|
| 11 |
+
results: []
|
| 12 |
---
|
| 13 |
|
| 14 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 15 |
+
should probably proofread and complete it, then remove this comment. -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# vulnerability-severity-classification-chinese-macbert-base
|
| 18 |
|
| 19 |
+
This model is a fine-tuned version of [hfl/chinese-macbert-base](https://huggingface.co/hfl/chinese-macbert-base) on an unknown dataset.
|
| 20 |
+
It achieves the following results on the evaluation set:
|
| 21 |
+
- Loss: 1.3218
|
| 22 |
+
- Accuracy: 0.7674
|
| 23 |
+
- F1 Macro: 0.6841
|
| 24 |
+
- Low Precision: 0.6086
|
| 25 |
+
- Low Recall: 0.3957
|
| 26 |
+
- Low F1: 0.4796
|
| 27 |
+
- Medium Precision: 0.7772
|
| 28 |
+
- Medium Recall: 0.8328
|
| 29 |
+
- Medium F1: 0.8040
|
| 30 |
+
- High Precision: 0.7775
|
| 31 |
+
- High Recall: 0.7603
|
| 32 |
+
- High F1: 0.7688
|
| 33 |
|
| 34 |
+
## Model description
|
| 35 |
|
| 36 |
+
More information needed
|
|
|
|
| 37 |
|
| 38 |
+
## Intended uses & limitations
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
More information needed
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
## Training and evaluation data
|
| 43 |
|
| 44 |
+
More information needed
|
| 45 |
|
| 46 |
+
## Training procedure
|
| 47 |
|
| 48 |
+
### Training hyperparameters
|
| 49 |
|
| 50 |
+
The following hyperparameters were used during training:
|
| 51 |
+
- learning_rate: 3e-05
|
| 52 |
+
- train_batch_size: 32
|
| 53 |
+
- eval_batch_size: 32
|
| 54 |
+
- seed: 42
|
| 55 |
+
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 56 |
+
- lr_scheduler_type: linear
|
| 57 |
+
- num_epochs: 5
|
| 58 |
|
| 59 |
+
### Training results
|
| 60 |
|
| 61 |
+
| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 Macro | Low Precision | Low Recall | Low F1 | Medium Precision | Medium Recall | Medium F1 | High Precision | High Recall | High F1 |
|
| 62 |
+
|:-------------:|:-----:|:-----:|:---------------:|:--------:|:--------:|:-------------:|:----------:|:------:|:----------------:|:-------------:|:---------:|:--------------:|:-----------:|:-------:|
|
| 63 |
+
| 1.4130 | 1.0 | 3232 | 1.2715 | 0.7284 | 0.6372 | 0.5215 | 0.3753 | 0.4365 | 0.7085 | 0.8753 | 0.7831 | 0.8343 | 0.5912 | 0.6920 |
|
| 64 |
+
| 1.0385 | 2.0 | 6464 | 1.1791 | 0.7534 | 0.6666 | 0.5617 | 0.3766 | 0.4509 | 0.7657 | 0.8157 | 0.7899 | 0.7658 | 0.7524 | 0.7591 |
|
| 65 |
+
| 1.0116 | 3.0 | 9696 | 1.1752 | 0.7643 | 0.6794 | 0.5771 | 0.3999 | 0.4724 | 0.7607 | 0.8523 | 0.8039 | 0.8078 | 0.7206 | 0.7617 |
|
| 66 |
+
| 0.7759 | 4.0 | 12928 | 1.2329 | 0.7646 | 0.6801 | 0.6004 | 0.3931 | 0.4751 | 0.7646 | 0.8462 | 0.8033 | 0.7939 | 0.7324 | 0.7619 |
|
| 67 |
+
| 0.5545 | 5.0 | 16160 | 1.3218 | 0.7674 | 0.6841 | 0.6086 | 0.3957 | 0.4796 | 0.7772 | 0.8328 | 0.8040 | 0.7775 | 0.7603 | 0.7688 |
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
+
### Framework versions
|
| 71 |
|
| 72 |
+
- Transformers 5.15.0
|
| 73 |
+
- Pytorch 2.13.0+cu130
|
| 74 |
+
- Datasets 4.8.5
|
| 75 |
+
- Tokenizers 0.22.2
|
config.json
CHANGED
|
@@ -39,7 +39,7 @@
|
|
| 39 |
"pooler_type": "first_token_transform",
|
| 40 |
"problem_type": "single_label_classification",
|
| 41 |
"tie_word_embeddings": true,
|
| 42 |
-
"transformers_version": "5.
|
| 43 |
"type_vocab_size": 2,
|
| 44 |
"use_cache": false,
|
| 45 |
"vocab_size": 21128
|
|
|
|
| 39 |
"pooler_type": "first_token_transform",
|
| 40 |
"problem_type": "single_label_classification",
|
| 41 |
"tie_word_embeddings": true,
|
| 42 |
+
"transformers_version": "5.15.0",
|
| 43 |
"type_vocab_size": 2,
|
| 44 |
"use_cache": false,
|
| 45 |
"vocab_size": 21128
|
emissions.csv
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
timestamp,project_name,run_id,experiment_id,duration,emissions,emissions_rate,cpu_power,gpu_power,ram_power,cpu_energy,gpu_energy,ram_energy,energy_consumed,water_consumed,country_name,country_iso_code,region,cloud_provider,cloud_region,os,python_version,codecarbon_version,cpu_count,cpu_model,gpu_count,gpu_model,longitude,latitude,ram_total_size,tracking_mode,cpu_utilization_percent,gpu_utilization_percent,ram_utilization_percent,ram_used_gb,on_cloud,pue,wue
|
| 2 |
-
2026-
|
|
|
|
| 1 |
timestamp,project_name,run_id,experiment_id,duration,emissions,emissions_rate,cpu_power,gpu_power,ram_power,cpu_energy,gpu_energy,ram_energy,energy_consumed,water_consumed,country_name,country_iso_code,region,cloud_provider,cloud_region,os,python_version,codecarbon_version,cpu_count,cpu_model,gpu_count,gpu_model,longitude,latitude,ram_total_size,tracking_mode,cpu_utilization_percent,gpu_utilization_percent,ram_utilization_percent,ram_used_gb,on_cloud,pue,wue
|
| 2 |
+
2026-08-18T07:43:00,VulnTrain,b9dc86ff-1b4b-4d0a-86e2-8f31b6aafdd5,5b0fa12a-3dd7-45bb-9766-cc326314d9f1,3848.338559512049,0.08975977537364227,2.332429280469112e-05,70.00062838110752,656.1602428069918,70.0,0.07482258372379585,0.703132053060699,0.0747645083438243,0.8527191451283193,0.0,Luxembourg,LUX,luxembourg,,,Linux-6.8.0-106-generic-x86_64-with-glibc2.39,3.12.3,3.3.0,224,Intel(R) Xeon(R) Platinum 8480+,2,2 x NVIDIA H100 NVL,6.1327,49.6098,2015.336296081543,machine,1.2381609794217245,74.44139098723626,2.237900494920552,44.93622604513206,N,1.0,0.0
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 409103316
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3e1a5ce07213ef8aa1d0f39ad10ee391c980b94ee4aadf317716a5f11b2e5dcc
|
| 3 |
size 409103316
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5265
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c5afa1bfecd62ee240e124f5bb925d427a7a7373086dec2cc4205139c79849b2
|
| 3 |
size 5265
|