Instructions to use sahilempire/redsec-7b-distill with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use sahilempire/redsec-7b-distill with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("sahilempire/redsec-7b-distill") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use sahilempire/redsec-7b-distill with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "sahilempire/redsec-7b-distill" --prompt "Once upon a time"
RedSec-7B (distilled LoRA adapter)
A LoRA adapter (MLX format) that turns WhiteRabbitNeo-2.5 (Qwen2.5-Coder-7B) into RedSec, a security assistant for authorized penetration testing, red-team, and LLM-security research. Trained by distillation on the base model's own correct answers plus curated gold examples.
- Base model: WhiteRabbitNeo-2.5 / Qwen2.5-Coder-7B (4-bit)
- Adapter: LoRA, MLX (
mlx-lm) format, ~22 MB - Training data: sahilempire/redsec-distill-sft-v1 + curated OWASP LLM01-style gold
- License: other (responsible use)
What it does
Produces concrete, structured security test payloads in a consistent voice (Payload / Explanation / Authorization Reminder) for common attack classes.
Evaluation (24-prompt broad eval)
| Metric | Result |
|---|---|
| Refusals | 0 / 24 |
| Looping / degenerate output | 0 / 24 |
| Structured / on-voice | 24 / 24 |
| Correct on standard attacks | strong (SQLi, XSS, SSRF, XXE, NoSQL, LDAP, JWT, CSRF, Log4Shell, file upload, nmap, secure-code fix) |
Known soft spots (7B capability ceiling โ verify these): indirect prompt injection can be confused with XSS, and username-enumeration methodology can be imprecise. Nuanced categories should be reviewed by a human.
Usage (mlx-lm)
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler, make_logits_processors
# point adapter_path at this repo (or a local copy); base = the 4-bit WhiteRabbitNeo-2.5 Qwen2.5-Coder-7B
model, tok = load("<your-local-whiterabbitneo-2.5-qwen-coder-7b-4bit>", adapter_path="redsec-7b-distill")
sys = ("You are RedSec, a security assistant for authorized penetration testing and red-team work. "
"Answer with concrete, correct payloads or steps, a brief explanation, and an authorization reminder.")
msgs = [{"role": "system", "content": sys},
{"role": "user", "content": "Give me SQL injection payloads to test a login form."}]
text = tok.apply_chat_template(msgs, add_generation_prompt=True)
print(generate(model, tok, prompt=text, max_tokens=400,
sampler=make_sampler(temp=0.5),
logits_processors=make_logits_processors(repetition_penalty=1.1)))
Intended use
Authorized security testing, red-teaming, and defensive research only. This adapter makes the model emit live attack payloads. Not for unauthorized access or harm. Use only on systems you own or are explicitly authorized to assess.
How it was built
Distillation (the base model teaching itself from its own correct outputs) + curated gold for prompt-injection and other categories, then LoRA fine-tuning (MLX). Best checkpoint selected by validation loss. See the dataset card for full method and provenance.
Quantized