Model Card for Wolf Defender Prompt-Injection Detector Edge
Edge/quantized ONNX variant of patronus-studio/wolf-defender-prompt-injection. Private / internal.
Quantized with the Patronus RunPod ONNX method (quantize_dynamic INT8 linears + MatMulNBitsQuantizer
4-bit block-128 embedding). The parent FP32/FP16 model is unchanged; this repo only adds the small variants.
Binary prompt-injection detector (mmBERT-base).
Benchmark β Qualifire
Evaluated on Qualifire (5,000 prompts, max_length 2048). Quantization is lossless vs FP32.
| Variant | Size | F1 | Precision | Recall | FPR | Accuracy |
|---|---|---|---|---|---|---|
| fp32 (parent) | β | 0.9395 | 0.9454 | 0.9336 | 0.036 | 0.952 |
| int8 | 309 MB | 0.9406 | 0.9437 | 0.9376 | 0.037 | 0.953 |
| int8_int4_embeddings | 218 MB | 0.9410 | 0.9465 | 0.9356 | 0.035 | 0.953 |
Recommended: onnx/int8_int4_embeddings/model.onnx β ~5.6Γ smaller than FP32 at zero quality loss.
Benchmark β Patronus Validation Set
Held-out validation split of the internal Patronus prompt-injection dataset (5,000 sampled: 1,727 attack / 3,273 benign, max_length 512). In-distribution; quantization lossless.
| Variant | F1 | Precision | Recall | FPR | Accuracy |
|---|---|---|---|---|---|
| fp32 (parent) | 0.9971 | 0.9965 | 0.9977 | 0.002 | 0.998 |
| int8 | 0.9974 | 0.9971 | 0.9977 | 0.002 | 0.998 |
| int8_int4_embeddings | 0.9960 | 0.9948 | 0.9971 | 0.003 | 0.997 |
Files
onnx/fp16/model.onnx,onnx/int8/model.onnx,onnx/int8_int4_embeddings/model.onnxconfig.json,tokenizer.json,tokenizer_config.json(from the parent)metrics/quant_bench.json
Usage
import onnxruntime as ort, numpy as np
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("patronus-studio/wolf-defender-prompt-injection-edge")
sess = ort.InferenceSession("onnx/int8_int4_embeddings/model.onnx", providers=["CPUExecutionProvider"])
enc = tok("your text", truncation=True, max_length=2048, padding="longest", return_tensors="np")
logits = sess.run(["logits"], {"input_ids": enc["input_ids"].astype(np.int64),
"attention_mask": enc["attention_mask"].astype(np.int64)})[0]
pred = int(logits.argmax(1)[0]) # 1 = injection
π‘οΈ Patronus Protect
Brought to you by Patronus Protect β a local AI firewall that secures every AI interaction (prompts, tools, documents) before it reaches your models. Try it for free at patronus.studio.
License
This model is released under the Apache License 2.0.
A copy of the license is included as LICENSE in this repository.
Patronus Ark
This model is built to run inside Patronus Ark, Patronus' open-source on-device AI-security scanning library (L1 native rules β L2 NTDB cascade β L3 transformer). Ark is not publicly released yet β a repository link will be added here at launch.
- Downloads last month
- 20
Model tree for patronus-studio/wolf-defender-prompt-injection-edge
Base model
jhu-clsp/mmBERT-base