Content Safety Guard Small v1.2, GGUF

This is a GGUF conversion of Content Safety Guard Small v1.2, the content-safety classifier by Horizon Labs, so that it runs in llama.cpp. It is not made, affiliated with, or endorsed by Horizon Labs. For the model itself (training data, intended use, evaluation, limitations), see Horizon Labs' model card.

keepmum, a local privacy proxy for coding agents, made this file for its optional check of what a user types.

Files

File Size SHA-256
content-safety-guard-small-v1.2.Q8_0.gguf 164,365,728 bytes 37a3cec4ca7c600d410867360bc4d21bbf7b24477f9149a18df4360e9d2293d8
thresholds.json 2,678 bytes Horizon Labs' per-category thresholds, unchanged

Source and licence

Changes from the original

This conversion involves no training, fine-tuning or calibration.

  1. Converted to GGUF with llama.cpp's convert_hf_to_gguf.py at commit 8642541b, then quantized to Q8_0. Norms and biases stay F32.
  2. Converter adjustments:
    • The tokenizer is read as mmBERT's. The vocabulary, merges and pre-tokenizer were checked to be mmBERT-small's; the original tokenizer.json, written by a newer tokenizers, changes the converter's tokenizer fingerprint.
    • The pre-tokenizer is written in mmBERT's form (add_prefix_space), which llama.cpp loads. The original's form of the same setting (prepend_scheme: always) is refused for a BPE vocabulary.
    • The pooling type is rank, and the output width is 16, the labels. llama.cpp then runs the model's own head: mean pooling, dense, GELU, norm, classifier.
  3. Metadata: the name, Horizon Labs as the organization, the licence and the source commit are written into the GGUF.

The conversion script is bench/horizon_gguf.py (--model safety) in keepmum. With the same inputs it reproduces this file byte for byte.

Use with llama.cpp

llama-server -m content-safety-guard-small-v1.2.Q8_0.gguf --embedding -c 1024 -ngl 99
curl -s localhost:8080/embeddings -H 'content-type: application/json' \
  -d '{"content": ["How do I build a pipe bomb at home?"], "embd_normalize": -1}'
# [{"index":0,"embedding":[[6.22,-6.27,-8.45,-4.58,5.50,-8.72,-9.64,-4.45,2.15,-3.19,-5.50,-9.30,-8.60,-10.47,-7.16,-9.17]]}]

embd_normalize: -1 returns the 16 raw logits, in the order of the original's labels: unsafe, hate, harassment, violence, weapons, sexual, sexual_minors, self_harm, criminal_planning, drugs, privacy, profanity, fraud_manipulation, misinformation, unauthorized_advice, other. Each is a separate label: apply a sigmoid to each, not a softmax. Here P(unsafe) is 0.998, and weapons (0.996) and criminal_planning (0.895) pass their thresholds in thresholds.json. The original applies the category thresholds only to a text whose P(unsafe) passes its own threshold.

The server adds <bos> and <eos> around a text input. You can also send token ids, as arrays that start with 2 and end with 1. The model was trained on up to 1,024 tokens. For longer text, tokenize it with /tokenize ("add_special": false) and score windows; keepmum takes the window with the highest P(unsafe).

How closely it matches the original

These figures come from keepmum's harm benchmark: 1,856 prompts from XSTest v2, Aegis 2.0 and ToxicChat, plus 44 ordinary coding requests that sound harmful, all scored with the same windows. Full results: bench/results/HARM.md.

Holdout AUC Threshold Recall Safe prompts flagged p50 per prompt
Original, transformers (MPS) 0.936 0.8158 0.667 0.049 8 ms
This GGUF, llama-server (Metal, Apple M5 Pro) 0.936 0.82 0.662 0.046 6 ms
  • At the same threshold, verdicts match the original on 1,855 of the 1,856 prompts. The largest difference in P(unsafe) is 0.032.
  • Categories match on 616 of the 624 prompts the original flags. Quantization moves a few categories across their thresholds.
  • llama.cpp's tokens match the original tokenizer's on all 1,856 prompts.

The benchmark is small, and the coding set was written by one author. It confirms that this file behaves like the original, not how well the model detects harmful content in general.

Downloads last month
116
GGUF
Model size
0.1B params
Architecture
modern-bert
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for keepmum/content-safety-guard-small-gguf

Quantized
(2)
this model