Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,26 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
-
- Source code: https://github.com/huggingface/ml-intern
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 20 |
|
| 21 |
-
|
| 22 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 23 |
-
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 24 |
-
```
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# π Ethical Hacking LLM Fine-Tuning Collection
|
| 2 |
+
|
| 3 |
+
> **Public collection of Colab-ready notebooks for fine-tuning cybersecurity/ethical hacking LLMs on Google Colab Free Tier (T4 GPU).**
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## π¦ What's Included
|
| 8 |
+
|
| 9 |
+
| File | Model | Description |
|
| 10 |
+
|------|-------|-------------|
|
| 11 |
+
| `EthicalHacking_Qwen3-4B_Ultimate_Colab.ipynb` | **Qwen3-4B-Instruct-2507** (π₯ recommended) | Best coding/reasoning scores among sub-10B models with confirmed Unsloth support |
|
| 12 |
+
| `EthicalHacking_Qwen3-8B_Colab.ipynb` | Qwen3-8B-bnb-4bit | Larger capacity, less VRAM headroom on T4 |
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## π Why Qwen3-4B-Instruct-2507?
|
| 17 |
+
|
| 18 |
+
After researching the **latest small models** as of May/June 2026, here's the verdict for T4 16GB:
|
| 19 |
+
|
| 20 |
+
| Model | 4-bit Size | T4 Fit | Coding Benchmarks | Unsloth Support | Verdict |
|
| 21 |
+
|-------|-----------|--------|------------------|-----------------|---------|
|
| 22 |
+
| **Qwen3-4B-Instruct-2507** π₯ | **3.3 GB** | β
β
β
Excellent | LiveCodeBench 35.1, MultiPL-E 76.8 | β
Confirmed | **Use this** |
|
| 23 |
+
| Qwen3-8B | 7.0 GB | β
β
Good | Stronger base model | β
Confirmed | Viable but tighter |
|
| 24 |
+
| Gemma-4-E2B-it | 7.6 GB | β
β
Good | Unverified coding scores | β
4-bit exists | Multimodal option |
|
| 25 |
+
| Gemma-4-E4B-it | 10.2 GB | β οΈ Tight | β | β
4-bit exists | **Avoid (OOM risk)** |
|
| 26 |
+
| Bonsai (prism-ml) | ~1 GB | β
β
β
Excellent | Weak (MMLU 30%) | β Custom arch | **Avoid** |
|
| 27 |
+
| LFM2 (Liquid AI) | ~2.5 GB | β
β
Good | **Not for programming** (official disclaimer) | β Unknown | **Avoid** |
|
| 28 |
+
| Qwen3.5 series | β | β | β | β οΈ Uncertain | Wait for Unsloth |
|
| 29 |
+
|
| 30 |
+
### Key Datasets Used
|
| 31 |
+
|
| 32 |
+
| Dataset | Rows | Focus |
|
| 33 |
+
|---------|------|-------|
|
| 34 |
+
| [AlicanKiraz0/Cybersecurity-Dataset-Fenrir-v2.1](https://huggingface.co/datasets/AlicanKiraz0/Cybersecurity-Dataset-Fenrir-v2.1) | 99,870 | Threat analysis, IR, offensive education |
|
| 35 |
+
| [Trendyol/Trendyol-Cybersecurity-Instruction-Tuning-Dataset](https://huggingface.co/datasets/Trendyol/Trendyol-Cybersecurity-Instruction-Tuning-Dataset) | 53,202 | C2 analysis, forensics, 200+ topics |
|
| 36 |
+
|
| 37 |
---
|
| 38 |
+
|
| 39 |
+
## π Quick Start
|
| 40 |
+
|
| 41 |
+
1. Open [Google Colab](https://colab.research.google.com)
|
| 42 |
+
2. **Runtime β Change runtime type β GPU (T4)**
|
| 43 |
+
3. Upload the `.ipynb` file from this repo
|
| 44 |
+
4. **Run all cells** β training takes ~1.5β2.5 hours for 1 epoch
|
| 45 |
+
|
| 46 |
---
|
| 47 |
|
| 48 |
+
## βοΈ T4 VRAM Optimizations Used
|
| 49 |
|
| 50 |
+
- `load_in_4bit=True` + LoRA (r=64)
|
| 51 |
+
- `adamw_8bit` optimizer
|
| 52 |
+
- `use_gradient_checkpointing="unsloth"`
|
| 53 |
+
- `fp16=True` (T4 has no bf16)
|
| 54 |
+
- Batch=2, Accum=4 β effective batch=8
|
| 55 |
|
| 56 |
+
---
|
| 57 |
|
| 58 |
+
## π‘οΈ Disclaimer
|
|
|
|
| 59 |
|
| 60 |
+
All datasets are **defensive/educational** (pentesting methodology, threat analysis, incident response). Intended for **ethical hacking education and security research** only.
|
| 61 |
|
| 62 |
+
---
|
|
|
|
| 63 |
|
| 64 |
+
## π References
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
- [Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507)
|
| 67 |
+
- [Unsloth 4-bit](https://huggingface.co/unsloth/Qwen3-4B-Instruct-2507-unsloth-bnb-4bit)
|
| 68 |
+
- [Unsloth Docs](https://unsloth.ai/docs)
|
| 69 |
+
- [TRL SFTTrainer](https://huggingface.co/docs/trl/sft_trainer)
|
| 70 |
+
- [Fenrir Dataset](https://huggingface.co/datasets/AlicanKiraz0/Cybersecurity-Dataset-Fenrir-v2.1)
|
| 71 |
+
- [Trendyol Dataset](https://huggingface.co/datasets/Trendyol/Trendyol-Cybersecurity-Instruction-Tuning-Dataset)
|