nikiduki commited on
Commit
77eeccf
·
verified ·
1 Parent(s): a842d66

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +542 -68
README.md CHANGED
@@ -12,115 +12,589 @@ tags:
12
  - moderation
13
  - content-moderation
14
  - prompt-injection
 
15
  - russian
16
  - qwen3
17
  ---
18
 
19
  # HiveTraceGuard-Pro
20
 
21
- Compact Russian-first generative guardrail on [Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B). Classifies a **user request** (input guard) or a **request + assistant reply** (output guard) and returns one binary verdict: `safe` or `unsafe`. One generated token, stateless, role-aware over the final turn of the dialogue.
22
 
23
- Raw model decision — **no input normalizer, no post-processing**. Product line: [HiveTrace](https://hivetrace.ru/).
24
 
25
- ## Evaluation
26
-
27
- Multilingual safety benchmarks, greedy single-token decision. Harm-only sets report recall / FNR by design.
28
-
29
- | Benchmark | F1 | Recall | FPR | FNR |
30
- |---|---|---|---|---|
31
- | StrongReject++ (RU) | — | 0.981 | — | 0.019 |
32
- | StrongReject++ (EN) | — | 0.978 | — | 0.022 |
33
- | StrongReject++ (UKR) | — | 0.955 | — | 0.045 |
34
- | StrongReject++ (BE) | — | 0.930 | — | 0.070 |
35
- | StrongReject++ (UZ) | — | 0.582 | — | 0.419 |
36
- | Prompt injection (RU) | — | 0.999 | — | 0.001 |
37
- | Prompt injection (EN) | — | 0.880 | — | 0.120 |
38
- | BeaverTails (response) | 0.856 | 0.833 | 0.153 | 0.167 |
39
- | AEGIS 2.0 (prompt) | 0.822 | 0.793 | — | 0.207 |
40
- | AEGIS 2.0 (response) | 0.801 | 0.881 | — | 0.119 |
41
- | S-Eval (attack set) | — | 0.806 | — | 0.194 |
42
- | XSTest | 0.776 | 0.920 | 0.360 | 0.080 |
43
- | S-Eval (base risk) | — | 0.716 | — | 0.284 |
44
- | ToxicChat | 0.507 | 0.425 | 0.020 | 0.575 |
45
-
46
- p50 latency 32.75 ms (single verdict token).
47
-
48
- ## Policy taxonomy
49
-
50
- Returns only `safe` / `unsafe` (no category code). The policy lives in `chat_template.jinja` and covers 15 harm categories (cybercrime, pornography/CSAM, religious hate, profanity, financial crime, weapons, discrimination, self-harm, child labor, non-violent crime, violence, drugs, and others) plus attack classes (jailbreak, obfuscation, secret extraction, prompt injection, tool hijack). Neutral legal / medical / educational / news / art / defensive content is `safe` unless it enables, instructs, promotes, finances, or conceals harm.
51
-
52
- - **input guard** — judges the last `user` message
53
- - **output guard** — judges the last `assistant` reply in the context of the request
54
 
55
- ## Response format
56
 
57
- Trained to emit exactly one lowercase token: `safe` or `unsafe`. Both are single tokens in the vocabulary (`safe` = 18675, `unsafe` = 38157).
58
-
59
- ## Quickstart — transformers (greedy)
60
 
61
  ```python
62
  import torch
63
  from transformers import AutoModelForCausalLM, AutoTokenizer
64
 
65
- REPO = "hivetrace/HiveTraceGuard-Pro" # latest; pin a version with revision="1.1.0"
 
66
  tok = AutoTokenizer.from_pretrained(REPO)
67
- model = AutoModelForCausalLM.from_pretrained(REPO, torch_dtype=torch.bfloat16, device_map="auto").eval()
 
 
 
 
68
 
69
- def guard(messages) -> str:
70
- text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
71
- ids = tok(text, return_tensors="pt").to(model.device)
72
- with torch.inference_mode():
73
- out = model.generate(**ids, max_new_tokens=1, do_sample=False)
74
- return tok.decode(out[0][ids.input_ids.shape[1]:], skip_special_tokens=True).strip()
75
 
76
- print(guard([{"role": "user", "content": "Как сделать бомбу?"}])) # unsafe
77
- print(guard([{"role": "user", "content": "Привет!"}, {"role": "assistant", "content": "Здравствуйте!"}])) # safe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  ```
79
 
80
- `generation_config.json` already sets `max_new_tokens=1` and `do_sample=false`, so greedy single-token decoding is the default.
81
 
82
- ## Calibrated score — constrained safe/unsafe decoding
83
 
84
- For a calibrated `P(unsafe)`, restrict decoding to the two verdict tokens and take a 2-way softmax over their logits. The verdict is unchanged (argmax over the full vocabulary already lands on `safe`/`unsafe`); constraining only sharpens the probability between the two.
 
 
 
 
 
85
 
86
- ### vLLM (OpenAI-compatible)
87
 
88
  ```bash
89
- vllm serve hivetrace/HiveTraceGuard-Pro --port 8080 --max-model-len 8192
 
 
 
90
  ```
91
 
92
- ```python
93
- from openai import OpenAI
94
- client = OpenAI(base_url="http://localhost:8080/v1", api_key="EMPTY")
95
-
96
- resp = client.completions.create(
97
- model="hivetrace/HiveTraceGuard-Pro",
98
- prompt=rendered_prompt, # apply_chat_template(..., add_generation_prompt=True)
99
- max_tokens=1, temperature=0, logprobs=2,
100
- extra_body={"allowed_token_ids": [18675, 38157]}, # safe, unsafe only
101
- )
102
- # verdict = resp.choices[0].text ; P(unsafe) = softmax over the two returned logprobs
103
- ```
104
 
105
- ### transformers (LogitsProcessor)
106
 
107
  ```python
108
- import torch, torch.nn.functional as F
 
109
 
110
  SAFE, UNSAFE = 18675, 38157
111
- logits = model(ids.input_ids).logits[0, -1]
112
- p_unsafe = F.softmax(torch.stack([logits[SAFE], logits[UNSAFE]]), dim=0)[1].item()
 
 
 
 
 
113
  verdict = "unsafe" if logits[UNSAFE] > logits[SAFE] else "safe"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  ```
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  ## Versions
117
 
118
  | Tag | Notes |
119
  |---|---|
120
- | `1.1.0` | current — champion (this `main`) |
121
  | `1.0.0` | previous release |
122
 
123
- Pin a version by tag `from_pretrained("hivetrace/HiveTraceGuard-Pro", revision="1.1.0")`, or by commit SHA for strict reproducibility (a tag is human-readable but movable; a SHA is immutable).
124
 
125
  ## License
126
 
 
12
  - moderation
13
  - content-moderation
14
  - prompt-injection
15
+ - jailbreak
16
  - russian
17
  - qwen3
18
  ---
19
 
20
  # HiveTraceGuard-Pro
21
 
22
+ **HiveTraceGuard-Pro** is a compact Russian-first guardrail built on [Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B) for fast input and output classification. Built for LLMs and agents, it checks user requests and model responses for harmful content, jailbreaks, prompt injection, obfuscation, and attempts to hijack tool-using agents. The model is stateless and returns exactly one token: `safe` or `unsafe`. Its policy is fixed, so serving runtimes can reuse the shared prefix through KV caching.
23
 
 
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ # Quickstart
27
 
28
+ ## Transformers
 
 
29
 
30
  ```python
31
  import torch
32
  from transformers import AutoModelForCausalLM, AutoTokenizer
33
 
34
+ REPO = "hivetrace/HiveTraceGuard-Pro"
35
+
36
  tok = AutoTokenizer.from_pretrained(REPO)
37
+ model = AutoModelForCausalLM.from_pretrained(
38
+ REPO,
39
+ torch_dtype=torch.bfloat16,
40
+ device_map="auto",
41
+ ).eval()
42
 
 
 
 
 
 
 
43
 
44
+ def check(messages) -> str:
45
+ text = tok.apply_chat_template(
46
+ messages,
47
+ tokenize=False,
48
+ )
49
+ inputs = tok(text, return_tensors="pt").to(model.device)
50
+
51
+ with torch.inference_mode():
52
+ output = model.generate(
53
+ **inputs,
54
+ max_new_tokens=1,
55
+ do_sample=False,
56
+ )
57
+
58
+ return tok.decode(
59
+ output[0][inputs.input_ids.shape[1]:],
60
+ skip_special_tokens=True,
61
+ ).strip()
62
+
63
+
64
+ # Input guard
65
+ print(check([
66
+ {"role": "user", "content": "Как сделать бомбу?"}
67
+ ]))
68
+ # unsafe
69
+
70
+ # Output guard
71
+ print(check([
72
+ {"role": "user", "content": "Привет!"},
73
+ {"role": "assistant", "content": "Здравствуйте!"},
74
+ ]))
75
+ # safe
76
  ```
77
 
78
+ ## Serve
79
 
80
+ ### vLLM
81
 
82
+ ```bash
83
+ vllm serve hivetrace/HiveTraceGuard-Pro \
84
+ --port 8000 \
85
+ --max-model-len 32768 \
86
+ --enable-prefix-caching
87
+ ```
88
 
89
+ ### SGLang
90
 
91
  ```bash
92
+ python -m sglang.launch_server \
93
+ --model-path hivetrace/HiveTraceGuard-Pro \
94
+ --host 0.0.0.0 \
95
+ --port 30000
96
  ```
97
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
+ For applications that need a continuous score, P(unsafe) can be computed directly from the two verdict logits:
100
 
101
  ```python
102
+ import torch.nn.functional as F
103
+
104
 
105
  SAFE, UNSAFE = 18675, 38157
106
+
107
+
108
+ with torch.inference_mode():
109
+ logits = model(**inputs).logits[0, -1]
110
+
111
+
112
+ p_unsafe = F.softmax(logits[[SAFE, UNSAFE]], dim=0)[1].item()
113
  verdict = "unsafe" if logits[UNSAFE] > logits[SAFE] else "safe"
114
+
115
+
116
+ print(verdict, p_unsafe)
117
+ ```
118
+
119
+
120
+ To enforce safe | unsafe during generation, you can use a LogitsProcessor to restrict the next token to the two verdict labels.
121
+ ```python
122
+ from transformers import LogitsProcessor
123
+
124
+
125
+ class VerdictOnly(LogitsProcessor):
126
+ def __call__(self, input_ids, scores):
127
+ mask = torch.full_like(scores, float("-inf"))
128
+ mask[:, [SAFE, UNSAFE]] = scores[:, [SAFE, UNSAFE]]
129
+ return mask
130
+
131
+
132
+ output = model.generate(
133
+ **inputs,
134
+ max_new_tokens=1,
135
+ do_sample=False,
136
+ logits_processor=[VerdictOnly()],
137
+ )
138
  ```
139
 
140
+ ## Evaluation
141
+
142
+ ### Harmful content detection
143
+
144
+ <table>
145
+ <thead>
146
+ <tr>
147
+ <th rowspan="2">Model</th>
148
+ <th colspan="5">Requests</th>
149
+ <th colspan="3">Responses</th>
150
+ </tr>
151
+ <tr>
152
+ <th>AEGIS 2.0</th>
153
+ <th>ToxicChat</th>
154
+ <th>XSTest</th>
155
+ <th>XSafety<br>EN</th>
156
+ <th>OpenAI<br>Moderation</th>
157
+ <th>AEGIS 2.0</th>
158
+ <th>BeaverTails</th>
159
+ <th>HarmBench</th>
160
+ </tr>
161
+ </thead>
162
+
163
+ <tbody>
164
+ <tr>
165
+ <td><b>HiveTraceGuard-Pro (0.6B)</b></td>
166
+ <td>0.817</td>
167
+ <td>0.588</td>
168
+ <td>0.754</td>
169
+ <td>0.590</td>
170
+ <td><b>0.803</b></td>
171
+ <td>0.797</td>
172
+ <td>0.839</td>
173
+ <td>0.814</td>
174
+ </tr>
175
+
176
+ <tr>
177
+ <td>Shieldstral-1.0-3B</td>
178
+ <td>0.808</td>
179
+ <td><b>0.732</b></td>
180
+ <td><b>0.922</b></td>
181
+ <td><b>0.595</b></td>
182
+ <td>0.794</td>
183
+ <td>0.766</td>
184
+ <td>0.828</td>
185
+ <td>0.854</td>
186
+ </tr>
187
+
188
+ <tr>
189
+ <td>YuFeng-XGuard-Reason-0.6B</td>
190
+ <td><b>0.847</b></td>
191
+ <td>0.620</td>
192
+ <td>0.920</td>
193
+ <td>0.469</td>
194
+ <td>0.787</td>
195
+ <td>0.789</td>
196
+ <td>0.828</td>
197
+ <td><b>0.858</b></td>
198
+ </tr>
199
+
200
+ <tr>
201
+ <td>Qwen3Guard-Gen-0.6B</td>
202
+ <td>0.788</td>
203
+ <td>0.692</td>
204
+ <td>0.861</td>
205
+ <td>0.580</td>
206
+ <td>0.715</td>
207
+ <td><b>0.819</b></td>
208
+ <td><b>0.845</b></td>
209
+ <td>0.856</td>
210
+ </tr>
211
+
212
+ <tr>
213
+ <td>Llama-Guard-3-1B</td>
214
+ <td>0.733</td>
215
+ <td>0.385</td>
216
+ <td>0.837</td>
217
+ <td>0.368</td>
218
+ <td>0.766</td>
219
+ <td>0.635</td>
220
+ <td>0.652</td>
221
+ <td>0.794</td>
222
+ </tr>
223
+ </tbody>
224
+ </table>
225
+
226
+
227
+ ### Attack & jailbreak detection
228
+
229
+ <table>
230
+ <thead>
231
+
232
+ <tr>
233
+ <th rowspan="3">Model</th>
234
+ <th rowspan="2" colspan="2">S-Eval</th>
235
+ <th rowspan="2" colspan="2">HarmBench · Requests</th>
236
+ <th rowspan="2" colspan="6">Red teaming</th>
237
+ <th colspan="4">Internal</th>
238
+ </tr>
239
+
240
+ <tr>
241
+ <th colspan="2">Prompt injection</th>
242
+ <th colspan="2">Robustness Test</th>
243
+ </tr>
244
+
245
+ <tr>
246
+ <th>Base</th>
247
+ <th>Attack</th>
248
+
249
+ <th>Standard</th>
250
+ <th>Contextual</th>
251
+
252
+ <th>OR-Bench<br>Toxic</th>
253
+ <th>MultiJail<br>EN</th>
254
+ <th>SimpleSafety<br>Tests</th>
255
+ <th>CSRT</th>
256
+ <th>Aya<br>RU</th>
257
+ <th>Aya<br>EN</th>
258
+
259
+ <th>RU</th>
260
+ <th>EN</th>
261
+
262
+ <th>Real<br>Harm</th>
263
+ <th>Robust<br>Harm</th>
264
+ </tr>
265
+
266
+ </thead>
267
+
268
+ <tbody>
269
+
270
+ <tr>
271
+ <td><b>HiveTraceGuard-Pro (0.6B)</b></td>
272
+ <td>0.710</td>
273
+ <td>0.802</td>
274
+ <td>0.862</td>
275
+ <td>0.667</td>
276
+ <td>0.915</td>
277
+ <td>0.746</td>
278
+ <td>0.910</td>
279
+ <td>0.743</td>
280
+ <td><b>0.952</b></td>
281
+ <td><b>0.917</b></td>
282
+ <td><b>0.999</b></td>
283
+ <td><b>0.877</b></td>
284
+ <td><b>0.954</b></td>
285
+ <td><b>0.872</b></td>
286
+ </tr>
287
+
288
+ <tr>
289
+ <td>Shieldstral-1.0-3B</td>
290
+ <td>0.731</td>
291
+ <td>0.611</td>
292
+ <td><b>0.987</b></td>
293
+ <td>0.951</td>
294
+ <td><b>0.997</b></td>
295
+ <td><b>0.946</b></td>
296
+ <td><b>1.000</b></td>
297
+ <td><b>0.895</b></td>
298
+ <td>0.938</td>
299
+ <td><b>0.917</b></td>
300
+ <td>0.836</td>
301
+ <td>0.741</td>
302
+ <td>0.867</td>
303
+ <td>0.762</td>
304
+ </tr>
305
+
306
+ <tr>
307
+ <td>YuFeng-XGuard-Reason-0.6B</td>
308
+ <td><b>0.794</b></td>
309
+ <td><b>0.954</b></td>
310
+ <td>0.981</td>
311
+ <td><b>0.975</b></td>
312
+ <td>0.974</td>
313
+ <td>0.905</td>
314
+ <td>0.990</td>
315
+ <td>0.689</td>
316
+ <td>0.906</td>
317
+ <td>0.850</td>
318
+ <td>0.919</td>
319
+ <td>0.867</td>
320
+ <td>0.884</td>
321
+ <td>0.685</td>
322
+ </tr>
323
+
324
+ <tr>
325
+ <td>Qwen3Guard-Gen-0.6B</td>
326
+ <td>0.698</td>
327
+ <td>0.609</td>
328
+ <td>0.962</td>
329
+ <td>0.963</td>
330
+ <td>0.979</td>
331
+ <td>0.933</td>
332
+ <td>0.990</td>
333
+ <td>0.835</td>
334
+ <td>0.926</td>
335
+ <td>0.907</td>
336
+ <td>0.894</td>
337
+ <td>0.727</td>
338
+ <td>0.864</td>
339
+ <td>0.788</td>
340
+ </tr>
341
+
342
+ <tr>
343
+ <td>Llama-Guard-3-1B</td>
344
+ <td>0.489</td>
345
+ <td>0.588</td>
346
+ <td>0.956</td>
347
+ <td>0.926</td>
348
+ <td>0.824</td>
349
+ <td>0.644</td>
350
+ <td>0.970</td>
351
+ <td>0.514</td>
352
+ <td>0.588</td>
353
+ <td>0.565</td>
354
+ <td>0.636</td>
355
+ <td>0.679</td>
356
+ <td>0.675</td>
357
+ <td>0.730</td>
358
+ </tr>
359
+
360
+ </tbody>
361
+ </table>
362
+
363
+
364
+ ### Multilingual evaluation
365
+
366
+ <table>
367
+ <thead>
368
+
369
+ <tr>
370
+ <th rowspan="3">Model</th>
371
+ <th colspan="4">PolyGuard</th>
372
+ <th colspan="4">RTP-LX</th>
373
+ <th colspan="5">StrongReject++</th>
374
+ </tr>
375
+
376
+ <tr>
377
+ <th colspan="2">Requests</th>
378
+ <th colspan="2">Responses</th>
379
+
380
+ <th colspan="2">Requests</th>
381
+ <th colspan="2">Responses</th>
382
+
383
+ <th rowspan="2" align="center" valign="middle">EN</th>
384
+ <th rowspan="2" align="center" valign="middle">RU</th>
385
+ <th rowspan="2" align="center" valign="middle">UKR</th>
386
+ <th rowspan="2" align="center" valign="middle">BE</th>
387
+ <th rowspan="2" align="center" valign="middle">UZ</th>
388
+ </tr>
389
+
390
+ <tr>
391
+ <th>EN</th>
392
+ <th>RU</th>
393
+ <th>EN</th>
394
+ <th>RU</th>
395
+
396
+ <th>EN</th>
397
+ <th>RU</th>
398
+ <th>EN</th>
399
+ <th>RU</th>
400
+ </tr>
401
+
402
+ </thead>
403
+
404
+ <tbody>
405
+
406
+ <tr>
407
+ <td><b>HiveTraceGuard-Pro (0.6B)</b></td>
408
+ <td>0.759</td>
409
+ <td>0.806</td>
410
+ <td>0.845</td>
411
+ <td>0.828</td>
412
+ <td><b>0.896</b></td>
413
+ <td>0.841</td>
414
+ <td>0.321</td>
415
+ <td>0.146</td>
416
+ <td>0.978</td>
417
+ <td>0.974</td>
418
+ <td>0.943</td>
419
+ <td>0.923</td>
420
+ <td>0.553</td>
421
+ </tr>
422
+
423
+ <tr>
424
+ <td>Shieldstral-1.0-3B</td>
425
+ <td><b>0.904</b></td>
426
+ <td><b>0.874</b></td>
427
+ <td>0.877</td>
428
+ <td>0.876</td>
429
+ <td>0.872</td>
430
+ <td><b>0.855</b></td>
431
+ <td>0.469</td>
432
+ <td>0.061</td>
433
+ <td>0.990</td>
434
+ <td><b>0.987</b></td>
435
+ <td><b>0.984</b></td>
436
+ <td><b>0.974</b></td>
437
+ <td><b>0.901</b></td>
438
+ </tr>
439
+
440
+ <tr>
441
+ <td>YuFeng-XGuard-Reason-0.6B</td>
442
+ <td>0.896</td>
443
+ <td>0.872</td>
444
+ <td><b>0.901</b></td>
445
+ <td><b>0.885</b></td>
446
+ <td>0.858</td>
447
+ <td>0.844</td>
448
+ <td>0.322</td>
449
+ <td>0.041</td>
450
+ <td><b>0.994</b></td>
451
+ <td>0.978</td>
452
+ <td>0.936</td>
453
+ <td>0.665</td>
454
+ <td>0.220</td>
455
+ </tr>
456
+
457
+ <tr>
458
+ <td>Qwen3Guard-Gen-0.6B</td>
459
+ <td>0.894</td>
460
+ <td>0.857</td>
461
+ <td>0.873</td>
462
+ <td>0.866</td>
463
+ <td>0.813</td>
464
+ <td>0.767</td>
465
+ <td>0.266</td>
466
+ <td>0.041</td>
467
+ <td>0.987</td>
468
+ <td>0.971</td>
469
+ <td>0.927</td>
470
+ <td>0.847</td>
471
+ <td>0.607</td>
472
+ </tr>
473
+
474
+ <tr>
475
+ <td>Llama-Guard-3-1B</td>
476
+ <td>0.775</td>
477
+ <td>0.663</td>
478
+ <td>0.776</td>
479
+ <td>0.704</td>
480
+ <td>0.563</td>
481
+ <td>0.449</td>
482
+ <td><b>0.667</b></td>
483
+ <td><b>0.516</b></td>
484
+ <td>0.955</td>
485
+ <td>0.882</td>
486
+ <td>0.853</td>
487
+ <td>0.748</td>
488
+ <td>0.144</td>
489
+ </tr>
490
+
491
+ </tbody>
492
+ </table>
493
+
494
+
495
+ ### Benign over-blocking — FPR ↓
496
+
497
+ <table>
498
+ <thead>
499
+
500
+ <tr>
501
+ <th rowspan="3">Model</th>
502
+ <th rowspan="2">OR-Bench</th>
503
+ <th colspan="3">Internal</th>
504
+ </tr>
505
+
506
+ <tr>
507
+ <th colspan="3">Robustness Test</th>
508
+ </tr>
509
+
510
+ <tr>
511
+ <th>Hard</th>
512
+ <th>Clean RU<br>Requests</th>
513
+ <th>Adversarial RU<br>Requests</th>
514
+ <th>RU<br>Responses</th>
515
+ </tr>
516
+
517
+ </thead>
518
+
519
+ <tbody>
520
+
521
+ <tr>
522
+ <td><b>HiveTraceGuard-Pro (0.6B)</b></td>
523
+ <td>0.607</td>
524
+ <td><b>0.016</b></td>
525
+ <td>0.132</td>
526
+ <td>0.026</td>
527
+ </tr>
528
+
529
+ <tr>
530
+ <td>Shieldstral-1.0-3B</td>
531
+ <td>0.767</td>
532
+ <td>0.043</td>
533
+ <td>0.078</td>
534
+ <td>0.012</td>
535
+ </tr>
536
+
537
+ <tr>
538
+ <td>YuFeng-XGuard-Reason-0.6B</td>
539
+ <td><b>0.225</b></td>
540
+ <td>0.030</td>
541
+ <td><b>0.051</b></td>
542
+ <td><b>0.000</b></td>
543
+ </tr>
544
+
545
+ <tr>
546
+ <td>Qwen3Guard-Gen-0.6B</td>
547
+ <td>0.732</td>
548
+ <td>0.071</td>
549
+ <td>0.117</td>
550
+ <td>0.008</td>
551
+ </tr>
552
+
553
+ <tr>
554
+ <td>Llama-Guard-3-1B</td>
555
+ <td>0.374</td>
556
+ <td>0.090</td>
557
+ <td>0.126</td>
558
+ <td>0.182</td>
559
+ </tr>
560
+
561
+ </tbody>
562
+ </table>
563
+
564
+
565
+
566
+
567
+
568
+ **GuardRate Leaderboard:** **Score 0.743** · **28.8 ms p95** - [OPEN](https://huggingface.co/spaces/hivetrace/GuardRateLeaderboard)
569
+
570
+ ![image](https://cdn-uploads.huggingface.co/production/uploads/64ba6151b7fa1c3726b7819e/jnARg5EX71S0XNi4B-oV_.png)
571
+
572
+
573
+ ## Policy taxonomy
574
+
575
+ HiveTraceGuard-Pro uses a fixed policy and returns a single binary verdict: `safe` (token_id = 18675) or `unsafe` (token_id = 38157).
576
+
577
+ | Scope | What is checked |
578
+ | :---------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
579
+ | **Harmful content** | 15 harm categories: cybercrime, pornography and CSAM, religious hate, profanity, financial crime, weapons, discrimination, self-harm, child labor, non-violent crime, violence, drugs, and related harmful activity |
580
+ | **LLM & agent attacks** | jailbreaks, prompt injection, obfuscation, secret extraction, and tool hijacking | |
581
+
582
+ ### Guard modes
583
+ Both modes use the same policy.
584
+
585
+ | Mode | What is classified |
586
+ | :--------------- | :--------------------------------------------------------------------------- |
587
+ | **Input guard** | The final `user` message |
588
+ | **Output guard** | The final `assistant` response, evaluated in the context of the user request |
589
+
590
  ## Versions
591
 
592
  | Tag | Notes |
593
  |---|---|
594
+ | `1.1.0` | latest (`main`)|
595
  | `1.0.0` | previous release |
596
 
597
+ Pin a version by tag `from_pretrained("hivetrace/HiveTraceGuard-Pro", revision="1.1.0")`, or by commit SHA for strict reproducibility.
598
 
599
  ## License
600