AlicanKiraz0/Cybersecurity-Dataset-Fenrir-v2.1
Viewer • Updated • 99.9k • 3.14k • 132
How to use hotdogs/qwen3.6-27b-cybersecurity-lora with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.6-27B")
model = PeftModel.from_pretrained(base_model, "hotdogs/qwen3.6-27b-cybersecurity-lora")Fine-tuned Qwen3.6-27B with LoRA on Cybersecurity-Dataset-Fenrir-v2.1
Specialized for cybersecurity knowledge, threat analysis, and security operations.
| Attribute | Value |
|---|---|
| Base Model | Qwen/Qwen3.6-27B |
| Adapter Type | LoRA (Low-Rank Adaptation) |
| Fine-tuning Method | QLoRA (4-bit NF4 + LoRA) |
| Hardware | 1× RTX 4090 (24GB VRAM) |
| Training Time | ~5 hours |
| Dataset Size | 5,000 rows (sampled from 99,870) |
| Max Sequence Length | 512 tokens |
| License | Apache 2.0 |
This LoRA adapter enhances Qwen3.6-27B's capability in cybersecurity domains including:
BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
)
LoraConfig(
r=8,
lora_alpha=16,
target_modules=[
"q_proj", "k_proj", "v_proj", "o_proj",
"gate_proj", "up_proj", "down_proj",
],
lora_dropout=0.05,
bias="none",
task_type="CAUSAL_LM",
)
SFTConfig(
max_length=512,
per_device_train_batch_size=1,
gradient_accumulation_steps=8,
num_train_epochs=1,
learning_rate=2e-4,
bf16=True,
optim="paged_adamw_8bit",
warmup_steps=10,
lr_scheduler_type="cosine",
logging_steps=10,
)
| Step | Loss | Accuracy |
|---|---|---|
| 0 | 1.94 | 56.8% |
| ~30 | 0.36 | 90.7% |
| ~60 | 0.26 | 93.2% |
| ~100 | 0.21 | 94.1% |
| Final | ~0.21 | ~94% |
Loss converged rapidly within the first ~200 steps, indicating successful knowledge injection into the LoRA adapters.
pip install torch transformers accelerate peft bitsandbytes
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
# Base model
model_name = "Qwen/Qwen3.6-27B"
# 4-bit quantization config
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
model = AutoModelForCausalLM.from_pretrained(
model_name,
quantization_config=bnb_config,
device_map="auto",
torch_dtype=torch.bfloat16,
trust_remote_code=True,
)
# Load LoRA adapter
model = PeftModel.from_pretrained(model, "hotdogs/qwen3.6-27b-cybersecurity-lora")
def generate_response(system_prompt, user_prompt):
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt},
]
text = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=1024,
temperature=0.7,
top_p=0.9,
do_sample=True,
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
# Example
response = generate_response(
"You are a cybersecurity expert. Provide detailed, accurate technical information.",
"Explain how to identify SQL injection vulnerabilities in a web application."
)
print(response)
python -m peft merge_and_save \
--model_name Qwen/Qwen3.6-27B \
--peft_model hotdogs/qwen3.6-27b-cybersecurity-lora \
--output_dir ./qwen3.6-27b-cybersecurity-merged
| Component | Specification |
|---|---|
| GPU | 1× NVIDIA RTX 4090 (24GB) |
| CPU | 8 vCPU |
| RAM | 32 GB |
| Framework | PyTorch 2.12 + Transformers 5.12 + TRL 1.6 |
| Quantization | bitsandbytes 0.49 (4-bit NF4) |
| Precision | bfloat16 mixed precision |
| Stage | VRAM Usage |
|---|---|
| Model Load (4-bit) | ~17.65 GB |
| After LoRA | ~17.81 GB |
| During Training | ~18-20 GB |
prepare_model_for_kbit_training step was skipped to avoid OOM from fp32 casting of large tensors — gradients are computed directly in bf16Created by: hotdogs
Training Date: June 17, 2026
If you find this model useful, please consider supporting my work!
หากคุณคิดว่าโมเดลนี้มีประโยชน์ กรุณาสนับสนุนผลงานของฉันด้วยนะคะ! 🙏
bc1qf27cyk3vmugcdyv9xdtuv5jwz37863crpj5c9v
Thank you for your support! 🙏✨
ขอบคุณมากๆ สำหรับการสนับสนุนค่า! 💖🤗
We're not able to determine the quantization variants.
Base model
Qwen/Qwen3.6-27B