Downloads · 30 days
174
65% of all-time downloads
Mithun-999/phi2-kali-linux-finetuned
phi2-kali-linux-finetuned is a machine learning model from Mithun-999. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as mit.
Fine-tuned Microsoft Phi-2 (2.7B) model using LoRA adapters for Kali Linux and penetration testing Q&A.
Downloads · 30 days
174
65% of all-time downloads
All-time downloads
269
Public
Repo size
10.5 MB
Likes
0
Public
Click a slice to open those files.
.safetensors10.5 MB · 76%
From the Hugging Face model README
Fine-tuned Microsoft Phi-2 (2.7B) model using LoRA adapters for Kali Linux and penetration testing Q&A.
This is a LoRA-adapted Phi-2 model fine-tuned on Kali Linux documentation for answering cybersecurity and penetration testing questions.
This model is designed to answer questions related to:
The model can be used for:
Best practices for using this model:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load the base model and adapter
base_model = AutoModelForCausalLM.from_pretrained(
"microsoft/phi-2",
device_map="cpu",
torch_dtype=torch.float32,
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "Mithun-999/phi2-kali-linux-finetuned")
# Generate response
prompt = "What is the purpose of nmap in Kali Linux?"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_length=256,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
This model is NOT intended for:
Potential Biases:
Known Risks:
Limitations:
Users should:
Try the interactive demo: Kali Linux Q&A Space
Or run locally with the code example provided in the "Intended Use" section above.
The model was fine-tuned on extracted text from 5 Kali Linux PDF documents:
| Document | Size | Content Focus |
|---|---|---|
| PDF 1 | Large | Kali Linux fundamentals, tools overview |
| PDF 2 | Large | Network penetration testing techniques |
| PDF 3 | Medium | Web application penetration testing |
| PDF 4 | Medium | Post-exploitation and privilege escalation |
| PDF 5 | Medium | Linux system hardening and defense |
Data Extraction Summary:
The training dataset was generated using a heuristic question-answer generation approach:
Dataset Statistics:
| Split | Count | Percentage |
|---|---|---|
| Training | 23,776 | 80% |
| Validation | 2,972 | 10% |
| Testing | 2,972 | 10% |
| Total | 29,720 | 100% |
Dataset Format: JSONL and CSV
Training Environment:
Hyperparameters:
| Parameter | Value |
|---|---|
| Learning Rate | 0.00005 |
| Batch Size | 1 |
| Epochs | 1 |
| Max Sequence Length | 256 tokens |
| Gradient Clipping Norm | 1.0 |
| Optimizer | AdamW |
| Weight Decay | 0.01 |
LoRA Configuration:
| Parameter | Value |
|---|---|
| LoRA Rank (r) | 8 |
| LoRA Alpha | 16 |
| LoRA Dropout | 0.05 |
| Target Modules | ["q_proj", "v_proj"] |
Training Time & Resources:
Key Optimizations:
torch.cuda.empty_cache() after each batchModel Performance:
Task Completion:
The model successfully learned Kali Linux documentation and can generate contextually relevant responses to penetration testing and cybersecurity questions. The lightweight LoRA adapter (13.2MB) makes deployment feasible on resource-constrained platforms.
Hardware Type: NVIDIA Tesla T4 GPU (2x on Kaggle) Hours used: ~2 hours Cloud Provider: Kaggle Compute Region: Cloud (exact region not specified) Carbon Emitted: Estimated low (~0.1-0.5 kg CO2eq for 2-hour GPU training)
Training focused on efficiency with reduced parameters (LoRA) and single epoch.
Training Stack:
Deployment Stack:
If you use this model, please cite:
@misc{phi2-kali-linux,
author = {Kumar, Mithun},
title = {Phi-2 Fine-tuned on Kali Linux Documentation},
year = {2024},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/Mithun-999/phi2-kali-linux-finetuned}},
license = {MIT}
}
APA Citation:
Kumar, M. (2024). Phi-2 fine-tuned on Kali Linux documentation [Model]. HuggingFace. https://huggingface.co/Mithun-999/phi2-kali-linux-finetuned
GitHub Repository: phi2-kali-linux
Related Resources:
This model is intended for educational and authorized security purposes only.
✅ Learning penetration testing on systems you own or have permission to test
✅ Cybersecurity education and training
✅ Defensive security research
✅ Documentation lookup for Kali Linux tools
❌ Unauthorized access to systems
❌ Malware creation or distribution
❌ Violating laws (CFAA, GDPR, etc.)
❌ Privacy violations or data theft
❌ Targeting systems without explicit authorization
Users must comply with all applicable laws and ethical guidelines.
Last Updated: January 2024
License: MIT
Base Model: microsoft/phi-2