A QLoRA fine-tune of
Qwen3-8B
that maps a free-text
CVE description
to the
CWE weakness
ID(s)
it corresponds to. The LoRA adapter is merged into the base and released in 16-bit, so it
loads directly with
transformers
. A higher-quality (larger) variant is at
exploitintel/cve-cwe-qwen3-32b
.
Trained only on labels where
NVD and the CNA agree
after roll-up to
CWE View-1003
— see the
cve-cwe-consensus
dataset.
Results (held-out test split, 6,802 rows)
Metric
Score
Exact-match
0.676
Micro-F1
0.702
Macro-F1
0.511
By difficulty (does the description
name
the weakness, or must it be inferred?):
Stratum
n
Exact-match
Micro-F1
Easy (weakness named)
2,046
0.841
0.870
Hard (must infer)
4,756
0.605
0.628
The macro-F1 reflects a dataset that caps majority CWEs (e.g. CWE-79) so rare weaknesses are
learned rather than drowned out.
Reading the numbers:
Macro-F1 is computed over the union of gold and predicted labels
(125 = 117 gold + ~8 the model predicted outside the gold set). Those out-of-label predictions score ~0 and pull macro
down
, so 0.511 is a
conservative
figure.
Exact-match has an inherent ceiling of ~98.3%:
~1.74% of the test set (273 groups / 1,205 rows) are identical descriptions mapped to
different
CWEs (e.g. a bare "Windows Kernel Elevation of Privilege Vulnerability"), which a description-only model cannot disambiguate.
Scores are on the
capped/balanced
test split (~30% "easy" rows), so they are
not
directly comparable to metrics measured on a different (e.g. natural-distribution) split.
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
mid = "exploitintel/cve-cwe-qwen3-8b"
tok = AutoTokenizer.from_pretrained(mid)
model = AutoModelForCausalLM.from_pretrained(mid, torch_dtype="auto", device_map="auto")
messages = [
{"role": "system", "content": "You are a vulnerability analyst. Given a CVE description, ""reply with only the CWE ID(s) it maps to, comma-separated."},
{"role": "user", "content": "A SQL injection vulnerability in the login endpoint allows an ""unauthenticated attacker to execute arbitrary SQL via the username parameter."},
]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=32, do_sample=False)
print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
# -> CWE-89
GGUF / Ollama
A
Q4_K_M
GGUF is included in this repo for local runners:
ollama run hf.co/exploitintel/cve-cwe-qwen3-8b:Q4_K_M
Set the same system prompt (
/set system You are a vulnerability analyst...
) so it returns bare CWE IDs.
Note:
This Ollama command has not been verified end-to-end. This is a standard
qwen3
model so the embedded template should apply normally — but if
ollama run
ignores the
system prompt and produces rambling text instead of a bare CWE ID, supply an explicit
ChatML Modelfile
TEMPLATE
as shown in the
Qwen3.5-4B card
.
Training
Base:
Qwen/Qwen3-8B
(trained 4-bit via
unsloth/qwen3-8b-unsloth-bnb-4bit
)
Method:
QLoRA (4-bit) with Unsloth, merged to 16-bit · released checkpoint:
checkpoint-960
(final; eval loss declined monotonically through training)
cve-cwe-qwen3-8b huggingface.co is an AI model on huggingface.co that provides cve-cwe-qwen3-8b's model effect (), which can be used instantly with this exploitintel cve-cwe-qwen3-8b model. huggingface.co supports a free trial of the cve-cwe-qwen3-8b model, and also provides paid use of the cve-cwe-qwen3-8b. Support call cve-cwe-qwen3-8b model through api, including Node.js, Python, http.
cve-cwe-qwen3-8b huggingface.co is an online trial and call api platform, which integrates cve-cwe-qwen3-8b's modeling effects, including api services, and provides a free online trial of cve-cwe-qwen3-8b, you can try cve-cwe-qwen3-8b online for free by clicking the link below.
exploitintel cve-cwe-qwen3-8b online free url in huggingface.co:
cve-cwe-qwen3-8b is an open source model from GitHub that offers a free installation service, and any user can find cve-cwe-qwen3-8b on GitHub to install. At the same time, huggingface.co provides the effect of cve-cwe-qwen3-8b install, users can directly use cve-cwe-qwen3-8b installed effect in huggingface.co for debugging and trial. It also supports api for free installation.