Downloads · 30 days
4
7% of all-time downloads
LorenzoNava/deberta-v3-base-cve-cwe-classifier
deberta-v3-base-cve-cwe-classifier is a machine learning model from LorenzoNava. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Fine-tuned DeBERTa-v3-Base model for predicting Common Weakness Enumeration (CWE) IDs from Common Vulnerabilities and Exposures (CVE) descriptions.
Downloads · 30 days
4
7% of all-time downloads
All-time downloads
57
Public
Parameters
436M
1.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.7 GB · 99%
From the Hugging Face model README
Fine-tuned DeBERTa-v3-Base model for predicting Common Weakness Enumeration (CWE) IDs from Common Vulnerabilities and Exposures (CVE) descriptions.
Base Model: microsoft/deberta-v3-base (86M parameters) Task: Multi-class text classification (695 CWE classes) Training Dataset: stasvinokur/cve-and-cwe-dataset-1999-2025 Cleaned Dataset: LorenzoNava/cve-cwe-dataset-cleaned (225,144 samples)
learning_rate = 2e-5
num_train_epochs = 10
per_device_train_batch_size = 8 # 32 total across 4 GPUs
gradient_accumulation_steps = 1
warmup_ratio = 0.1
lr_scheduler_type = "cosine"
weight_decay = 0.01
max_sequence_length = 256
optimizer = "paged_adamw_8bit"
gradient_checkpointing = False # Disabled for stability
The original dataset contained 280,694 samples, including 55,550 samples (19.79%) labeled as "NVD-CWE-Other" (non-standard CWE classification).
Cleaning process:
CWE-ID = "NVD-CWE-Other"CWE-XXXX format (numeric IDs)from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model = AutoModelForSequenceClassification.from_pretrained("LorenzoNava/deberta-v3-base-cve-cwe-classifier")
tokenizer = AutoTokenizer.from_pretrained("LorenzoNava/deberta-v3-base-cve-cwe-classifier")
# Example CVE description
cve_description = """
A buffer overflow vulnerability in the web server component allows
remote attackers to execute arbitrary code via a crafted HTTP request.
"""
# Tokenize and predict
inputs = tokenizer(cve_description, return_tensors="pt", truncation=True, max_length=256)
outputs = model(**inputs)
predicted_class = torch.argmax(outputs.logits, dim=-1).item()
predicted_cwe = model.config.id2label[predicted_class]
print(f"Predicted CWE: {predicted_cwe}")
| Metric | Score |
|---|---|
| Accuracy | TBD |
| Weighted F1 | TBD |
| Training Loss | TBD |
| Validation Loss | TBD |
Metrics will be updated after training completes
The model was trained using the following configuration:
python3 train.py \
--model deberta-v3-base \
--epochs 10 \
--batch-size 32 \
--learning-rate 2e-5 \
--max-length 256 \
--early-stopping 5
Full training script included in model repository: train.py
The model predicts from 695 unique CWE classes including:
@model{deberta-v3-cve-cwe-2024,
author = {Berghem - Smart Information Security},
title = {DeBERTa-v3-Base for CVE-CWE Classification},
year = {2024},
publisher = {Hugging Face},
url = {https://huggingface.co/LorenzoNava/deberta-v3-base-cve-cwe-classifier}
}
MIT License - See LICENSE file
Berghem - Smart Information Security
For issues or questions, visit the model repository.