Instructions to use neilopet/glm4-cybersec-v2-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use neilopet/glm4-cybersec-v2-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Olafangensan/GLM-4.7-Flash-heretic") model = PeftModel.from_pretrained(base_model, "neilopet/glm4-cybersec-v2-lora") - Transformers
How to use neilopet/glm4-cybersec-v2-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="neilopet/glm4-cybersec-v2-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("neilopet/glm4-cybersec-v2-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use neilopet/glm4-cybersec-v2-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "neilopet/glm4-cybersec-v2-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "neilopet/glm4-cybersec-v2-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/neilopet/glm4-cybersec-v2-lora
- SGLang
How to use neilopet/glm4-cybersec-v2-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "neilopet/glm4-cybersec-v2-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "neilopet/glm4-cybersec-v2-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "neilopet/glm4-cybersec-v2-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "neilopet/glm4-cybersec-v2-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use neilopet/glm4-cybersec-v2-lora with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for neilopet/glm4-cybersec-v2-lora to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for neilopet/glm4-cybersec-v2-lora to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for neilopet/glm4-cybersec-v2-lora to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="neilopet/glm4-cybersec-v2-lora", max_seq_length=2048, ) - Docker Model Runner
How to use neilopet/glm4-cybersec-v2-lora with Docker Model Runner:
docker model run hf.co/neilopet/glm4-cybersec-v2-lora
GLM-4.7-Flash Cybersec v2 LoRA
A LoRA adapter fine-tuned on cybersecurity distillation data for penetration testing and vulnerability analysis with tool-calling capabilities.
Model Details
- Base model: Olafangensan/GLM-4.7-Flash-heretic (DeepSeek2 MoE, 30B total / ~3B active)
- Fine-tuning method: LoRA (r=8, alpha=8) via Unsloth + TRL SFTTrainer
- Training data: ~6,800 cybersecurity Q&A pairs distilled from DeepSeek-R1 + ~300 multi-turn tool-calling examples
- Dataset: neilopet/cybersec-distillation-data
- Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj (including MoE expert layers)
- Quantization: Trained in 4-bit QLoRA, exported as fp16 LoRA weights
- GGUF: Merged and quantized to Q8_0 for llama-server deployment
Evaluation Results
| Metric | Score |
|---|---|
| Knowledge accuracy (CVE/CWE/tool recall) | 90% (18/20) |
| Tool calling accuracy (run() function calls) | 100% (10/10) |
Evaluated with a custom harness against llama-server using the optimized system prompt. Knowledge accuracy measures correct recall of CVE details, CWE classifications, and Kali tool usage. Tool calling accuracy measures valid structured run(command=...) function calls.
RAG-augmented performance
With RAG context injection (deterministic CVE lookup + HackTricks vector search), knowledge accuracy improves to near-100% as the model reasons over injected ground truth rather than parametric memory.
Usage
With llama-server (recommended)
Merge the LoRA adapter, quantize to GGUF, and serve with llama-server:
# Merge and quantize (requires unsloth)
python -c "
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained('neilopet/glm4-cybersec-v2-lora')
model.save_pretrained_gguf('merged', tokenizer, quantization_method='q8_0')
"
# Serve
llama-server -m merged/unsloth.Q8_0.gguf --ctx-size 16384 --port 8080
With transformers + PEFT
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("Olafangensan/GLM-4.7-Flash-heretic")
model = PeftModel.from_pretrained(base, "neilopet/glm4-cybersec-v2-lora")
tokenizer = AutoTokenizer.from_pretrained("neilopet/glm4-cybersec-v2-lora")
System Prompt
You are an expert cybersecurity operator with access to a Kali Linux terminal.
To execute commands, call: run(command="<full shell command>")
Write the command exactly as you would type it in a terminal.
Rules:
- ALWAYS call run() to execute commands. NEVER fabricate or invent command output.
- If you need to run a command, call run() and wait for the result before continuing.
- Run one command at a time. Read the output, then decide the next step.
- Start with safe, non-destructive commands before aggressive ones.
- If a command fails, read the error and adapt your approach.
- Stay within authorized, legal, and explicitly permitted testing scope.
- Report what you actually observed, not what you expected to see.
Training Infrastructure
- Hardware: 1x NVIDIA A40 (48GB) on RunPod
- Framework: Unsloth + TRL SFTTrainer
- Training regime: bf16 mixed precision, QLoRA 4-bit
- PEFT version: 0.18.1
Framework versions
- PEFT 0.18.1
- Downloads last month
- 2
Model tree for neilopet/glm4-cybersec-v2-lora
Base model
Olafangensan/GLM-4.7-Flash-heretic