Instructions to use Tamarillo/zeroshot-policy-guard-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Tamarillo/zeroshot-policy-guard-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-classification", model="Tamarillo/zeroshot-policy-guard-small")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Tamarillo/zeroshot-policy-guard-small") model = AutoModelForSequenceClassification.from_pretrained("Tamarillo/zeroshot-policy-guard-small", device_map="auto") - Transformers.js
How to use Tamarillo/zeroshot-policy-guard-small with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('zero-shot-classification', 'Tamarillo/zeroshot-policy-guard-small'); - Notebooks
- Google Colab
- Kaggle
- Tamarillo/zeroshot-policy-guard-small (v2)
- Model Overview
- 30-Second Quickstart
- Benchmarks (6 Strictly Zero-Shot OOD Suites + Held-Out Long-Context Policy Needle)
- Table 3: ONNX Exports, Parity Probes & 4-Thread x86-64 CPU Latency
- Production Inference Recipes
- Training Recipe & Clean Lineage (v2)
- Limitations & Responsible Use
- Repository Files
- Citation
- Model Overview
Tamarillo/zeroshot-policy-guard-small (v2)
140.6M-parameter, Apache-2.0, multilingual zero-shot policy, topic & NLI classifier (v2) (ModernBERT architecture with 8,192-token max position embeddings; distilled from Tamarillo/zeroshot-policy-guard-base v2 via Listwise + MarginMSE + Z-Score Logit-Standardized KD). At 4.0× smaller than MoritzLaurer/bge-m3-zeroshot-v2.0-c (567.8M), v2 improves over small v1 on all 6 strictly OOD suites — OOD Banking77 (0.577 -> 0.760), OOD CLINC150 (0.790 -> 0.828), OOD SIB-200 15-lang (0.682 -> 0.716), OOD AG News (0.687 -> 0.716), OOD ContractNLI (0.682 -> 0.695), and OOD XNLI 15-lang (0.854 -> 0.864) — shipping a 255.9 MB Gather-INT8 ONNX (24.5 ms CPU @ 64 tok; 14/14 short & 8/8 2K probe agreement).
Model Overview
| Property | Value |
|---|---|
| Architecture | ModernBertForSequenceClassification (0: entailment, 1: not_entailment, classifier_pooling="mean", zero trust_remote_code) |
| Base Backbone | jhu-clsp/mmBERT-small |
| Parameters | 140.6M |
| Context Window | 8,192 arch max · trained up to 3,584 tok · evaluated up to 4,096 tok · ONNX verified to 2,048 tok |
| Languages | 19 languages (direct fine-tuning on 18 MASSIVE locales + 10 Qwen3 + 17 PolyGuardMix langs; zero-shot evaluated on 15-lang XNLI & SIB-200, with vi/bg/el/sw/ur via mmBERT cross-lingual transfer) |
| License | Apache-2.0 |
| Open Companion Dataset | Tamarillo/multilingual-zeroshot-policy-2026 (Apache-2.0) |
| Sibling Models | Tamarillo/zeroshot-policy-guard-base (v2, 307.5M) · Tamarillo/zeroshot-policy-guard-tiny-en (v2, 32.0M) |
| Live Browser Demos | Tamarillo/zeroshot-policy-guard-demo · Tamarillo/agent-guardrails-suite |
| Open-Source Adapters | duoi-bt/tamarillo-guardrails |
30-Second Quickstart
pip install "transformers>=4.48.0" torch
from transformers import pipeline
clf = pipeline(
"zero-shot-classification",
model="Tamarillo/zeroshot-policy-guard-small",
model_kwargs={"attn_implementation": "eager"}, # deterministic ModernBERT parity
)
res = clf(
"Can you tell me which stocks will double next quarter so I can move my 401k?",
candidate_labels=["personalized financial advice", "software engineering", "travel planning"],
hypothesis_template="This text is about {}.",
multi_label=True, # independent P(entailment) per policy (matches ONNX/JS recipes; set False for mutually exclusive classes)
)
print(list(zip(res["labels"], [round(s, 4) for s in res["scores"]])))
# Expected: [('personalized financial advice', >0.85), ('software engineering', <0.10), ('travel planning', <0.10)]
Benchmarks (6 Strictly Zero-Shot OOD Suites + Held-Out Long-Context Policy Needle)
All 11 models are evaluated on identical, whitespace-normalized MD5-deduplicated test suites (eval_results.json). Hypothesis formatting & sampling protocol: NLI suites (OOD XNLI, OOD ContractNLI) evaluate each dataset's raw premise–hypothesis pairs directly without template wrapping; multi-class topic/intent suites (OOD SIB-200, OOD CLINC150, OOD AG News, OOD Banking77) wrap every candidate label with hypothesis_template="This text is about {}."; for CLINC150 (n=400 in-domain plus test) and Banking77 (n=300 test), each item is scored against a deterministic seeded 10-way candidate set (1 gold intent + 9 uniformly sampled distractors, seed=42 — apples-to-apples across all 11 models here, though not directly comparable to full 150-way/77-way literature benchmarks). GPU latency methodology (A100 p50): measured on 1× NVIDIA A100-SXM4-40GB, bs=1, bf16 for ModernBERT/BGE-M3 and FP32 for DeBERTa/mDeBERTa (avoiding DeBERTa bf16 attention overflow), attn_implementation="eager" for ModernBERT models, 5 warmup + 30 timed iterations (512-tok baselines run at their native 512-tok cap on the 2,048-tok probe).
Table 1: 6 Core Zero-Shot OOD Suites
OOD SIB-200(Davlan/sib200test,CC-BY-SA-4.0, strictly eval-only,15 langs × 60 = 900, 7-way topic) &OOD CLINC150(clinc/clinc_oosplustest,CC-BY-3.0,n=400, 10-way unseen assistant intents): strictly zero-shot OOD for EVERY model in the table (zero training overlap with either Tamarillo or MoritzLaurer).OOD XNLI(facebook/xnlitest,15 langs × 120 = 1,800, binary entailment ROC-AUC;‡in-distribution formDeBERTa-v3-base-mnli-xnli).OOD AG News(n=400, 4-way topic) &OOD Banking77(n=300, 10-way financial intent): strictly zero-shot OOD for Tamarillo &bge-m3-zeroshot-v2.0-c;†in-distribution for non--cMoritzLaurerv2.0 models (trained directly onagnewsandbanking77).OOD ContractNLI(kiddothe2b/contract-nlitest,CC-BY-NC-SA-4.0, strictly eval-only,n=400, real multi-page legal NDAs).
| Model | Params | License | Scope | OOD SIB-200 15-Lang (EN) F1 | OOD CLINC150 Acc | OOD XNLI 15-Lang (EN) AUC | OOD AG News F1 | OOD Banking77 Acc | OOD ContractNLI AUC | A100 p50 (64 / 2048 tok) |
|---|---|---|---|---|---|---|---|---|---|---|
Tamarillo/zeroshot-policy-guard-tiny-en (v2) |
32.0M | Apache-2.0 | 8K EN | 0.275 (0.751) | 0.780 | 0.646 (0.875) | 0.730 | 0.687 | 0.669 | 14.5 ms / 18.6 ms |
Tamarillo/zeroshot-policy-guard-small (v2) (this model) |
140.6M | Apache-2.0 | 8K Multi | 0.716 (0.755) | 0.828 | 0.864 (0.892) | 0.716 | 0.760 | 0.695 | 30.6 ms / 35.1 ms |
Tamarillo/zeroshot-policy-guard-base (v2) |
307.5M | Apache-2.0 | 8K Multi | 0.794 (0.832) | 0.863 | 0.895 (0.928) | 0.775 | 0.710 | 0.626 | 30.0 ms / 51.1 ms |
Tamarillo/zeroshot-policy-guard-tiny-en (v1) |
32.0M | Apache-2.0 | 8K EN | 0.163 (0.549) | 0.525 | 0.665 (0.874) | 0.679 | 0.497 | 0.704 | 14.3 ms / 18.7 ms |
Tamarillo/zeroshot-policy-guard-small (v1) |
140.6M | Apache-2.0 | 8K Multi | 0.682 (0.719) | 0.790 | 0.854 (0.908) | 0.687 | 0.577 | 0.682 | 30.9 ms / 40.2 ms |
Tamarillo/zeroshot-policy-guard-base (v1) |
307.5M | Apache-2.0 | 8K Multi | 0.733 (0.763) | 0.853 | 0.904 (0.957) | 0.710 | 0.673 | 0.620 | 30.4 ms / 55.6 ms |
MoritzLaurer/bge-m3-zeroshot-v2.0-c |
567.8M | MIT | 8K Multi | 0.777 (0.831) | 0.775 | 0.934 (0.969) | 0.675 | 0.630 | 0.638 | 27.3 ms / 61.4 ms |
MoritzLaurer/bge-m3-zeroshot-v2.0† |
567.8M | MIT | 8K Multi | 0.841 (0.824) | 0.863 | 0.940 (0.966) | 0.898 | 0.860 | 0.642 | 26.5 ms / 61.3 ms |
MoritzLaurer/deberta-v3-base-zeroshot-v2.0† |
184.4M | MIT | 512 EN | 0.559 (0.674) | 0.875 | 0.801 (0.975) | 0.882 | 0.860 | 0.521 | 22.1 ms / 21.5 ms |
MoritzLaurer/ModernBERT-base-zeroshot-v2.0† |
149.6M | Apache-2.0 | 8K EN | 0.365 (0.752) | 0.828 | 0.671 (0.982) | 0.874 | 0.830 | 0.649 | 30.4 ms / 51.1 ms |
MoritzLaurer/mDeBERTa-v3-base-mnli-xnli‡ |
278.8M | MIT | 512 Multi | 0.712 (0.773) | 0.782 | 0.932 (0.968) | 0.629 | 0.660 | 0.614 | 22.3 ms / 21.5 ms |
Table 2: Held-Out Balanced 4-Depth Long-Context Policy Needle (250 -> 3,200 tok; n=480)
Exact same 60 held-out Aegis 2.0 test policy violations + 60 matched benign prompts embedded inside neutral multi-paragraph prose at 4 depths ([email protected] / [email protected] / ROC-AUC). *In-domain disclosure: Tamarillo v1/v2 models (*) trained on Aegis 2.0 train and synthetic long-context haystacks (strictly MD5-deduplicated from Aegis 2.0 test), whereas competitor MoritzLaurer models did not train on Aegis 2.0 or synthetic long-context haystacks; treat Table 2 as a held-out in-domain long-context stress test for Tamarillo and zero-shot OOD for baselines (Table 1's OOD ContractNLI measures strictly zero-shot real long-document NLI for every model).
| Model | Eval Max Tok | @ ~250 tok | @ ~800 tok | @ ~1,600 tok | @ ~3,200 tok |
|---|---|---|---|---|---|
Tamarillo/zeroshot-policy-guard-tiny-en (v2)* |
4096 | 0.92 / 0.02 / 0.998 | 1.00 / 0.03 / 1.000 | 1.00 / 0.05 / 1.000 | 1.00 / 0.02 / 1.000 |
Tamarillo/zeroshot-policy-guard-small (v2)* (this model) |
4096 | 0.97 / 0.02 / 0.999 | 0.98 / 0.00 / 1.000 | 1.00 / 0.00 / 1.000 | 1.00 / 0.02 / 1.000 |
Tamarillo/zeroshot-policy-guard-base (v2)* |
4096 | 0.92 / 0.00 / 0.999 | 0.93 / 0.00 / 0.999 | 0.97 / 0.05 / 0.998 | 0.97 / 0.03 / 0.998 |
Tamarillo/zeroshot-policy-guard-tiny-en (v1)* |
4096 | 0.95 / 0.00 / 0.994 | 0.97 / 0.00 / 1.000 | 0.98 / 0.02 / 1.000 | 0.98 / 0.02 / 1.000 |
Tamarillo/zeroshot-policy-guard-small (v1)* |
4096 | 0.93 / 0.03 / 0.994 | 0.97 / 0.05 / 0.998 | 0.95 / 0.03 / 0.996 | 0.97 / 0.03 / 0.984 |
Tamarillo/zeroshot-policy-guard-base (v1)* |
4096 | 0.98 / 0.00 / 1.000 | 1.00 / 0.00 / 1.000 | 1.00 / 0.00 / 1.000 | 1.00 / 0.00 / 1.000 |
MoritzLaurer/bge-m3-zeroshot-v2.0-c |
4096 | 0.05 / 0.00 / 0.772 | 0.17 / 0.03 / 0.784 | 0.15 / 0.02 / 0.779 | 0.37 / 0.08 / 0.811 |
MoritzLaurer/bge-m3-zeroshot-v2.0† |
4096 | 0.10 / 0.00 / 0.791 | 0.18 / 0.00 / 0.774 | 0.17 / 0.00 / 0.757 | 0.28 / 0.03 / 0.751 |
MoritzLaurer/deberta-v3-base-zeroshot-v2.0† |
512 | 0.03 / 0.00 / 0.773 | 0.02 / 0.00 / 0.760 | 0.02 / 0.00 / 0.601 | 0.00 / 0.00 / 0.614 |
MoritzLaurer/ModernBERT-base-zeroshot-v2.0† |
4096 | 0.07 / 0.00 / 0.722 | 0.33 / 0.08 / 0.686 | 0.75 / 0.68 / 0.639 | 0.98 / 1.00 / 0.623 |
MoritzLaurer/mDeBERTa-v3-base-mnli-xnli‡ |
512 | 0.08 / 0.00 / 0.785 | 0.00 / 0.00 / 0.562 | 0.00 / 0.00 / 0.590 | 0.00 / 0.00 / 0.569 |
Honest comparison — where incumbents still win & where Tamarillo v2 wins:
- Where incumbents still win: Non-
-cMoritzLaurer/*-zeroshot-v2.0models were trained directly onAG NewsandBanking77(alongside broader academic datasets), sobge-m3-zeroshot-v2.0(567.8M) leads onSIB-200(0.841),XNLI(0.940), and in-distributionAG News/Banking77(0.898/0.860), whiledeberta-v3-base-zeroshot-v2.0edges outbasev2 on short-textCLINC150(0.875vs0.863). Commercialbge-m3-zeroshot-v2.0-c(567.8M) also leads on short-textXNLI(0.934vs ourbasev20.895). (v2 vs. v1 trade-offs:basev2 trades-0.009onXNLI 15-Lang[0.904 -> 0.895] andtiny-env2 trades-0.035onContractNLI[0.704 -> 0.669, still ahead ofbge-m3-c0.638] in exchange for+6.1to+25.5pt gains onSIB-200,CLINC150,AG News, andBanking77;smallv2 beatssmallv1 on all 7 suites.)- Where
Tamarillo/zeroshot-policy-guardv2 wins: (1) Commercially clean Apache-2.0 Pareto efficiency vs.bge-m3-zeroshot-v2.0-c(567.8M) — ourbasev2 (307.5M, 1.85× smaller) beatsbge-m3-zeroshot-v2.0-con 15-lang strictly OODSIB-200(0.794vs0.777), strictly OODCLINC150(0.863vs0.775), strictly OODAG News(0.775vs0.675), and strictly OODBanking77(0.710vs0.630); even our140.6Msmallv2 (4.0× smaller) and32.0Mtiny-env2 (17.7× smaller!) beatbge-m3-zeroshot-v2.0-conCLINC150,AG News,Banking77, and strictly zero-shot real long-documentOOD ContractNLI(0.695/0.669vs0.638); (2) Long-context 8K policy retrieval on held-outAegishaystacks (0.998–1.000AUC at3.2Ktok; note in-domain training advantage disclosed in Table 2); and (3) Zero-PyTorch ONNX & browser WASM readiness (61.3 MBFP16 tiny-en /255.9 MBq8 small /611.4 MBq8 base).
Table 3: ONNX Exports, Parity Probes & 4-Thread x86-64 CPU Latency
Measured on a GCP a2-highgpu-1g host VM (Intel Xeon Cascade Lake @ 2.20 GHz, x86-64, onnxruntime CPUExecutionProvider, intra_op_num_threads=4, ORT_ENABLE_ALL, bs=1, p50 ms). Parity probe scope: Short parity is measured on n=14 curated pairs (English + multilingual); 2,048-token parity is measured on n=8 long-context haystack pairs (scripts/export_onnx_v2.py).
| Export Artifact | Size | Short Probe (n=14, Agree / Δmax) |
2,048-Tok Probe (n=8, Agree / Δmax) |
CPU @ 64 tok | CPU @ 512 tok | CPU @ 1,024 tok | CPU @ 2,048 tok |
|---|---|---|---|---|---|---|---|
FP32 (onnx/model.onnx) |
537.0 MB | 1.0000 (Δ≤0.0000) | 1.0000 (Δ≤0.0000) | 25.7 ms | 191.3 ms | 541.7 ms | 1732.7 ms |
FP16 (onnx/model_fp16.onnx) |
268.7 MB | 1.0000 (Δ≤0.0018) | 1.0000 (Δ≤0.0042) | 30.5 ms | 219.6 ms | 660.0 ms | 2201.4 ms |
Gather-INT8 (onnx/model_quantized.onnx) |
255.9 MB | 1.0000 (Δ≤0.0208) | 1.0000 (Δ≤0.0145) | 24.5 ms | 194.7 ms | 562.4 ms | 1748.8 ms |
Production Inference Recipes
1. Zero-PyTorch ONNX Runtime (CPU Microservice)
pip install "transformers>=4.48.0" onnxruntime huggingface_hub numpy
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer
model_id = "Tamarillo/zeroshot-policy-guard-small"
tok = AutoTokenizer.from_pretrained(model_id, use_fast=True)
onnx_path = hf_hub_download(model_id, "onnx/model_quantized.onnx")
opts = ort.SessionOptions()
opts.intra_op_num_threads = 4
sess = ort.InferenceSession(onnx_path, sess_options=opts, providers=["CPUExecutionProvider"])
text = "Please recommend which crypto coins to buy with my retirement savings."
labels = ["personalized financial advice", "software engineering", "sports"]
enc = tok([text] * len(labels), [f"This text is about {l}." for l in labels], padding=True, truncation="only_first", max_length=2048, return_token_type_ids=False, return_tensors="np")
logits = sess.run(["logits"], {"input_ids": enc["input_ids"].astype(np.int64), "attention_mask": enc["attention_mask"].astype(np.int64)})[0]
e = np.exp(logits - np.max(logits, axis=-1, keepdims=True))
p_ent = (e / np.sum(e, axis=-1, keepdims=True))[:, 0]
for l, p in sorted(zip(labels, p_ent), key=lambda x: x[1], reverse=True):
print(f"{l}: {p:.4f}")
2. Drop-In llm-guard BanTopics Integration
pip install llm-guard
from llm_guard.input_scanners import BanTopics
from llm_guard.model import Model
tamarillo_model = Model(path="Tamarillo/zeroshot-policy-guard-small", onnx_path="Tamarillo/zeroshot-policy-guard-small", onnx_file_name="onnx/model_quantized.onnx")
scanner = BanTopics(topics=["financial advice", "medical diagnosis", "weapons"], model=tamarillo_model, threshold=0.5)
sanitized, is_valid, risk_score = scanner.scan("Which stocks should I buy tomorrow?")
print(is_valid, risk_score)
3. Browser / Node.js (@huggingface/transformers)
Note: Tamarillo/zeroshot-policy-guard-small downloads 255.9 MB for dtype: "q8" (well suited for Node.js and desktop browsers; for mobile/low-bandwidth browser tabs, prefer Tamarillo/zeroshot-policy-guard-tiny-en at 61–67 MB).
npm install @huggingface/transformers
import { AutoTokenizer, AutoModelForSequenceClassification } from "@huggingface/transformers";
const modelId = "Tamarillo/zeroshot-policy-guard-small";
const tokenizer = await AutoTokenizer.from_pretrained(modelId);
const model = await AutoModelForSequenceClassification.from_pretrained(modelId, { dtype: "q8" });
const text = "Can you advise me on avoiding capital gains tax on my stock portfolio?";
const labels = ["financial and tax advice", "cooking recipe", "software debugging"];
for (const lbl of labels) {
const inputs = await tokenizer(text, { text_pair: `This text is about ${lbl}.`, truncation: true, max_length: 2048 });
const { logits } = await model(inputs);
const [lEnt, lNot] = logits.data;
const pEnt = 1 / (1 + Math.exp(lNot - lEnt));
console.log(lbl, pEnt.toFixed(4));
}
Training Recipe & Clean Lineage (v2)
Standard ModernBertForSequenceClassification (0: entailment, 1: not_entailment, classifier_pooling="mean", attn_implementation="eager") initialized from jhu-clsp/mmBERT-small (140.6M params) and distilled from our Apache-2.0 flagship teacher Tamarillo/zeroshot-policy-guard-base (v2) across 141,085 grouped multi-hypothesis examples (323,979 pairs) using Hard Calibrated BCE + Listwise Group-Contrastive InfoNCE (0.45) + MarginMSE (0.30) + Batch Z-Score Logit-Standardized KL (0.15) + Listwise Group Ranking KL (0.10) + EMA (decay=0.996). Checkpoint selected strictly on unseen validation metrics (step 3625, raw, val_group_acc=0.9069, val_roc_auc=0.9588 — zero test peeking).
Training Data Provenance & License Verification
Every training source is verified commercially permissive (Apache-2.0, CC-BY-4.0, or permissive OANC/US-gov genres of MNLI — zero CC-BY-NC, zero CC-BY-SA, zero XNLI/SIB-200/CLINC150/AG News/Banking77/ContractNLI overlap). Davlan/sib200 (CC-BY-SA-4.0) and kiddothe2b/contract-nli (CC-BY-NC-SA-4.0) are strictly eval-only.
| Source | License | Role in v2 (141,085 groups / 323,979 pairs) |
|---|---|---|
Tamarillo/multilingual-zeroshot-policy-2026 (Qwen/Qwen3-8B) |
Apache-2.0 |
10-language 4-way hard-negative enterprise policy, support intent, DevOps, legal & long-doc groups |
MoritzLaurer/synthetic_zeroshot_mixtral_v0.1 (v4, v3, categories, characteristics, nli) |
Apache-2.0 |
Grouped multi-hypothesis zero-shot tasks, categories, characteristics & NLI |
nyu-mll/multi_nli (permissive OANC/gov genres only; excludes slate & fiction) |
Permissive OANC / US Gov | Deductive NLI entailment foundation |
alisawuffles/WANLI |
CC-BY-4.0 |
High-difficulty adversarial NLI entailment |
mteb/amazon_massive_intent & mteb/amazon_massive_scenario (18 locales) |
Apache-2.0 |
4-way grouped multilingual assistant intent & scenario classification |
ToxicityPrompts/PolyGuardMix (17 langs) |
CC-BY-4.0 |
4-way grouped multilingual safety policy (S1–S14) entailment |
nvidia/Aegis-AI-Content-Safety-Dataset-2.0 (train only) |
CC-BY-4.0 |
4-way grouped AI-agent safety policy entailment (test reserved for LC Needle eval) |
Limitations & Responsible Use
- Multilingual capacity vs.
basev2 (small, 140.6M): At 2.2× fewer parameters thanbasev2 and 4.0× fewer thanbge-m3-zeroshot-v2.0-c,smallv2 trailsbasev2 modestly on low-resourceXNLI&SIB-200languages (0.864vs0.895XNLI;0.716vs0.794SIB-200). Usebasev2 when maximum cross-lingual accuracy is required. - Zero-shot phrasing sensitivity & benign-mention false positives: Zero-shot entailment probabilities depend on label clarity and
hypothesis_template, and benign, educational, or analytical mentions of a restricted topic (e.g., discussing fraud detection or medical literature rather than soliciting harmful advice) can trigger elevated topic scores. Validate threshold calibration (0.50default) on a small held-out set of in-domain positives and hard benign mentions. - No defense against encrypted or multi-turn obfuscated attacks: Base64/ciphered payloads or attacks split across multiple turns can evade single-turn zero-shot classifiers.
- Long-context ceiling: Trained up to
3,584tokens and evaluated up to4,096tokens (ONNX parity probed to2,048tokens); inputs between4,096and8,192tokens have not been separately benchmarked.
Repository Files
| File | Description |
|---|---|
README.md |
Model card, 6 OOD + held-out LC needle benchmarks, provenance, and quickstarts |
config.json |
Model architecture configuration (ModernBertForSequenceClassification, 0: entailment, 1: not_entailment, classifier_pooling: mean) |
model.safetensors |
PyTorch weights (140.6M parameters, FP32 safetensors) |
tokenizer.json |
Fast Hugging Face tokenizer |
tokenizer_config.json |
Tokenizer configuration |
special_tokens_map.json |
Special tokens mapping |
onnx/model.onnx |
Parity-verified FP32 ONNX export (537.0 MB, opset 17) |
onnx/model_fp16.onnx |
Parity-verified FP16 ONNX export (268.7 MB) |
onnx/model_quantized.onnx |
Parity-verified Gather-INT8 ONNX export (255.9 MB, 14/14 short & 8/8 2K probe agreement) |
eval_results.json |
Full 6 OOD suites + held-out Aegis long-context needle benchmark results across 11 models |
onnx_benchmark.json |
Short (n=14) & 2,048-token (n=8) ONNX parity probes and 4-length x86-64 CPU latency benchmarks |
training_summary.json |
Validation trajectory and checkpoint selection record |
dataset_stats.json |
Exact training/validation group counts and source breakdown |
assets/pareto.svg |
2-panel strictly OOD SIB-200, CLINC150 & XNLI Pareto frontier chart |
scripts/schema.py |
2-class NLI label schema & policy templates |
scripts/synth_zeroshot_v2.py |
Qwen3-8B 10-language 4-way hard-negative corpus synthesizer |
scripts/data_builder_v2.py |
v2 grouped multi-hypothesis dataset & 6 OOD + LC needle benchmark builder |
scripts/train_v2.py |
v2 grouped Listwise InfoNCE trainer & Listwise/MarginMSE/Z-Score KD distiller |
scripts/export_onnx_v2.py |
Parity-gated FP32 / FP16 / Gather-INT8 ONNX exporter & CPU benchmarker |
scripts/eval_suite_v2.py |
Unified 6 OOD + held-out LC needle evaluator |
Citation
@misc{tamarillo_zeroshot_policy_guard_v2_2026,
title = {Tamarillo/zeroshot-policy-guard-small (v2): Apache-2.0 Long-Context Multilingual Zero-Shot Policy & NLI Classifier},
author = {Tamarillo Open-Model Lab},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/Tamarillo/zeroshot-policy-guard-small}}
}
- Downloads last month
- 84
Model tree for Tamarillo/zeroshot-policy-guard-small
Base model
jhu-clsp/mmBERT-smallDatasets used to train Tamarillo/zeroshot-policy-guard-small
nvidia/Aegis-AI-Content-Safety-Dataset-2.0
mteb/amazon_massive_intent
Spaces using Tamarillo/zeroshot-policy-guard-small 2
Collection including Tamarillo/zeroshot-policy-guard-small
Evaluation results
- OOD SIB-200 15-Lang Macro F1 on OOD SIB-200 (15-Lang) + CLINC150 + XNLI (15-Lang) + AG News + Banking77 + ContractNLIself-reported0.716
- OOD CLINC150 10-Way Acc on OOD SIB-200 (15-Lang) + CLINC150 + XNLI (15-Lang) + AG News + Banking77 + ContractNLIself-reported0.828
- OOD XNLI 15-Lang Macro ROC-AUC on OOD SIB-200 (15-Lang) + CLINC150 + XNLI (15-Lang) + AG News + Banking77 + ContractNLIself-reported0.864
- OOD AG News Macro F1 on OOD SIB-200 (15-Lang) + CLINC150 + XNLI (15-Lang) + AG News + Banking77 + ContractNLIself-reported0.716
- OOD Banking77 10-Way Acc on OOD SIB-200 (15-Lang) + CLINC150 + XNLI (15-Lang) + AG News + Banking77 + ContractNLIself-reported0.760
- OOD ContractNLI ROC-AUC on OOD SIB-200 (15-Lang) + CLINC150 + XNLI (15-Lang) + AG News + Banking77 + ContractNLIself-reported0.695