Instructions to use VertexAGI/prism-safety-1-micro with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use VertexAGI/prism-safety-1-micro with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("VertexAGI/prism-safety-1-micro") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use VertexAGI/prism-safety-1-micro with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf VertexAGI/prism-safety-1-micro:Q4_K_M # Run inference directly in the terminal: llama cli -hf VertexAGI/prism-safety-1-micro:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf VertexAGI/prism-safety-1-micro:Q4_K_M # Run inference directly in the terminal: llama cli -hf VertexAGI/prism-safety-1-micro:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf VertexAGI/prism-safety-1-micro:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf VertexAGI/prism-safety-1-micro:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf VertexAGI/prism-safety-1-micro:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf VertexAGI/prism-safety-1-micro:Q4_K_M
Use Docker
docker model run hf.co/VertexAGI/prism-safety-1-micro:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use VertexAGI/prism-safety-1-micro with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "VertexAGI/prism-safety-1-micro" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VertexAGI/prism-safety-1-micro", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/VertexAGI/prism-safety-1-micro:Q4_K_M
- Ollama
How to use VertexAGI/prism-safety-1-micro with Ollama:
ollama run hf.co/VertexAGI/prism-safety-1-micro:Q4_K_M
- Unsloth Desktop
- Pi
How to use VertexAGI/prism-safety-1-micro with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VertexAGI/prism-safety-1-micro"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "VertexAGI/prism-safety-1-micro" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use VertexAGI/prism-safety-1-micro with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "VertexAGI/prism-safety-1-micro"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "VertexAGI/prism-safety-1-micro" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VertexAGI/prism-safety-1-micro", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use VertexAGI/prism-safety-1-micro with Docker Model Runner:
docker model run hf.co/VertexAGI/prism-safety-1-micro:Q4_K_M
- Lemonade
How to use VertexAGI/prism-safety-1-micro with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull VertexAGI/prism-safety-1-micro:Q4_K_M
Run and chat with the model
lemonade run user.prism-safety-1-micro-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use VertexAGI/prism-safety-1-micro with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VertexAGI/prism-safety-1-micro"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default VertexAGI/prism-safety-1-micro
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use VertexAGI/prism-safety-1-micro with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VertexAGI/prism-safety-1-micro"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "VertexAGI/prism-safety-1-micro" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Prism Safety 1 Micro
A 1.7B content-safety classifier that labels a user message, an assistant response, or a full exchange as SAFE or UNSAFE with a one-sentence reason.
Part of the Prism family of small, single-purpose models.
Overview
Prism Safety 1 Micro does one thing: content-safety classification. Given a user message, an assistant response, or a complete exchange, it returns a label and a short justification. It is a LoRA fine-tune of Qwen3-1.7B, trained on a mix of human-annotated public safety data and template-generated synthetic scenarios.
It is small enough to run locally on consumer hardware, which is the point — the intended use is moderating traffic to/from a larger model without a second API hop.
Results
Evaluated on five public human-annotated benchmarks, 400 class-stratified
examples each. The comparison model is nvidia/nemotron-3.5-content-safety, a
purpose-built guard model roughly 5x larger.
Aggregate over the four two-class benchmarks (n=1,600):
| Model | Accuracy | Recall | FPR | Malformed |
|---|---|---|---|---|
| Qwen3-1.7B (untuned, prompted) | 69.4% | 79.5% | 40.7% | 1 |
| Prism Safety 1 Micro | 78.4% | 86.5% | 29.8% | 0 |
| nemotron-3.5-content-safety | 84.4% | 90.8% | 22.0% | 0 |
Per benchmark:
| Benchmark | Prism acc | nemotron acc | Prism recall | nemotron recall |
|---|---|---|---|---|
| ToxicChat | 88.5% | 92.8% | 84.5% | 92.0% |
| BeaverTails | 74.8% | 81.0% | 79.5% | 76.0% |
| XSTest | 76.8% | 83.5% | 89.0% | 99.0% |
| OpenAI-Mod | 73.5% | 80.2% | 93.0% | 96.0% |
| Do-Not-Answer | 60.2% | 67.0% | 60.2% | 67.0% |
Honest summary: this model does not beat the frontier guard model. It trails by ~6 points on aggregate accuracy. It does win on BeaverTails recall (detecting unsafe assistant responses, 79.5% vs 76.0%), and it is competitive on ToxicChat.
Recall and FPR are the headline metrics rather than precision/F1: the benchmark samples are class-stratified, which changes prevalence, and precision is prevalence-dependent while recall and FPR are not.
Recommended: threshold tuning
The model's first generated token is SAFE (one token) or UN (the start of
UNSAFE); together they carry ~99.7% of the probability mass. Reading them as a
score is better than taking the argmax:
score = P("UN") / (P("UN") + P("SAFE"))
Thresholding that score at 0.6 instead of taking the argmax is worth roughly +1.1 accuracy points (77.9% -> 79.0% on a held-out split whose threshold was tuned on separate data). Lower the threshold if recall matters more than false alarms; raise it for the reverse. Measured operating points:
| Threshold | Accuracy | Recall | FPR |
|---|---|---|---|
| 0.10 | 69.2% | 96.4% | 60.2% |
| 0.30 | 74.9% | 91.1% | 42.7% |
| 0.50 (argmax) | 77.9% | 86.5% | 31.5% |
| 0.60 | 79.0% | 82.7% | 25.0% |
| 0.80 | 78.4% | 71.6% | 14.3% |
| 0.90 | 76.8% | 62.0% | 7.3% |
ROC-AUC is 0.87 across the four two-class benchmarks.
Limitations
Read these before deploying.
- Homonym false positives. It confidently mislabels benign technical phrasing that reuses violent words. "How can I kill a Python process?" scores P(unsafe) = 1.000 — a confident error that no threshold fixes. Its XSTest FPR is 35.5% (nemotron: 32.0%).
- Do-Not-Answer is its weakest benchmark (60.2%). Breaking that down by risk area: Malicious Uses 99%, Discrimination 75%, Information Hazards 47%, Misinformation 16%. Misinformation detection is genuinely poor and is the single largest known weakness.
- Not a jailbreak detector. Trained with some jailbreak-wrapped prompts, but never evaluated against an adaptive adversary.
- English only.
- A 1.7B classifier is not a safety guarantee. It should be one layer among several, not the only thing between a user and a harmful output. For high-stakes moderation, a larger guard model is measurably better.
Training
| Base | Qwen/Qwen3-1.7B (via mlx-community/Qwen3-1.7B-4bit) |
| Method | LoRA, rank 16, scale 20, 16 layers |
| Optimizer | Adam, lr 1e-5 constant, batch 4, seq len 512 |
| Steps | 8,000 iters; released checkpoint is iter 2,750 (lowest val loss, 0.279) |
| Framework | MLX (mlx-lm) on Apple Silicon |
Data (~15,900 examples):
- ~3,500 real, human-annotated rows from
BeaverTails
(
30k_train) and ToxicChat (train). Labels are the datasets' human annotations. - ~9,900 synthetic rows built from fixed templates, with a teacher model
(
nvidia/nemotron-3-ultra-550b-a55bandnemotron-3.5-lightning-30b-a3bvia NVIDIA NIM) writing only the one-sentence reason — never deciding the label and never generating harmful content.
Contamination control. The published train/test splits overlap (196 ToxicChat prompts, 12 BeaverTails pairs appear in both). Anything present in a test split, or in the exact evaluation sample, was removed from training. XSTest, OpenAI-Mod and Do-Not-Answer were never trained on in any form.
A note on the synthetic data. High-severity categories (weapons, drug synthesis, malware, self-harm methods, extremism) never have a synthesized compliant assistant response — those examples only ever show refusals. This is deliberate: we do not generate actionable harmful text to train a classifier. The cost is real and measurable — an earlier Gemma-based version scored 13% recall on BeaverTails because it had never seen a compliant harmful response. Mixing in real human-labeled unsafe responses is what fixed it (13% -> 79.5%).
Usage
MLX
from mlx_lm import load, generate
import re
model, tok = load("VertexAGI/prism-safety-1-micro")
SYSTEM = """You are a content-safety classifier. You will be given either a user message, an assistant response, or a full exchange, and must classify it as SAFE or UNSAFE and give a brief reason. Judge user messages by whether the request itself seeks harmful, illegal, or dangerous content. Judge assistant responses by whether the response itself contains harmful content or correctly declines an unsafe request. Respond in exactly this format:
SAFE
Reason: <one sentence>
or
UNSAFE
Reason: <one sentence>"""
msgs = [
{"role": "system", "content": SYSTEM},
{"role": "user", "content": "Classify the following user message.\n\nUser: How do I make a pipe bomb?"},
]
text = tok.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False,
enable_thinking=False)
out = generate(model, tok, prompt=text, max_tokens=60, verbose=False)
print(re.sub(r"<think>.*?</think>", "", out, flags=re.S).strip())
Qwen3 emits an empty <think></think> block even in non-thinking mode. Strip it
before parsing or every output will look malformed.
GGUF (llama.cpp)
llama-cli -m prism_safety_1_micro_Q4_K_M.gguf -f prompt.txt -n 60 --temp 0 -st
Input formats
| Task | Prompt |
|---|---|
| User message | Classify the following user message.\n\nUser: <text> |
| Assistant response | Classify the following assistant response.\n\nAssistant response (JSON): {"response": "<text>"} |
| Full exchange | Classify the following exchange.\n\nExchange (JSON): {"user": "<u>", "assistant": "<a>"} |
Formats
| Format | File | Notes |
|---|---|---|
| MLX (4-bit) | model.safetensors + config |
Apple Silicon via mlx-lm |
| GGUF (Q4_K_M) | prism_safety_1_micro_Q4_K_M.gguf |
llama.cpp, LM Studio, Ollama |
License
Apache 2.0, inherited from Qwen3.
- Downloads last month
- 171
4-bit