Instructions to use zrwang1211/SafeAtlas-Guard-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zrwang1211/SafeAtlas-Guard-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="zrwang1211/SafeAtlas-Guard-8B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("zrwang1211/SafeAtlas-Guard-8B") model = AutoModelForMultimodalLM.from_pretrained("zrwang1211/SafeAtlas-Guard-8B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use zrwang1211/SafeAtlas-Guard-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zrwang1211/SafeAtlas-Guard-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zrwang1211/SafeAtlas-Guard-8B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/zrwang1211/SafeAtlas-Guard-8B
- SGLang
How to use zrwang1211/SafeAtlas-Guard-8B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "zrwang1211/SafeAtlas-Guard-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zrwang1211/SafeAtlas-Guard-8B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "zrwang1211/SafeAtlas-Guard-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zrwang1211/SafeAtlas-Guard-8B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use zrwang1211/SafeAtlas-Guard-8B with Docker Model Runner:
docker model run hf.co/zrwang1211/SafeAtlas-Guard-8B
SafeAtlas Guard 8B
SafeAtlas Guard 8B is a target-conditioned multimodal safety model introduced in SafeAtlas-VL: Beyond Binary Multimodal Safety with Large-Scale Data and Guard Models. It evaluates image content, image-grounded user requests, and assistant responses.
The model returns:
- one of five ordered safety levels;
- a continuous risk score from 0 to 100;
- three auxiliary safety-judge predictions for request and response targets.
Resources
- Code: github.com/zrwang1211/SafeAtlas-VL
- Dataset: zrwang1211/SafeAtlas-VL
- Model collection: SafeAtlas Guard
Installation
git clone https://github.com/zrwang1211/SafeAtlas-VL.git
cd SafeAtlas-VL
pip install -e .
Quickstart
from ordinal_safety_vlm import SafetyPredictor
predictor = SafetyPredictor(
"zrwang1211/SafeAtlas-Guard-8B",
device_map="auto",
dtype="bfloat16",
)
result = predictor.predict(
image="examples/example.jpg",
target_name="response",
request="What fruit is shown in the image?",
response="The image shows a red apple.",
)
print(result.safety_label) # safe core
print(f"{result.risk_score:.2f}") # 13.76
print(result.teacher_predictions) # {'judge1': 'safe', 'judge2': 'safe', 'judge3': 'safe'}
The image may be a local path, pathlib.Path, or PIL.Image.Image.
Prediction fields
| Field | Description |
|---|---|
safety_label |
Predicted five-level safety label. |
risk_score |
Expected ordinal level mapped linearly to 0–100. |
z |
Scalar latent risk value before the learned thresholds. |
thresholds |
Four learned monotonic ordinal thresholds. |
ordinal_probs |
Cumulative probabilities of exceeding each ordinal threshold. |
class_probs |
Probability distribution over the five levels. |
category |
Predicted harm category or none. |
category_probs |
Probability distribution over 16 category labels. |
teacher_predictions |
Auxiliary teacher-head predictions. |
teacher_probs |
Auxiliary teacher-head probability distributions. |
The five ordered labels are safe core, safe leaning disputed, boundary uncertain, unsafe leaning disputed, and unsafe core. Teacher-head outputs
are defined for request and response targets.
Model architecture and training
SafeAtlas Guard 8B uses Qwen3-VL-8B-Instruct as its multimodal backbone.
Training has two stages. Stage 1 performs full-parameter multimodal instruction tuning so the backbone learns structured, target-conditioned safety judgments. Stage 2 freezes the instruction-tuned backbone and trains the five-level cumulative ordinal head, the 16-way harm-category head, and three teacher-simulation heads. The ordinal stage uses Gaussian-smoothed targets and learned monotonic thresholds.
The sharded model-*.safetensors files contain the instruction-tuned backbone.
ordinal_heads.safetensors contains the prediction heads and learned
thresholds. ordinal_config.json defines their architecture, labels, score
range, and prompt files.
The backbone tensors are stored in BF16. All prediction-head tensors, including the four trainable ordinal threshold parameters, are stored in FP32.
External benchmark results
F1 denotes unsafe-class F1 in percentage points.
| Benchmark | Target | Threshold | F1 |
|---|---|---|---|
| BeaverTails-V | Multimodal request | 15 | 88.15 |
| BeaverTails-V | Multimodal response | 25 | 79.52 |
| SPA-VL | Multimodal request | 30 | 80.99 |
| SPA-VL | Multimodal response | 25 | 76.64 |
| VLGuard | Multimodal request | 15 | 95.06 |
| HarmImageTest | Image | 25 | 68.90 |
| LLaVAGuard | Image | 20 | 72.28 |
| Multimodal average (7) | 80.22 | ||
| HarmBench Prompt | Text request | 15 | 94.60 |
| HarmBench Response | Text response | 35 | 85.86 |
| OpenAI Moderation | Text request | 65 | 75.72 |
| SafeRLHF | Text response | 20 | 72.14 |
| Overall average (11) | 80.90 |
Sensitive content and intended use
SafeAtlas Guard is intended for multimodal safety moderation, ordinal risk assessment, red-teaming, evaluation, and safety alignment research. Its training and evaluation data necessarily include unsafe, offensive, sensitive, and potentially disturbing material. The model and associated resources must not be used to facilitate harmful activity or to target individuals or protected groups.
Predictions are context- and policy-dependent. Performance can vary across languages, cultures, domains, image quality, and previously unseen harm types. The model should be evaluated in the intended deployment setting and should not be the sole basis for high-impact decisions.
Citation
Citation metadata will be added after the arXiv identifier is assigned.
- Downloads last month
- 5