patronus-studio/lion-warden-ai-security-classifier-edge

🤗 Hugging Face sourcetext-classificationapache-2.01.1 GBotherHF checksums availableupdated today
No torrent yet

Model Card for Lion Warden AI Security Classifier Edge

Quantized ONNX builds of Lion Warden AI Security Classifier for local / edge inference.

Read more

This repository contains the size- and memory-optimized ONNX exports of the FP32 model. For intended uses, class definitions, training data, benchmarks, and limitations, see the main model card.

Variants

Variant Path Quantization
FP16 onnx/fp16/model.onnx FP16 weights
INT8 onnx/int8/model.onnx Post-training dynamic INT8 (MatMul/Gemm)
INT8 + INT4 embeddings onnx/int8_int4_embeddings/model.onnx Dynamic INT8 plus 4-bit weight-only token embeddings

The exact quantization parameters are recorded in onnx/quantization_manifest.json.

Benchmark

Quantization parity for the v3 model, FP32 vs the recommended INT8+INT4-embeddings build (per-head F1 over non-null labels, CPU). Quantization is near-lossless, max degradation 0.005 F1 across all heads; FP16 and INT8 sit between FP32 and INT8+INT4.

Head FP32 F1 INT8+INT4 F1 Δ
injection 0.948 0.943 -0.005
sensitive_document 0.969 0.973 +0.004
tool_class 0.952 0.953 +0.001
tool_action 0.940 0.937 -0.003
tool_tags 0.947 0.947 0.000
routing 0.897 0.901 +0.004
threat 0.950 0.947 -0.003

Sizes: FP16 281 MB · INT8 144 MB · INT8+INT4 98 MB. Measured CPU latency (batch 64): ~19 ms/text for the INT8+INT4 build.

Full details in metrics/quant_bench.json.

Usage

The unified model has multiple output heads, so it is loaded with a plain ONNX Runtime session:

import onnxruntime as ort
from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer

model_id = "patronus-studio/lion-warden-ai-security-classifier-edge"
path = hf_hub_download(model_id, "onnx/int8_int4_embeddings/model.onnx")
session = ort.InferenceSession(path)
tokenizer = AutoTokenizer.from_pretrained(model_id)

enc = tokenizer("...", return_tensors="np")
names = [i.name for i in session.get_inputs()]
outputs = session.run(None, {k: v for k, v in enc.items() if k in names})

The output heads and their label spaces are documented in the main model card.

License

Released under the Apache License 2.0; the full text is included as LICENSE. Derived from Lion Warden AI Security Classifier and ultimately from jhu-clsp/mmBERT-small (MIT License); upstream notices are retained.

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 open source: GitHub repository · product page.

More information


🛡️ Patronus Protect

Brought to you by Patronus Protect, a local AI firewall that secures every AI interaction, including prompts, tools and documents, before it reaches your models.

Try it for free at patronus.studio.