File size: 3,294 Bytes
a42ec90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Phi-3 Mini (LoRA Fine-Tuned on MITRE-STIX-CVE-ExploitDB Dataset)

## Model Summary

This model is a fine-tuned version of **[microsoft/phi-3-mini-128k-instruct](https://huggingface.co/microsoft/phi-3-mini-128k-instruct)** using **LoRA (Low-Rank Adaptation)** and **8-bit quantization** for parameter-efficient training.

The fine-tuning dataset is **[jason-oneal/mitre-stix-cve-exploitdb-dataset-alpaca](https://huggingface.co/datasets/jason-oneal/mitre-stix-cve-exploitdb-dataset-alpaca)**, which contains security-related instruction-response examples (CVE, STIX, ExploitDB context).

The goal of this model is to act as a **cybersecurity knowledge assistant** that can answer questions about CVEs, exploits, and related security topics.

* **Base Model**: microsoft/phi-3-mini-128k-instruct
* **Fine-tuning Method**: LoRA (8-bit PEFT with bitsandbytes)
* **Dataset**: jason-oneal/mitre-stix-cve-exploitdb-dataset-alpaca
* **Languages**: English
* **Context Length**: 128k tokens

---

## Intended Uses

* Designed for: cybersecurity Q\&A, reasoning about vulnerabilities, exploits, and threat intelligence.
* Can be used for: research, learning, and prototyping of cyber threat assistants.

---

## Dataset

* **Name**: MITRE-STIX-CVE-ExploitDB Dataset (Alpaca format)
* **Source**: [jason-oneal/mitre-stix-cve-exploitdb-dataset-alpaca](https://huggingface.co/datasets/jason-oneal/mitre-stix-cve-exploitdb-dataset-alpaca)
* **Schema**: Instruction–response pairs in Alpaca format
* **Size Used**: Up to 5,000 training samples (subset for efficiency)

---

## Training Procedure

* **Frameworks**: Hugging Face Transformers, PEFT, bitsandbytes
* **Precision**: 8-bit quantization (bnb.int8) + FP16 training
* **Optimizer**: AdamW
* **Batch Size**: 4 per device
* **Epochs**: 1
* **Learning Rate**: 3e-4
* **Warmup Steps**: 50
* **Max Length**: 1024 tokens
* **LoRA Config**:

  * r = 16
  * alpha = 16
  * dropout = 0.05
  * target modules: q\_proj, k\_proj, v\_proj, o\_proj, w1, w2, dense

---

## Evaluation

* **Metric**: Training loss (did not include a validation set in this run).
* **Qualitative Evaluation**: The model produces meaningful responses to security-related prompts, but further fine-tuning with eval sets is recommended.

---

## How to Use

```python
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

model_name = "sushanrai/phi3-cybersec-advisor-lora"  # replace with your repo
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)

prompt = "Explain CVE-2021-44228 in simple terms"
output = pipe(prompt, max_new_tokens=300, do_sample=True)
print(output[0]["generated_text"])
```

---

## Ethical Considerations

* This model is trained on cybersecurity data and may produce outputs that describe exploits.
* Should only be used for **research, learning, and defensive security purposes**.
* Not intended for malicious use.

---

## Citation

If you use this model, please cite:

```bibtex
@misc{phi3_mitre_lora_2025,
  title={Phi-3 Mini LoRA Fine-Tuned on MITRE-STIX-CVE-ExploitDB Dataset},
  author={HackDMSV},
  year={2025},
  howpublished={\url{https://huggingface.co/sushanrai/phi3-cybersec-advisor-lora}}
}
```