Voidreaper2026 commited on
Commit
1fcffd0
·
verified ·
1 Parent(s): 9653079

Add model card

Browse files
Files changed (1) hide show
  1. README.md +278 -0
README.md ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3-4B
4
+ tags:
5
+ - cybersecurity
6
+ - cve
7
+ - vulnerability
8
+ - fine-tuned
9
+ - rag
10
+ - triage
11
+ - gguf
12
+ - llama-cpp
13
+ datasets:
14
+ - Voidreaper2026/cybersec-master-dataset
15
+ language:
16
+ - en
17
+ pipeline_tag: text-generation
18
+ ---
19
+
20
+ # qwen3-4b-cybersec-GGUF — Cybersecurity Fine-Tuned Language Model
21
+
22
+ A Qwen3-4B model fine-tuned on the
23
+ [`Voidreaper2026/cybersec-master-dataset`](https://huggingface.co/datasets/Voidreaper2026/cybersec-master-dataset)
24
+ and quantised to GGUF Q8_0 for local deployment. The training corpus spans 1.8 million
25
+ deduplicated records from NVD, OSV, GitHub Advisory Database, ExploitDB, MITRE ATT&CK,
26
+ CISA KEV, Security Stack Exchange, Kali Linux tooling, and Vulners vulnerability
27
+ intelligence.
28
+
29
+ This model is designed to operate as the **fast extraction and classification layer**
30
+ in a grounded triage pipeline — not as a standalone severity oracle. That distinction
31
+ matters, and the rest of this card explains why.
32
+
33
+ ---
34
+
35
+ ## Quickstart
36
+
37
+ ### llama.cpp
38
+
39
+ ```bash
40
+ # Install
41
+ brew install llama.cpp # macOS
42
+ winget install llama.cpp # Windows
43
+
44
+ # Run as OpenAI-compatible server
45
+ llama-server -hf Voidreaper2026/qwen3-4b-cybersec-GGUF:Q8_0
46
+
47
+ # Or run directly in terminal
48
+ llama-cli -hf Voidreaper2026/qwen3-4b-cybersec-GGUF:Q8_0
49
+ ```
50
+
51
+ ### Ollama
52
+
53
+ ```bash
54
+ ollama run hf.co/Voidreaper2026/qwen3-4b-cybersec-GGUF:Q8_0
55
+ ```
56
+
57
+ ### llama-cpp-python
58
+
59
+ ```python
60
+ from llama_cpp import Llama
61
+
62
+ llm = Llama.from_pretrained(
63
+ repo_id="Voidreaper2026/qwen3-4b-cybersec-GGUF",
64
+ filename="model-Q8_0.gguf",
65
+ n_ctx=4096
66
+ )
67
+
68
+ response = llm.create_chat_completion(
69
+ messages=[
70
+ {
71
+ "role": "user",
72
+ "content": \"\"\"Extract the following fields from your knowledge of CVE-2023-44487.
73
+ Return as JSON only. Return null for any field you cannot confirm with certainty.
74
+
75
+ Fields: cve_id, cwe_ids, affected_products, attack_vector,
76
+ privileges_required, patch_available, cisa_kev, mitre_attack_technique\"\"\"
77
+ }
78
+ ],
79
+ temperature=0.1,
80
+ max_tokens=512
81
+ )
82
+
83
+ print(response["choices"][0]["message"]["content"])
84
+ ```
85
+
86
+ ### LM Studio / Jan
87
+
88
+ Search for `Voidreaper2026/qwen3-4b-cybersec-GGUF` directly in the app.
89
+
90
+ ---
91
+
92
+ ## Training Data
93
+
94
+ | Source | Records | Description |
95
+ |---|---|---|
96
+ | NVD | 500,935 | CVE database back to 2002 |
97
+ | OSV | 754,273 | Multi-ecosystem vulnerability DB |
98
+ | GitHub Advisory DB | 328,525 | Security advisories, CC-BY 4.0 |
99
+ | Cybersec Causal Reasoning | 99,870 | Reasoning triples |
100
+ | Security Stack Exchange | 55,930 | Real-world Q&A |
101
+ | ExploitDB | 46,457 | Public exploit database |
102
+ | Vulners | 87,063 | Exploit and advisory intelligence |
103
+ | MITRE ATT&CK | 2,205 | Techniques, mitigations, groups |
104
+ | CISA KEV | 1,587 | Known Exploited Vulnerabilities |
105
+ | Kali Linux Tools | 790 | Tool descriptions and flags |
106
+ | **Total (deduplicated)** | **1,807,941** | |
107
+
108
+ ---
109
+
110
+ ## The Problem This Pipeline Solves
111
+
112
+ **Every LLM over-inflates CVE severity scores. This is a field-wide problem, not a
113
+ model-specific one.**
114
+
115
+ It has nothing to do with training data quality. It is structural:
116
+
117
+ - **Pre-training data is skewed by nature.** The internet massively over-represents
118
+ Critical and High CVEs. Nobody publishes a detailed breakdown of a CVSS 4.2. Every
119
+ LLM inherits this bias from pre-training, before any fine-tuning happens.
120
+
121
+ - **NVD base scores are worst-case by design.** CVSS base scores assume no mitigating
122
+ controls, full network exposure, and worst-case environment. A legitimate 9.8 in the
123
+ database might realistically be a 4.0 in most real deployments.
124
+
125
+ - **Instruction tuning pushes toward caution.** RLHF rewards thorough, safety-conscious
126
+ answers. In a security context that trains a bias toward worst-case severity framing.
127
+
128
+ The pipeline below bypasses this entirely by ensuring severity scores are always
129
+ retrieved from source data, never generated from model weights.
130
+
131
+ ---
132
+
133
+ ## Recommended Architecture: Grounded Triage Pipeline
134
+
135
+ ```
136
+ User Query
137
+ |
138
+ v
139
+ +------------------------------------------------------------------+
140
+ | qwen3-4b-cybersec (Extraction Layer) |
141
+ | |
142
+ | Fast, cheap, runs fully local on CPU or AMD/NVIDIA GPU. |
143
+ | Extracts CVE IDs, CWE types, affected products, attack surface. |
144
+ | Does NOT output severity scores or CVSS values. |
145
+ +-----------------------------+------------------------------------+
146
+ | Structured: CVE IDs, CWEs, products
147
+ v
148
+ +------------------------------------------------------------------+
149
+ | RAG Retrieval Layer |
150
+ | |
151
+ | Vector search over embedded cybersec-master-dataset. |
152
+ | Returns verbatim CVSS vectors, KEV status, ATT&CK mappings. |
153
+ +-----------------------------+------------------------------------+
154
+ |
155
+ | If CVE not in index:
156
+ v
157
+ +------------------------------------------------------------------+
158
+ | Web Search Fallback (No-RAG Path) |
159
+ | |
160
+ | Live lookups: NVD API, CISA KEV, CVE.mitre.org, vendor |
161
+ | advisories. Output tagged source: web_search_backed. |
162
+ +-----------------------------+------------------------------------+
163
+ | Retrieved context
164
+ v
165
+ +------------------------------------------------------------------+
166
+ | Large Model (Triage and Synthesis Layer) |
167
+ | |
168
+ | Operates on retrieved context only — never on weights. |
169
+ | Contextualises severity for the user's actual environment. |
170
+ | Flags confidence: rag_backed / web_search_backed / |
171
+ | model_generated (treat with caution). |
172
+ +------------------------------------------------------------------+
173
+ ```
174
+
175
+ ### Why each component earns its place
176
+
177
+ **qwen3-4b-cybersec is the economical workhorse.** Entity extraction, CWE
178
+ classification, and query structuring are exactly what a fine-tuned 4B model excels at.
179
+ Runs fast, cheap, and fully local including on AMD GPUs via llama.cpp. Kept out of the
180
+ scoring loop entirely.
181
+
182
+ **RAG retrieval is the score source.** Retrieving CVSS vectors verbatim from the source
183
+ dataset completely bypasses the inflation problem regardless of which LLM you use.
184
+
185
+ **Web search covers the temporal gap.** Zero-days and post-training CVEs get live NVD
186
+ API lookups, tagged so downstream systems know the data was not RAG-backed.
187
+
188
+ **The large model synthesises, never invents.** Given grounded context, it
189
+ contextualises risk for the user's environment without ever recalling a score from
190
+ weights.
191
+
192
+ ---
193
+
194
+ ## Confidence Flagging
195
+
196
+ | Flag | Meaning | Trust level |
197
+ |---|---|---|
198
+ | `rag_backed` | Score retrieved verbatim from dataset index | High |
199
+ | `web_search_backed` | Score fetched live from NVD API or vendor advisory | High |
200
+ | `model_generated` | No retrieval source found — model inference only | Low — verify manually |
201
+
202
+ ---
203
+
204
+ ## RAG Implementation Notes
205
+
206
+ ### Embedding the dataset
207
+
208
+ ```python
209
+ from datasets import load_dataset
210
+ from sentence_transformers import SentenceTransformer
211
+
212
+ ds = load_dataset("Voidreaper2026/cybersec-master-dataset", split="train")
213
+ encoder = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
214
+
215
+ # Embed at record level to preserve CVSS vector coherence
216
+ def get_embed_text(record):
217
+ convs = record["conversations"]
218
+ assistant_turn = next((c["value"] for c in convs if c["from"] == "gpt"), "")
219
+ return f"{record.get('cve_id', '')} {assistant_turn}"
220
+ ```
221
+
222
+ ### NVD API fallback
223
+
224
+ ```python
225
+ import httpx
226
+
227
+ async def nvd_lookup(cve_id: str) -> dict:
228
+ url = f"https://services.nvd.nist.gov/rest/json/cves/2.0?cveId={cve_id}"
229
+ async with httpx.AsyncClient() as client:
230
+ r = await client.get(url, timeout=10)
231
+ r.raise_for_status()
232
+ data = r.json()
233
+ vulns = data.get("vulnerabilities", [])
234
+ if not vulns:
235
+ return {"source": "web_search_backed", "found": False, "cve_id": cve_id}
236
+ cve = vulns[0]["cve"]
237
+ metrics = cve.get("metrics", {})
238
+ cvss_data = (
239
+ metrics.get("cvssMetricV31", [{}])[0].get("cvssData", {})
240
+ or metrics.get("cvssMetricV30", [{}])[0].get("cvssData", {})
241
+ )
242
+ return {
243
+ "source": "web_search_backed",
244
+ "found": True,
245
+ "cve_id": cve_id,
246
+ "cvss_score": cvss_data.get("baseScore"),
247
+ "cvss_vector": cvss_data.get("vectorString"),
248
+ "severity": cvss_data.get("baseSeverity"),
249
+ "description": cve.get("descriptions", [{}])[0].get("value", ""),
250
+ "published": cve.get("published"),
251
+ }
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Intended Use
257
+
258
+ - SOC L1/L2 assistant tooling within the pipeline architecture above
259
+ - Structured CVE entity extraction as a preprocessing step
260
+ - Vulnerability report drafting and summarisation
261
+ - Security awareness training content generation
262
+ - CTF hint generation and write-up assistance
263
+
264
+ ## Out of Scope
265
+
266
+ - Standalone authoritative CVSS scoring from model output alone
267
+ - Automated patch prioritisation without RAG retrieval or NVD API verification
268
+ - Any workflow where model-generated severity feeds directly into SLA enforcement
269
+
270
+ These constraints apply equally to all LLMs used for CVE scoring.
271
+
272
+ ---
273
+
274
+ ## Licence
275
+
276
+ Apache 2.0. Training data sources retain their individual licences — see the
277
+ [dataset card](https://huggingface.co/datasets/Voidreaper2026/cybersec-master-dataset#sources--attribution)
278
+ for full attribution.