Choice-only ONNX export for the Mini-Jev cold shell-safety expert on a smaller body. Given a proposed shell command (and optional short state), the model picks one of three outcomes: allow, warn, or block.
Fine-tuned from Qwen/Qwen2.5-0.5B-Instruct (base Instruct weights; this expert’s own LoRA merge). The graph keeps the shared Qwen2.5-0.5B body and a three-row Choice head. Output is choice_logits with shape [batch, 3].
Related always-hot router (Phase S, same body family): nicolasembleton/mini-jev-qwen25-0.5b-router-v0-choice-onnx. Sibling expert: nicolasembleton/mini-jev-qwen25-0.5b-function-router-v0-choice-onnx.
| Index | Label | Letter | Token id | Meaning |
|---|---|---|---|---|
| 0 | allow | A | 32 | Run the command |
| 1 | warn | B | 33 | Surface a warning before run |
| 2 | block | C | 34 | Refuse the command |
Letter token ids were probed on the Qwen tokenizer (bare A / B / C). See token_probe_ABC.json and candidate_tokens.json.
| Name | Type | Shape / notes |
|---|---|---|
input_ids |
int64 | token ids |
attention_mask |
int64 | attention mask |
choice_logits (output) |
float | [batch, 3] — logits at the last sequence position |
Prompt pattern: system + State + A/B/C safety menu + partial assistant "Answer: " (chat template with continue_final_message=True). Softmax over the three logits, then argmax.
| File | Role |
|---|---|
choice_only.onnx |
Float graph (external weights) |
choice_only.onnx_data |
Companion weight file for the float graph (~0.96 GiB) |
choice_only_q4.onnx |
MatMulNBits q4 (block size 32) single-file graph for browser ONNX Runtime Web (WebAssembly), ~453.87 MiB |
candidate_tokens.json |
Letter / label / token id map |
token_probe_ABC.json |
Live tokenizer probe for bare A/B/C |
export_meta.json |
Float export metadata |
quant_meta.json |
Quantization metadata |
op_inventory.json |
Operator inventory (classifier MatMul is hidden→3 only) |
ort_smoke.json |
ONNX Runtime float smoke |
ort_smoke_q4.json |
ONNX Runtime q4 smoke |
r5a_node_wasm_smoke.json |
Node ONNX Runtime WebAssembly load / forward metrics |
parity_summary.json |
Gold-panel parity summary |
shell_safety_gold.jsonl |
Planted shell-safety gold battery used for parity (n=105) |
Planted shell-safety gold panel n = 105 (allow / warn / block).
Node onnxruntime-web WebAssembly: load about 2819 ms, one forward about 808 ms, output shape [1, 3].
Use a thin ort.InferenceSession (Python or JavaScript ONNX Runtime). Feed input_ids and attention_mask; read choice_logits and take argmax over the three choices.
import numpy as np
import onnxruntime as ort
session = ort.InferenceSession("choice_only.onnx", providers=["CPUExecutionProvider"])
# input_ids, attention_mask: int64 arrays shaped [batch, seq]
outs = session.run(None, {"input_ids": input_ids, "attention_mask": attention_mask})
choice_logits = outs[0] # [batch, 3]
pred = int(np.argmax(choice_logits[0]))
label = ["allow", "warn", "block"][pred]
For the browser path, load choice_only_q4.onnx with ONNX Runtime Web (WebAssembly) the same way.
Trained from base Qwen/Qwen2.5-0.5B-Instruct with a dedicated shell-safety LoRA, then merged and exported Choice-only. This package does not reuse the Phase S router LoRA. Gold-panel ids were held out of train where applicable.
Apache-2.0
choice_only_q4.onnx 454 MiBchoice_only.onnx 1 MiB