--- license: apache-2.0 tags: - prompt-injection - jailbreak-detection - guardrails - security - llm-security - ai-safety - ai-agent-security - patronus - multilingual - modernbert - onnx - quantized - edge base_model: patronus-studio/wolf-defender-prompt-injection pipeline_tag: text-classification language: - de - en --- # Model Card for Wolf Defender Prompt-Injection Detector Edge **Edge/quantized ONNX variant of [`patronus-studio/wolf-defender-prompt-injection`](https://huggingface.co/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](https://huggingface.co/datasets/rogue-security/prompt-injections-benchmark) (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.onnx` - `config.json`, `tokenizer.json`, `tokenizer_config.json` (from the parent) - `metrics/quant_bench.json` ## Usage ```python 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](https://patronus.studio)** — a local AI firewall that secures every AI interaction (prompts, tools, documents) before it reaches your models. **Try it for free at [patronus.studio](https://patronus.studio).** ## License This model is released under the [Apache License 2.0](https://www.apache.org/licenses/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.