Token Classification
Transformers
ONNX
Safetensors
Transformers.js
English
modernbert
prompt-injection
indirect-prompt-injection
prompt-localization
sanitization
ai-security
guardrails
tamarillo
prompt-injection-detection
jailbreak-detection
llm-security
litellm
nemo-guardrails
open-webui
Instructions to use Tamarillo/injection-span-guard-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Tamarillo/injection-span-guard-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="Tamarillo/injection-span-guard-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("Tamarillo/injection-span-guard-base") model = AutoModelForTokenClassification.from_pretrained("Tamarillo/injection-span-guard-base", device_map="auto") - Transformers.js
How to use Tamarillo/injection-span-guard-base with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('token-classification', 'Tamarillo/injection-span-guard-base'); - Notebooks
- Google Colab
- Kaggle
Document parity-verified Gather-INT8 ONNX (onnx/model_quantized.onnx) and { dtype: 'q8' } usage
Browse files
README.md
CHANGED
|
@@ -232,3 +232,8 @@ Trained exclusively on **commercially clean (`Apache-2.0`, `MIT`, `CC-BY-4.0`)**
|
|
| 232 |
- **Multilingual coverage caveat:** Explicit non-English attack training data is compact (`217` multilingual payloads in `fevziegeyurtsevenler/multilingual-prompt-injection` plus `6,078` 18-language benign queries from `mteb/amazon_massive_intent` and `mmBERT` cross-lingual pretraining); no per-language OOD breakdown is reported and non-English performance outside the evaluated mix is unverified.
|
| 233 |
- **Multi-kilotoken CPU latency:** On 4 vCPU threads (`onnxruntime` FP32), `Tamarillo/injection-span-guard-base` runs in `53.8 ms` at 64 tokens, `393.5 ms` at 512 tokens, `1093.8 ms` at 1,024 tokens, and `3340.0 ms` at 2,048 tokens. For high-throughput multi-kilotoken MCP gateways, deploy on GPU (`32.5 ms` p50 on `NVIDIA A100-SXM4-80GB` at 2,048 tokens) or use `tiny-en` on CPU/WASM.
|
| 234 |
- **Context extrapolation:** Validated up to `3,584` tokens; performance between `3,584` and `8,192` tokens relies on backbone RoPE extrapolation and is not directly benchmarked here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
- **Multilingual coverage caveat:** Explicit non-English attack training data is compact (`217` multilingual payloads in `fevziegeyurtsevenler/multilingual-prompt-injection` plus `6,078` 18-language benign queries from `mteb/amazon_massive_intent` and `mmBERT` cross-lingual pretraining); no per-language OOD breakdown is reported and non-English performance outside the evaluated mix is unverified.
|
| 233 |
- **Multi-kilotoken CPU latency:** On 4 vCPU threads (`onnxruntime` FP32), `Tamarillo/injection-span-guard-base` runs in `53.8 ms` at 64 tokens, `393.5 ms` at 512 tokens, `1093.8 ms` at 1,024 tokens, and `3340.0 ms` at 2,048 tokens. For high-throughput multi-kilotoken MCP gateways, deploy on GPU (`32.5 ms` p50 on `NVIDIA A100-SXM4-80GB` at 2,048 tokens) or use `tiny-en` on CPU/WASM.
|
| 234 |
- **Context extrapolation:** Validated up to `3,584` tokens; performance between `3,584` and `8,192` tokens relies on backbone RoPE extrapolation and is not directly benchmarked here.
|
| 235 |
+
|
| 236 |
+
### Gather-INT8 Quantized ONNX (`onnx/model_quantized.onnx` — `611.36 MB`, `1.92x` smaller)
|
| 237 |
+
|
| 238 |
+
- **Verified Parity (`onnx/quantization_check.json`):** `100.0%` prediction agreement vs. FP32 ONNX (mean abs probability diff `1e-05`, max `0.00112`; `167.31 ms` 4-thread CPU p50 @ 256 tokens).
|
| 239 |
+
- **Browser WASM / Node.js (`@huggingface/transformers` v3):** pass `{ dtype: "q8" }` to load `onnx/model_quantized.onnx` automatically.
|