Run this model with HF Jobs

Run Tamarillo/refusal-guard-tiny-en on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/Tamarillo/refusal-guard-tiny-en. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Tamarillo/refusal-guard-tiny-en on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
File size: 19,921 Bytes
217d858
 
 
 
 
 
 
c218ea9
 
 
217d858
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
---
language:
  - en
license: apache-2.0
base_model: jhu-clsp/ettin-encoder-32m
pipeline_tag: text-classification
library_name: transformers
datasets:
  - Tamarillo/refusal-compliance-corpus-2026
  - ToxicityPrompts/PolyGuardMix
tags:
  - refusal-detection
  - over-refusal
  - llm-safety
  - red-teaming
  - garak
  - guardrails
  - ai-security
  - modernbert
  - onnx
  - transformers.js
  - tamarillo
model-index:
  - name: Tamarillo/refusal-guard-tiny-en
    results:
      - task:
          type: text-classification
          name: LLM Refusal vs. Compliance Detection
        dataset:
          type: multi-tier-refusal-eval
          name: OOD Do-Not-Answer + OOD JBB + Held-Out WildGuardTest EN/JP
        metrics:
          - type: ood_do_not_answer_roc_auc
            value: 0.7906
            name: OOD Do-Not-Answer ROC-AUC
          - type: ood_jbb_macro_f1
            value: 0.5426
            name: OOD JBB-JudgeComparison Macro-F1 (@0.50)
          - type: heldout_wildguard_en_macro_f1
            value: 0.8583
            name: Held-Out WildGuardTest-EN Macro-F1 (@0.50)
          - type: heldout_wildguard_jp_macro_f1
            value: 0.4019
            name: Held-Out WildGuardTest-JP Macro-F1 (@0.50)
          - type: diag_phi4_disclaimer_fpr
            value: 0.0000
            name: Independent Phi-4-mini Disclaimer-Compliance FPR (@0.50)
---

# Tamarillo/refusal-guard-tiny-en

**32.0M-parameter, Apache-2.0, 8K-context English refusal vs. compliance classifier** — **4.7× smaller than `garak-llm/garak-refusal-detector` (`149M`)** and **2.6× smaller than archived `ProtectAI/distilroberta-base-rejection-v1` (`82M`)**, running in **`9.6 ms` CPU ONNX @ 64 tok** (`67.2 MB` `q8`). Built as a **1-line zero-code drop-in for `NVIDIA/garak` `mitigation.ModernBERTRefusal`** (`id2label={0: "non-refusal", 1: "refusal"}`) and as a fast local sidecar for red-teaming and over-refusal fallback routing. Distilled from an internal `mmBERT-base` (`307.5M`) teacher trained on commercially clean multi-LLM responses + paired same-topic disclaimer-compliance hard negatives (`NVIDIA/garak#2197`), achieving **`0.858` Macro-F1 (`0.947` AUC) on `Held-Out WildGuardTest-EN`** (beating 4.7× larger `garak-refusal-detector` `0.798`), **`0.896` Macro-F1 (`0.000` FPR) on independent `Phi-4-mini` Disclaimer-Compliance**, and **`0.908` Macro-F1 (`0.982` AUC) on `~1.6K`-token agent traces** (where `garak` & `ProtectAI` drop to `0.000` recall). *(Honest caveat: trails `garak-refusal-detector` & `ProtectAI` on 2023-era `OOD Do-Not-Answer` `0.791` ROC-AUC / `0.440` Macro-F1 and `OOD JBB` `0.620` ROC-AUC / `0.543` Macro-F1 — see Table 1.)*

![Tamarillo/refusal-guard Pareto Frontier](assets/pareto.svg)

---

## Model Overview

| Property | Value |
|---|---|
| **Architecture** | `ModernBertForSequenceClassification` (`0: non-refusal`, `1: refusal`, zero `trust_remote_code`) |
| **Base Backbone** | [`jhu-clsp/ettin-encoder-32m`](https://huggingface.co/jhu-clsp/ettin-encoder-32m) |
| **Parameters** | `32.0M` (distilled from internal `mmBERT-base` `307.5M` teacher) |
| **Context Window** | `7,999` arch max · trained up to `2,560` tok · evaluated up to `2,048` tok · ONNX verified to `2,048` tok |
| **Languages** | English-primary (`ettin-encoder-32m`) |
| **License** | `Apache-2.0` |
| **Sibling Model** | `Tamarillo/refusal-guard-small` (140.6M, 17+ languages) |
| **Open Contrastive Corpus** | [`Tamarillo/refusal-compliance-corpus-2026`](https://huggingface.co/datasets/Tamarillo/refusal-compliance-corpus-2026) (`Apache-2.0`) |
| **Live Browser Demo** | [`Tamarillo/refusal-guard-demo`](https://huggingface.co/spaces/Tamarillo/refusal-guard-demo) |
| **Open-Source Adapters** | [`duoi-bt/tamarillo-guardrails`](https://github.com/duoi-bt/tamarillo-guardrails) |

---

## Benchmarks (3-Tier Evaluation vs. Live Incumbents)

All models are evaluated identically on MD5-deduplicated test suites with zero train/val overlap (`eval_results.json`). Every thresholded metric (`Macro-F1`, `Recall`, `FPR`) uses the **default `0.50` probability threshold**. GPU latency is measured on an **NVIDIA A100-SXM4-40GB** (`bf16`, `attn_implementation="eager"`, `bs=1`, `p50` ms).

### Table 1: Tier A (Strictly Zero-Shot OOD) & Tier B (Same-Taxonomy Held-Out Test)

- **Tier A — Strictly Zero-Shot External OOD (different taxonomy & provenance):**
  - `OOD Do-Not-Answer` (`LibrAI/do-not-answer`, `CC-BY-NC-SA-4.0`, strictly eval-only, `n=1800`, `pos=1681`, 6 real 2023 LLMs; unambiguous human action codes `0,4 -> refusal`, `5 -> compliance`, excluding ambiguous educational/discussion actions `1,2,3`). Note: heavily refusal-skewed (`93.4%` positive), so read `ROC-AUC` and `Macro-F1` jointly.
  - `OOD JBB-JudgeComparison` (`JailbreakBench/JBB-Behaviors`, `MIT`, `n=300`, `pos=190`, 3-human majority vote; note that non-jailbreak includes occasional benign off-topic responses alongside refusals).
- **Tier B — Same-Taxonomy Held-Out Test (honestly labeled):**
  - `Held-Out WildGuardTest-EN` & `Held-Out WildGuardTest-JP` (`sbintuitions/WildGuardTestJP`, `ODC-BY`, `n=1719` each, `pos=562`). Because `ToxicityPrompts/PolyGuardMix` derives from the WildGuard training taxonomy/pipeline, we honestly classify these as **Same-Taxonomy Held-Out** rather than strictly OOD (despite strict MD5 deduplication).

| Model | Params | Scope / License | OOD Do-Not-Answer (AUC / Macro-F1) | OOD JBB-Judge (AUC / Macro-F1) | Held-Out WildGuard-EN (AUC / F1 / FPR@0.50 ↓) | Held-Out WildGuard-JP (AUC / F1 / FPR@0.50 ↓) | A100 p50 (64 / 2048 tok) |
|---|---:|---|---|---|---|---|---|
| **`Tamarillo/refusal-guard-tiny-en`** *(this model)* | 32.0M | EN (8K, Apache-2.0) | 0.791 / 0.440 | 0.620 / 0.543 | 0.947 / 0.858 / 0.168 | 0.438 / 0.402 / 0.002 | 14.8 ms / 24.6 ms |
| **`Tamarillo/refusal-guard-small`** | 140.6M | 17+ Langs (8K, Apache-2.0) | 0.729 / 0.377 | 0.576 / 0.537 | 0.943 / 0.873 / 0.105 | 0.962 / 0.865 / 0.160 | 31.2 ms / 36.6 ms |
| `garak-llm/garak-refusal-detector` | 149.6M | EN (8K, NVIDIA Open Model) | 0.940 / 0.575 | 0.706 / 0.581 | 0.927 / 0.798 / 0.016 | 0.896 / 0.600 / 0.003 | 29.9 ms / 51.7 ms |
| `ProtectAI/distilroberta-base-rejection-v1` (archived) | 82.1M | EN (512, Apache-2.0) | 0.950 / 0.858 | 0.678 / 0.597 | 0.911 / 0.820 / 0.106 | 0.837 / 0.402 / 0.000 | 6.7 ms / 6.5 ms |
| `NVIDIA/garak` keyword baseline (`MitigationBypass`) | 0M | EN substring rules | 0.849 / 0.701 | 0.646 / 0.569 | 0.837 / 0.792 / 0.271 | 0.500 / 0.402 / 0.000 | — / — |

*Note: `VINAY-UMRETHE/tiny-refusal-classifier` (`1.6M`) uses a `transformers>=5.0` `TokenizersBackend` format incompatible with `transformers==4.51.3` and collapsed to `~1.0` FPR under fallback loading, so it is omitted from Table 1/2 to avoid an unfair tokenizer-mismatched comparison (raw output remains in `eval_results.json`).*

### Table 2: Tier C — Independent-Generator (`microsoft/Phi-4-mini-instruct`) Diagnostic Stress Suites

Generated by an **independent MIT-licensed model (`microsoft/Phi-4-mini-instruct`)** on 30 completely disjoint topics (industrial SCADA, aviation, healthcare, banking, telecom, etc. — **zero overlap with `Qwen/Qwen3-8B` training prompts**, preventing model self-benchmarking). Note that while the generator and topics are independent, Tier C remains a **synthetic diagnostic suite** aligned with our disclaimer-compliance and agent-trace style family (read alongside real human-labeled Tier A & Tier B results in Table 1). Tests `NVIDIA/garak#2197` failure modes (`fulfillment_with_disclaimer`, `apology_then_compliance`, `meta_safety_discussion`) vs. direct/redirection/agent-tool refusals (`n=360`), plus `~1,400–1,800`-token agent traces (`n=240`, 3× past 512-tok truncation yet cleanly inside the `2,048`-tok evaluation limit).

| Model | Eval Max Tok | Disclaimer Stress Macro-F1 | Disclaimer Recall@0.50 | Disclaimer FPR@0.50 ↓ | LC ~1.6K Trace Macro-F1 | LC ~1.6K Recall@0.50 | LC ~1.6K FPR@0.50 ↓ |
|---|---:|---:|---:|---:|---:|---:|---:|
| **`Tamarillo/refusal-guard-tiny-en`** *(this model)* | 2048 | 0.896 | 0.794 | 0.000 | 0.908 | 0.833 | 0.017 |
| **`Tamarillo/refusal-guard-small`** | 2048 | 0.967 | 0.939 | 0.006 | 0.967 | 0.942 | 0.008 |
| `garak-llm/garak-refusal-detector` | 2048 | 0.501 | 0.172 | 0.000 | 0.333 | 0.000 | 0.000 |
| `ProtectAI/distilroberta-base-rejection-v1` (archived) | 512 | 0.536 | 0.228 | 0.028 | 0.333 | 0.000 | 0.000 |
| `NVIDIA/garak` keyword baseline (`MitigationBypass`) | 0 | 0.621 | 0.733 | 0.483 | 0.646 | 0.750 | 0.450 |

> **Honest comparison — where incumbents win & where Tamarillo wins:**
> - **Where incumbents win (`OOD Do-Not-Answer` & `OOD JBB-JudgeComparison`):** On 2023-era verbose/moralizing refusals (`LibrAI/do-not-answer`, `action in {0,4} vs 5`) and `JailbreakBench/JBB-Behaviors`, `garak-llm/garak-refusal-detector` (`0.940` / `0.706` AUC; `0.575` / `0.581` Macro-F1) and archived `ProtectAI/distilroberta-base-rejection-v1` (`0.950` / `0.678` AUC; `0.858` / `0.597` Macro-F1, though at `0.370` FPR on `Do-Not-Answer`) outperform both `Tamarillo/refusal-guard-tiny-en` (`0.791` / `0.620` AUC) and `Tamarillo/refusal-guard-small` (`0.729` / `0.576` AUC). Training with `1.4×`-weighted disclaimer-compliance hard negatives makes Tamarillo conservative on verbose hedged 2023 replies; if your workload primarily scores short 2023-style English completions and you accept the NVIDIA license, `garak-llm/garak-refusal-detector` remains stronger on `Do-Not-Answer` and `JBB`.
> - **Where `Tamarillo/refusal-guard` wins decisively:** (1) **Long-context agent traces (`~1.6K` tok):** `small` hits **`0.967` Macro-F1 (`0.994` AUC, `0.942` Recall, `0.008` FPR)** and `tiny-en` hits **`0.908` F1 (`0.982` AUC)** while BOTH `garak-refusal-detector` (`0.000` Recall!) and 512-tok `ProtectAI` (`0.000` Recall!) collapse completely; (2) **Multilingual (`WildGuardTest-JP`, `n=1,719`):** `small` hits **`0.865` Macro-F1 (`0.962` AUC)** vs. `garak` `0.600` F1 (`+26.5` pts) and `ProtectAI` `0.402` F1 (`+46.3` pts); (3) **Independent `Phi-4-mini` Disclaimer-Compliance stress (`garak#2197`):** `small` hits **`0.967` F1 (`0.006` FPR)** and `tiny-en` **`0.896` F1 (`0.000` FPR)** vs. `garak` `0.501` F1 (`0.172` Recall), `ProtectAI` `0.536` F1, and keyword rules (`0.483` FPR); and (4) **`Held-Out WildGuardTest-EN`:** `small` (`0.873` F1 / `0.943` AUC) and 4.7× smaller `tiny-en` (`0.858` F1 / `0.947` AUC) beat `garak` (`0.798` F1) and `ProtectAI` (`0.820` F1) — noting honestly that `PolyGuardMix` shares the WildGuard taxonomy.

---

## Table 3: ONNX Exports, Parity Gates & 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).

| Export Artifact | Size | Short Parity (Agree / Δmax) | 2,048-Tok Parity (Agree / Δmax) | CPU @ 64 tok | CPU @ 512 tok | CPU @ 1,024 tok | CPU @ 2,048 tok |
|---|---:|---|---|---:|---:|---:|---:|
| FP32 (`onnx/model.onnx`) | 122.4 MB | 1.0000 (Δ≤0.0000) | 1.0000 (Δ≤0.0000) | 9.9 ms | 77.1 ms | 238.8 ms | 783.3 ms |
| FP16 (`onnx/model_fp16.onnx`) | 61.3 MB | 1.0000 (Δ≤0.0006) | 1.0000 (Δ≤0.0001) | 11.8 ms | 90.5 ms | 299.2 ms | 1063.3 ms |
| Gather-INT8 (`onnx/model_quantized.onnx`) | 67.2 MB | 1.0000 (Δ≤0.0090) | 1.0000 (Δ≤0.0016) | 9.6 ms | 78.5 ms | 242.6 ms | 781.3 ms |

*Note: Full-INT8 (`Gather+MatMul`) dynamic quantization is withheld because dynamic `MatMul` quantization degrades ModernBERT RoPE/GeGLU attention logits.*

---

## Quickstarts

### 1. 1-Line Drop-In for `NVIDIA/garak` (`mitigation.ModernBERTRefusal`)

Matches `garak`'s exact `ModernBertForSequenceClassification` architecture and target class name (`"refusal"`):

```bash
pip install garak
export OPENAI_API_KEY="your-key"  # or substitute any garak --model_type (ollama, huggingface, litellm, etc.)
garak --model_type openai --model_name gpt-4o-mini   --probes dan   --detectors mitigation.ModernBERTRefusal   --detector_option '{"mitigation.ModernBERTRefusal": {"detector_model_path": "Tamarillo/refusal-guard-tiny-en"}}'
```

### 2. PyTorch (`transformers>=4.48.0`)

```bash
pip install "transformers>=4.48.0" torch
```

```python
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline

model_id = "Tamarillo/refusal-guard-tiny-en"
tok = AutoTokenizer.from_pretrained(model_id, use_fast=True)
mod = AutoModelForSequenceClassification.from_pretrained(
    model_id,
    attn_implementation="eager",  # avoids ModernBERT SDPA padding numerical drift
).eval()
clf = pipeline("text-classification", model=mod, tokenizer=tok, truncation=True, max_length=2048)

print(clf("Sure, here is how parameterized SQL prevents injection. Note that attacking systems without permission is illegal."))
print(clf("I can't execute destructive DROP TABLE statements on production, though I can generate a safe dry-run migration."))
```

### 3. Zero-PyTorch ONNX Runtime (CPU Sidecar / Gateway Fallback Routing)

```bash
pip install "transformers>=4.48.0" onnxruntime huggingface_hub numpy
```

```python
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer

model_id = "Tamarillo/refusal-guard-tiny-en"
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 = "Sorry for the earlier delay! Here is the complete Argon2id password hashing script."
enc = tok(text, truncation=True, 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][0]
probs = np.exp(logits - logits.max()) / np.exp(logits - logits.max()).sum()
print({"non-refusal": round(float(probs[0]), 4), "refusal": round(float(probs[1]), 4)})
```

### 4. Browser / Node.js (`@huggingface/transformers`)

```bash
npm install @huggingface/transformers
```

```javascript
import { AutoTokenizer, AutoModelForSequenceClassification } from "@huggingface/transformers";

const modelId = "Tamarillo/refusal-guard-tiny-en";
const tokenizer = await AutoTokenizer.from_pretrained(modelId);
const model = await AutoModelForSequenceClassification.from_pretrained(modelId, { dtype: "q8" });

const inputs = await tokenizer("I cannot export raw private keys, but I can show redacted audit logs.", { truncation: true, max_length: 2048 });
const { logits } = await model(inputs);
const [l0, l1] = Array.from(logits.data);
const m = Math.max(l0, l1);
const pRefusal = Math.exp(l1 - m) / (Math.exp(l0 - m) + Math.exp(l1 - m));
console.log({ label: pRefusal >= 0.5 ? "refusal" : "non-refusal", pRefusal: Number(pRefusal.toFixed(4)) });
```

---

## Training Recipe & Verified Data Provenance

Distilled from our internal `jhu-clsp/mmBERT-base` (`307.5M`) teacher using **Logit-Standardized Knowledge Distillation (`T=2.5` KL + centered-logit MSE) + Label-Smoothed CE (`1.4×` hard-negative disclaimer weight) + Paired Same-Topic Contrastive Margin + EMA (`decay=0.996`)**. Checkpoint selected strictly on unseen validation metrics (`step 1568`, `raw`, `val_macro_f1=0.9113`, `val_disclaimer_fpr=0.0089` — zero test peeking).

Every training source is verified commercially permissive (`CC-BY-4.0` / `Apache-2.0` — zero `CC-BY-NC`, zero `CC-BY-SA`). `LibrAI/do-not-answer` (`CC-BY-NC-SA-4.0`) is strictly eval-only.

| Source | License | Role in Training (`60,171` examples) |
|---|---|---|
| [`ToxicityPrompts/PolyGuardMix`](https://huggingface.co/datasets/ToxicityPrompts/PolyGuardMix) | `CC-BY-4.0` | Multi-LLM assistant responses with native `response_refusal_label` (English-only) |
| [`Tamarillo/refusal-compliance-corpus-2026`](https://huggingface.co/datasets/Tamarillo/refusal-compliance-corpus-2026) (`Qwen/Qwen3-8B`) | `Apache-2.0` | Paired same-topic 6-style contrastive refusal vs. disclaimer-compliance / apology-compliance / meta-safety replies |
| [`OpenAssistant/oasst2`](https://huggingface.co/datasets/OpenAssistant/oasst2) (`train`) | `Apache-2.0` | Real natural helpful assistant replies (prioritizing benign trigger-word responses) |

---

## Limitations & Responsible Use

- **English-only (`tiny-en`, 32.0M):** Trained exclusively on English data (`WildGuardTest-JP` Macro-F1 is `0.402`). For Japanese, Chinese, German, French, Spanish, Arabic, Korean, or other non-English responses, use sibling model `Tamarillo/refusal-guard-small` (`140.6M`, `WildGuardTest-JP` Macro-F1 `0.865`).
- **Response-only scope (no user prompt):** Because `Tamarillo/refusal-guard-tiny-en` classifies the assistant's reply text alone (matching `NVIDIA/garak` `ModernBERTRefusal`), it cannot judge whether a refusal was *justified* (safe vs. false over-refusal) or whether a compliant answer was *harmful*. For joint `(prompt, response)` safety + refusal + harmfulness classification, pair with [`Tamarillo/response-safety-guard-small`](https://huggingface.co/Tamarillo/response-safety-guard-small).
- **Thin adapter required for legacy `llm-guard`:** Archived `llm-guard` `NoRefusal` expects the uppercase label `"REJECTION"` and may pin older `transformers<4.48` without ModernBERT support; use our `RefusalGuard` adapter in [`duoi-bt/tamarillo-guardrails`](https://github.com/duoi-bt/tamarillo-guardrails) rather than assuming a zero-code `llm-guard` swap.
- **Ambiguous partial compliance:** Borderline "hedge-then-partially-answer" responses can fall near the `0.50` boundary; tune the decision threshold for your recall vs. precision requirements.

---

## Repository Files

| File | Description |
|---|---|
| `README.md` | Model card, 3-tier benchmarks, provenance, and quickstarts |
| `config.json` | Model architecture configuration (`ModernBertForSequenceClassification`, `0: non-refusal`, `1: refusal`) |
| `model.safetensors` | PyTorch weights (`32.0M` 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 (`122.4 MB`, opset 17) |
| `onnx/model_fp16.onnx` | Parity-verified FP16 ONNX export (`61.3 MB`) |
| `onnx/model_quantized.onnx` | Parity-verified Gather-INT8 ONNX export (`67.2 MB`) |
| `eval_results.json` | Full 3-tier 6-suite benchmark results vs. all 4 live incumbents |
| `onnx_benchmark.json` | Short & 2,048-token ONNX parity verification and 4-length x86-64 CPU latency |
| `training_summary.json` | Validation trajectory and checkpoint selection record |
| `assets/pareto.svg` | 2-panel size, multilingual & disclaimer-resistance Pareto chart |
| `scripts/schema.py` | Drop-in label schema, MD5 deduplication, and garak keyword baseline |
| `scripts/synth_refusal.py` | Qwen/Qwen3-8B 10-language paired contrastive refusal/disclaimer synthesizer |
| `scripts/synth_phi4_stress.py` | Independent microsoft/Phi-4-mini-instruct Tier-C diagnostic suite generator |
| `scripts/data_builder.py` | Commercially clean dataset builder & 3-tier 6-suite benchmark constructor |
| `scripts/train.py` | Teacher trainer & Logit-Standardized KD student distiller |
| `scripts/export_onnx.py` | Parity-gated FP32 / FP16 / Gather-INT8 ONNX exporter & CPU benchmarker |
| `scripts/eval_suite.py` | Unified 6-suite evaluator vs. live incumbents |

---

## Citation

```bibtex
@misc{tamarillo_refusal_guard_2026,
  title = {Tamarillo/refusal-guard-tiny-en: Apache-2.0 8K-Context Refusal vs. Compliance Classifier},
  author = {Tamarillo Open-Model Lab},
  year = {2026},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/Tamarillo/refusal-guard-tiny-en}}
}
```