Update README.md
Browse files
README.md
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# 🛡️ CyberThreat Intel LLM (Phi-3-mini Fine-Tuned)
|
|
|
|
| 2 |
This is a fine-tuned version of Microsoft's **Phi-3-mini-4k-instruct**, optimized specifically to act as a Cybersecurity Threat Analyst. It takes raw CVE vulnerability data and generates professional, structured threat intelligence reports.
|
|
|
|
| 3 |
**▶️ Try the Live Demo:** [CyberThreat Intel Analyzer (Hugging Face Space)](https://huggingface.co/spaces/vanshkamra12/CyberThreat-Intel-Analyzer)
|
|
|
|
| 4 |
**💻 Code & Dataset:** [GitHub Repository](https://github.com/vanshkamra12/CyberThreat-Intel-LLM)
|
|
|
|
| 5 |
---
|
|
|
|
| 6 |
## 🎯 What it does
|
|
|
|
| 7 |
Feed the model a raw CVE description, CVSS score, and vendor, and it will generate a comprehensive report including:
|
| 8 |
- **Executive Summary** (Plain English explanation)
|
| 9 |
- **Technical Analysis** (Vectors, complexity, privileges)
|
|
@@ -12,33 +33,43 @@ Feed the model a raw CVE description, CVSS score, and vendor, and it will genera
|
|
| 12 |
- **Risk Assessment**
|
| 13 |
- **Remediation Steps**
|
| 14 |
- **Detection Rules** (YARA/Sigma)
|
|
|
|
| 15 |
## 🧠 Model Details
|
| 16 |
- **Base Model:** `Phi-3-mini-4k-instruct` (3.8B parameters)
|
| 17 |
- **Training Method:** QLoRA (4-bit quantization) with Unsloth
|
| 18 |
- **Trainable Parameters:** 29.8M (0.78% of total)
|
| 19 |
- **Training Data:** 471 synthetic instruction-tuning pairs generated using Llama 3.1 8B from raw NIST NVD CVE data.
|
| 20 |
- **Final Training Loss:** 0.337
|
|
|
|
| 21 |
## 🚀 How to use in Python
|
|
|
|
| 22 |
```python
|
| 23 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 24 |
import torch
|
|
|
|
| 25 |
model_id = "vanshkamra12/CyberSecurity-Model"
|
|
|
|
| 26 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 27 |
model = AutoModelForCausalLM.from_pretrained(
|
| 28 |
model_id,
|
| 29 |
torch_dtype=torch.float16,
|
| 30 |
device_map="auto"
|
| 31 |
)
|
|
|
|
| 32 |
prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
|
|
|
| 33 |
### Instruction:
|
| 34 |
Analyze the following vulnerability data and produce a structured threat intelligence report.
|
|
|
|
| 35 |
### Input:
|
| 36 |
CVE ID: CVE-2024-21762
|
| 37 |
Description: A out-of-bound write vulnerability in FortiOS SSL VPN allows a remote unauthenticated attacker to execute arbitrary code or commands via specially crafted HTTP requests.
|
| 38 |
CVSS Score: 9.8 CRITICAL
|
| 39 |
Vendor: Fortinet
|
|
|
|
| 40 |
### Response:
|
| 41 |
"""
|
|
|
|
| 42 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 43 |
outputs = model.generate(**inputs, max_new_tokens=1000, temperature=0.7)
|
| 44 |
-
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: unsloth/Phi-3-mini-4k-instruct-bnb-4bit
|
| 3 |
+
tags:
|
| 4 |
+
- text-generation-inference
|
| 5 |
+
- transformers
|
| 6 |
+
- unsloth
|
| 7 |
+
- mistral
|
| 8 |
+
- cybersecurity
|
| 9 |
+
- threat-intelligence
|
| 10 |
+
- cve
|
| 11 |
+
license: apache-2.0
|
| 12 |
+
language:
|
| 13 |
+
- en
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
# 🛡️ CyberThreat Intel LLM (Phi-3-mini Fine-Tuned)
|
| 17 |
+
|
| 18 |
This is a fine-tuned version of Microsoft's **Phi-3-mini-4k-instruct**, optimized specifically to act as a Cybersecurity Threat Analyst. It takes raw CVE vulnerability data and generates professional, structured threat intelligence reports.
|
| 19 |
+
|
| 20 |
**▶️ Try the Live Demo:** [CyberThreat Intel Analyzer (Hugging Face Space)](https://huggingface.co/spaces/vanshkamra12/CyberThreat-Intel-Analyzer)
|
| 21 |
+
|
| 22 |
**💻 Code & Dataset:** [GitHub Repository](https://github.com/vanshkamra12/CyberThreat-Intel-LLM)
|
| 23 |
+
|
| 24 |
---
|
| 25 |
+
|
| 26 |
## 🎯 What it does
|
| 27 |
+
|
| 28 |
Feed the model a raw CVE description, CVSS score, and vendor, and it will generate a comprehensive report including:
|
| 29 |
- **Executive Summary** (Plain English explanation)
|
| 30 |
- **Technical Analysis** (Vectors, complexity, privileges)
|
|
|
|
| 33 |
- **Risk Assessment**
|
| 34 |
- **Remediation Steps**
|
| 35 |
- **Detection Rules** (YARA/Sigma)
|
| 36 |
+
|
| 37 |
## 🧠 Model Details
|
| 38 |
- **Base Model:** `Phi-3-mini-4k-instruct` (3.8B parameters)
|
| 39 |
- **Training Method:** QLoRA (4-bit quantization) with Unsloth
|
| 40 |
- **Trainable Parameters:** 29.8M (0.78% of total)
|
| 41 |
- **Training Data:** 471 synthetic instruction-tuning pairs generated using Llama 3.1 8B from raw NIST NVD CVE data.
|
| 42 |
- **Final Training Loss:** 0.337
|
| 43 |
+
|
| 44 |
## 🚀 How to use in Python
|
| 45 |
+
|
| 46 |
```python
|
| 47 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 48 |
import torch
|
| 49 |
+
|
| 50 |
model_id = "vanshkamra12/CyberSecurity-Model"
|
| 51 |
+
|
| 52 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 53 |
model = AutoModelForCausalLM.from_pretrained(
|
| 54 |
model_id,
|
| 55 |
torch_dtype=torch.float16,
|
| 56 |
device_map="auto"
|
| 57 |
)
|
| 58 |
+
|
| 59 |
prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
| 60 |
+
|
| 61 |
### Instruction:
|
| 62 |
Analyze the following vulnerability data and produce a structured threat intelligence report.
|
| 63 |
+
|
| 64 |
### Input:
|
| 65 |
CVE ID: CVE-2024-21762
|
| 66 |
Description: A out-of-bound write vulnerability in FortiOS SSL VPN allows a remote unauthenticated attacker to execute arbitrary code or commands via specially crafted HTTP requests.
|
| 67 |
CVSS Score: 9.8 CRITICAL
|
| 68 |
Vendor: Fortinet
|
| 69 |
+
|
| 70 |
### Response:
|
| 71 |
"""
|
| 72 |
+
|
| 73 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 74 |
outputs = model.generate(**inputs, max_new_tokens=1000, temperature=0.7)
|
| 75 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|