Ollaya package for Qwen/Qwen3Guard-Gen-0.6B
Browse files- 0.6b/calibration.json +9 -0
- 0.6b/decision.json +154 -0
- 0.6b/model-fp32.onnx +3 -0
- 0.6b/questions.json +35 -0
- README.md +44 -0
0.6b/calibration.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"temperature": [
|
| 3 |
+
1.0,
|
| 4 |
+
1.0,
|
| 5 |
+
1.0
|
| 6 |
+
],
|
| 7 |
+
"temperature_by_options": {},
|
| 8 |
+
"source": "raw (no fitted temperature upstream)"
|
| 9 |
+
}
|
0.6b/decision.json
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"engine": "onnx",
|
| 3 |
+
"family": "qwen3guard",
|
| 4 |
+
"layout": "qwen3guard-gen-v1",
|
| 5 |
+
"upstream": {
|
| 6 |
+
"repo": "Qwen/Qwen3Guard-Gen-0.6B",
|
| 7 |
+
"revision": "fada3b2f655b89601929198343c94cd2f64d93cc"
|
| 8 |
+
},
|
| 9 |
+
"preset_only": true,
|
| 10 |
+
"questions": {
|
| 11 |
+
"safety": {
|
| 12 |
+
"type": "choice",
|
| 13 |
+
"instructions": "Qwen3Guard safety level of the user text",
|
| 14 |
+
"criteria": {
|
| 15 |
+
"safe": null,
|
| 16 |
+
"controversial": null,
|
| 17 |
+
"unsafe": null
|
| 18 |
+
}
|
| 19 |
+
},
|
| 20 |
+
"unsafe": {
|
| 21 |
+
"type": "noul",
|
| 22 |
+
"instructions": "Qwen3Guard: the user text is unsafe"
|
| 23 |
+
},
|
| 24 |
+
"unsafe_strict": {
|
| 25 |
+
"type": "noul",
|
| 26 |
+
"instructions": "Qwen3Guard: the user text is unsafe or controversial"
|
| 27 |
+
},
|
| 28 |
+
"category": {
|
| 29 |
+
"type": "choice",
|
| 30 |
+
"instructions": "Qwen3Guard: first unsafe category, given unsafe",
|
| 31 |
+
"criteria": {
|
| 32 |
+
"none": null,
|
| 33 |
+
"violent": null,
|
| 34 |
+
"non_violent_illegal": null,
|
| 35 |
+
"sexual": null,
|
| 36 |
+
"pii": null,
|
| 37 |
+
"suicide_self_harm": null,
|
| 38 |
+
"unethical": null,
|
| 39 |
+
"politically_sensitive": null,
|
| 40 |
+
"copyright": null,
|
| 41 |
+
"jailbreak": null
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"contract": {
|
| 46 |
+
"inputs": {
|
| 47 |
+
"input_ids": {
|
| 48 |
+
"dtype": "int64",
|
| 49 |
+
"shape": [
|
| 50 |
+
"rows",
|
| 51 |
+
"seq"
|
| 52 |
+
],
|
| 53 |
+
"note": "right-padded, any pad id"
|
| 54 |
+
},
|
| 55 |
+
"last_pos": {
|
| 56 |
+
"dtype": "int64",
|
| 57 |
+
"shape": [
|
| 58 |
+
"rows"
|
| 59 |
+
],
|
| 60 |
+
"note": "index of the last real token"
|
| 61 |
+
}
|
| 62 |
+
},
|
| 63 |
+
"outputs": {
|
| 64 |
+
"cand_logits": {
|
| 65 |
+
"dtype": "float32",
|
| 66 |
+
"shape": [
|
| 67 |
+
"rows",
|
| 68 |
+
13
|
| 69 |
+
],
|
| 70 |
+
"note": "[0:3] safety (safe, controversial, unsafe); [3:13] categories"
|
| 71 |
+
}
|
| 72 |
+
},
|
| 73 |
+
"attention": "causal; no mask input",
|
| 74 |
+
"positions": "0..seq-1, implicit"
|
| 75 |
+
},
|
| 76 |
+
"templates": {
|
| 77 |
+
"prompt_head": "<|im_start|>user\n# Task:\n1) Evaluate whether THE LAST USER's query belongs to safe or unsafe content based on our safety policy.\n2) Identify the category of unsafe content found.\n\n<BEGIN SAFETY POLICY>\n**Safety: Safe**: The USER's query does not contain any prohibited content or content that could lead to prohibited content.\n**Safety: Unsafe**: The USER's query contains prohibited content.\n**Safety: Controversial**: The USER's query does not explicitly contain prohibited content, but its intent, context, or potential responses could be misinterpreted, misused, or exploited to generate unsafe content under certain conditions.\n<END SAFETY POLICY>\n\n<BEGIN UNSAFE CONTENT CATEGORIES>\nViolent.\nNon-violent Illegal Acts.\nSexual Content or Sexual Acts.\nPII.\nSuicide & Self-Harm.\nUnethical Acts.\nPolitically Sensitive Topics.\nCopyright Violation.\nJailbreak.\n<END UNSAFE CONTENT CATEGORIES>\n\n<BEGIN CONVERSATION>\n\nUSER: ",
|
| 78 |
+
"prompt_tail": "\n\n<END CONVERSATION>\n\nProvide your safety assessment for ONLY THE LAST **USER's query** in the above conversation:\n - The first line must be one of: 'Safety: Safe', 'Safety: Unsafe', 'Safety: Controversial'.\n - The second line should start with 'Categories:' followed by a list of any unsafe content categories, separated by commas. If the content is safe, use 'Categories: None'.<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\n",
|
| 79 |
+
"state": "strings verbatim, else json.dumps(ensure_ascii=False)",
|
| 80 |
+
"row_safety": "{prompt_head}{state}{prompt_tail}Safety:",
|
| 81 |
+
"row_category": "{prompt_head}{state}{prompt_tail}Safety: Unsafe\nCategories:",
|
| 82 |
+
"tokenize": "whole row string, add_special_tokens=False, special tokens parsed"
|
| 83 |
+
},
|
| 84 |
+
"candidates": {
|
| 85 |
+
"safety": {
|
| 86 |
+
"labels": [
|
| 87 |
+
"safe",
|
| 88 |
+
"controversial",
|
| 89 |
+
"unsafe"
|
| 90 |
+
],
|
| 91 |
+
"texts": [
|
| 92 |
+
" Safe",
|
| 93 |
+
" Controversial",
|
| 94 |
+
" Unsafe"
|
| 95 |
+
],
|
| 96 |
+
"ids": [
|
| 97 |
+
22291,
|
| 98 |
+
2093,
|
| 99 |
+
73067
|
| 100 |
+
]
|
| 101 |
+
},
|
| 102 |
+
"category": {
|
| 103 |
+
"labels": [
|
| 104 |
+
"none",
|
| 105 |
+
"violent",
|
| 106 |
+
"non_violent_illegal",
|
| 107 |
+
"sexual",
|
| 108 |
+
"pii",
|
| 109 |
+
"suicide_self_harm",
|
| 110 |
+
"unethical",
|
| 111 |
+
"politically_sensitive",
|
| 112 |
+
"copyright",
|
| 113 |
+
"jailbreak"
|
| 114 |
+
],
|
| 115 |
+
"texts": [
|
| 116 |
+
" None",
|
| 117 |
+
" Violent",
|
| 118 |
+
" Non-violent Illegal Acts",
|
| 119 |
+
" Sexual Content or Sexual Acts",
|
| 120 |
+
" PII",
|
| 121 |
+
" Suicide & Self-Harm",
|
| 122 |
+
" Unethical Acts",
|
| 123 |
+
" Politically Sensitive Topics",
|
| 124 |
+
" Copyright Violation",
|
| 125 |
+
" Jailbreak"
|
| 126 |
+
],
|
| 127 |
+
"ids": [
|
| 128 |
+
2240,
|
| 129 |
+
29455,
|
| 130 |
+
11581,
|
| 131 |
+
38667,
|
| 132 |
+
393,
|
| 133 |
+
64800,
|
| 134 |
+
1230,
|
| 135 |
+
15928,
|
| 136 |
+
2955,
|
| 137 |
+
56146
|
| 138 |
+
]
|
| 139 |
+
}
|
| 140 |
+
},
|
| 141 |
+
"option_logits": {
|
| 142 |
+
"safety": "cand[r0, 0:3]",
|
| 143 |
+
"unsafe": "[logsumexp(cand[r0,0], cand[r0,1]), cand[r0,2]]",
|
| 144 |
+
"unsafe_strict": "[cand[r0,0], logsumexp(cand[r0,1], cand[r0,2])]",
|
| 145 |
+
"category": "cand[r1, 3:13]"
|
| 146 |
+
},
|
| 147 |
+
"max_len": 32768,
|
| 148 |
+
"special_tokens": {
|
| 149 |
+
"pad": 151643,
|
| 150 |
+
"bos": null,
|
| 151 |
+
"add_special_tokens": false
|
| 152 |
+
},
|
| 153 |
+
"opset": 20
|
| 154 |
+
}
|
0.6b/model-fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3e0f89fc275e2bb0d459248abaa0d97ed50f360e4e3a5f0c5b1b29af0765d312
|
| 3 |
+
size 5426737
|
0.6b/questions.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"safety": {
|
| 3 |
+
"type": "choice",
|
| 4 |
+
"instructions": "Qwen3Guard safety level of the user text",
|
| 5 |
+
"criteria": {
|
| 6 |
+
"safe": null,
|
| 7 |
+
"controversial": null,
|
| 8 |
+
"unsafe": null
|
| 9 |
+
}
|
| 10 |
+
},
|
| 11 |
+
"unsafe": {
|
| 12 |
+
"type": "noul",
|
| 13 |
+
"instructions": "Qwen3Guard: the user text is unsafe"
|
| 14 |
+
},
|
| 15 |
+
"unsafe_strict": {
|
| 16 |
+
"type": "noul",
|
| 17 |
+
"instructions": "Qwen3Guard: the user text is unsafe or controversial"
|
| 18 |
+
},
|
| 19 |
+
"category": {
|
| 20 |
+
"type": "choice",
|
| 21 |
+
"instructions": "Qwen3Guard: first unsafe category, given unsafe",
|
| 22 |
+
"criteria": {
|
| 23 |
+
"none": null,
|
| 24 |
+
"violent": null,
|
| 25 |
+
"non_violent_illegal": null,
|
| 26 |
+
"sexual": null,
|
| 27 |
+
"pii": null,
|
| 28 |
+
"suicide_self_harm": null,
|
| 29 |
+
"unethical": null,
|
| 30 |
+
"politically_sensitive": null,
|
| 31 |
+
"copyright": null,
|
| 32 |
+
"jailbreak": null
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- Qwen/Qwen3Guard-Gen-0.6B
|
| 5 |
+
library_name: onnx
|
| 6 |
+
tags:
|
| 7 |
+
- ollaya
|
| 8 |
+
- onnx
|
| 9 |
+
- decision-model
|
| 10 |
+
- system-one
|
| 11 |
+
pipeline_tag: text-classification
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# qwen3guard for Ollaya
|
| 15 |
+
|
| 16 |
+
[Ollaya](https://github.com/ollaya-dev/ollaya) package of **[Qwen/Qwen3Guard-Gen-0.6B](https://huggingface.co/Qwen/Qwen3Guard-Gen-0.6B)** by the Qwen team, Alibaba Cloud.
|
| 17 |
+
Ollaya runs open decision models locally, the way Ollama runs LLMs: typed questions in,
|
| 18 |
+
calibrated answers out, behind a TypeSafe-compatible API.
|
| 19 |
+
|
| 20 |
+
```sh
|
| 21 |
+
ollaya run qwen3guard
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
## What is in this repository
|
| 25 |
+
|
| 26 |
+
This repository holds only the files Ollaya derives, with no weights. Each graph is an ONNX export of the
|
| 27 |
+
original model whose weights **reference the authors' own weight files by byte offset**,
|
| 28 |
+
so `ollaya pull` downloads the weights from the upstream repositories, unmodified and pinned to a
|
| 29 |
+
commit, and verifies their sha256.
|
| 30 |
+
|
| 31 |
+
| Tag | Upstream | Files |
|
| 32 |
+
|---|---|---|
|
| 33 |
+
| `qwen3guard:0.6b` | [Qwen/Qwen3Guard-Gen-0.6B@fada3b2](https://huggingface.co/Qwen/Qwen3Guard-Gen-0.6B/tree/fada3b2f655b89601929198343c94cd2f64d93cc) | `0.6b/model-fp32.onnx`, `0.6b/decision.json`, `0.6b/calibration.json`, `0.6b/questions.json` |
|
| 34 |
+
|
| 35 |
+
Each tag has an fp32 graph, used on CPU and GPU. Each tag also has `decision.json` (sequence layout, special tokens) and
|
| 36 |
+
`calibration.json` (temperatures). `questions.json` holds the built-in questions: the model answers those and no others, so requests leave `questions` out.
|
| 37 |
+
|
| 38 |
+
## Parity
|
| 39 |
+
|
| 40 |
+
Ollaya's Rust runtime matches the transformers fp32 reference exactly on 74 texts (148 rows, 296 built-in questions). The token ids are identical, and so is the decision on every question. Probabilities are within 1.4e-5, on CPU and CUDA.
|
| 41 |
+
|
| 42 |
+
## License
|
| 43 |
+
|
| 44 |
+
Same as the upstream model (Apache-2.0). Ollaya itself is Apache-2.0.
|