Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
text-generation-inference
VisionGuardrail
JSON
image-classification
content-safety
content-moderation
multimodal
safety-classifier
guardrail
visual-safety
multimodal-content-filter
mmcf
v1.0
conversational
Run this model with HF Jobs
Run prithivMLmods/VisionGuardrail-4B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/prithivMLmods/VisionGuardrail-4B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/prithivMLmods/VisionGuardrail-4B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/prithivMLmods/VisionGuardrail-4B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/prithivMLmods/VisionGuardrail-4B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use prithivMLmods/VisionGuardrail-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/VisionGuardrail-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/VisionGuardrail-4B") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("prithivMLmods/VisionGuardrail-4B") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/VisionGuardrail-4B", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use prithivMLmods/VisionGuardrail-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/VisionGuardrail-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/VisionGuardrail-4B", "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/prithivMLmods/VisionGuardrail-4B
- SGLang
How to use prithivMLmods/VisionGuardrail-4B 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 "prithivMLmods/VisionGuardrail-4B" \ --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": "prithivMLmods/VisionGuardrail-4B", "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 "prithivMLmods/VisionGuardrail-4B" \ --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": "prithivMLmods/VisionGuardrail-4B", "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 prithivMLmods/VisionGuardrail-4B with Docker Model Runner:
docker model run hf.co/prithivMLmods/VisionGuardrail-4B
Update README.md
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691703 unmodified lines1741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702718 unmodified lines28028128228328428528628728828929029129229329429529629729829930030145 unmodified lines3473483493503513523533543553563573583593603613623633643653663673683693703713723733743 unmodified lines3783793803813823833843853 unmodified lines389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444<link href="https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,400;0,500;0,700;1,400&family=Ubuntu+Mono&display=swap" rel="stylesheet"><style>.vg-container {font-family: 'Ubuntu', sans-serif;background-color: #000000;color: #FFFFFF;max-width: 920px;margin: 0 auto;padding: 32px 24px;line-height: 1.65;}.vg-header {border-bottom: 2px solid #222222;padding-bottom: 16px;margin-bottom: 24px;}.vg-title {font-size: 32px;font-weight: 700;color: #FFFFFF;margin: 0 0 12px 0;letter-spacing: -0.5px;}.vg-description {font-size: 15px;color: #FFFFFF;margin: 0;}.vg-link {color: #FF4500;text-decoration: none;font-weight: 500;transition: opacity 0.2s ease;}.vg-link:hover {text-decoration: underline;opacity: 0.85;}.vg-notice-panel {background-color: #000000;border: 1px solid #333333;border-radius: 8px;padding: 16px 20px;margin: 24px 0;font-size: 14px;color: #FFFFFF;}.vg-section-title {font-size: 20px;font-weight: 700;color: #FFFFFF;margin: 36px 0 16px 0;text-transform: uppercase;letter-spacing: 0.5px;display: flex;align-items: center;}.vg-section-title::after {content: "";flex: 1;height: 1px;background-color: #222222;margin-left: 16px;}.vg-plus-list {list-style: none;padding-left: 0;margin: 0 0 24px 0;}.vg-plus-list li {position: relative;padding-left: 24px;margin-bottom: 12px;font-size: 15px;color: #FFFFFF;}.vg-plus-list li::before {content: "+";color: #FF4500;position: absolute;left: 0;font-weight: 700;font-size: 18px;line-height: 1.2;}.vg-dropdown {border: 1px solid #333333;border-radius: 8px;margin-bottom: 24px;background-color: #000000;}.vg-dropdown-summary {padding: 14px 18px;font-size: 15px;font-weight: 700;cursor: pointer;color: #FFFFFF;outline: none;user-select: none;display: flex;justify-content: space-between;align-items: center;}.vg-dropdown-summary::-webkit-details-marker {display: none;}.vg-dropdown-summary::after {content: "+";color: #FF4500;font-size: 18px;font-weight: 700;}.vg-dropdown[open] .vg-dropdown-summary::after {content: "−";}.vg-code-wrapper {position: relative;border: 1px solid #222222;border-radius: 8px;background-color: #000000;margin-bottom: 20px;overflow: hidden;}.vg-code-label {padding: 8px 16px;background-color: #080808;border-bottom: 1px solid #222222;font-family: 'Ubuntu Mono', monospace;font-size: 12px;color: #FFFFFF;}.vg-copy-btn {position: absolute;top: 6px;right: 8px;background-color: #000000;color: #FFFFFF;border: 1px solid #333333;border-radius: 4px;padding: 4px 10px;font-family: 'Ubuntu', sans-serif;font-size: 11px;cursor: pointer;transition: border-color 0.2s ease;}.vg-copy-btn:hover {border-color: #555555;}3 unmodified linesoverflow-x: auto;font-family: 'Ubuntu Mono', monospace;font-size: 13.5px;color: #FFFFFF;line-height: 1.5;background-color: #000000;}.vg-table-container {border: 1px solid #222222;border-radius: 8px;overflow: hidden;margin-bottom: 28px;}.vg-spec-table {width: 100%;border-collapse: collapse;font-size: 14px;background-color: #000000;text-align: left;}.vg-spec-table th,.vg-spec-table td {padding: 12px 18px;border-bottom: 1px solid #222222;color: #FFFFFF;}.vg-spec-table tr:last-child th,.vg-spec-table tr:last-child td {border-bottom: none;}.vg-spec-table th {width: 35%;font-weight: 700;background-color: #050505;}.vg-ack-container {margin-bottom: 16px;}</style><div class="vg-container"><div class="vg-header"><h1 class="vg-title">VisionGuardrail-4B</h1><p class="vg-description"><b>VisionGuardrail-4B</b> is a multimodal content-safety classifier based on <b>Qwen/Qwen3.5-4B</b> and trained on the <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link" target="_blank" rel="noopener noreferrer">prithivMLmods/ImageShield-Guardrail-Pro</a> content-safety guardrail dataset. The model is designed to classify visual content as <b>Safe</b> or <b>Unsafe</b>, with a particular focus on detecting <b>Not Safe for Work (NSFW) sensual content</b> and other potentially sensitive visual content. VisionGuardrail-4B excels at detecting <b>explicit and sensitive visual content</b>, with detailed analysis of <b>dress codes, clothing exposure, poses, framing, and different visual settings</b> to support conservative content-safety classification.</p></div><div class="vg-notice-panel">This model is an experimental release and may generate unexpected behaviors or reasoning artifacts in certain scenarios. <b>This model is intended for research and content-safety classification only.</b> Any outputs generated by this model are the sole responsibility of the user. The authors and hosting platform disclaim all liability for generated content. Users must ensure safe, ethical, and lawful usage.</div><div class="vg-section-title">Key Highlights</div><ul class="vg-plus-list"><li><b>Qwen 3.5 Foundation</b>: Built on <b>Qwen/Qwen3.5-4B</b>.</li><li><b>Multimodal Content Filter</b>: Designed for visual content-safety classification.</li><li><b>ImageShield-Guardrail-Pro Training</b>: Fine-tuned on the <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link" target="_blank" rel="noopener noreferrer">prithivMLmods/ImageShield-Guardrail-Pro</a> content-safety guardrail dataset.</li><li><b>Safe / Unsafe Classification</b>: Classifies visual content as either <b>Safe</b> or <b>Unsafe</b>.</li><li><b>NSFW Sensual Content Detection</b>: Focused on identifying potentially <b>Not Safe for Work (NSFW) sensual content</b> and related sensitive visual material.</li><li><b>Explicit & Sensitive Content Detection</b>: Excels at identifying explicit, revealing, provocative, and otherwise potentially sensitive visual content.</li><li><b>Dress-Code Analysis</b>: Performs detailed analysis of clothing, dress codes, exposure, and revealing garments.</li><li><b>Pose Analysis</b>: Analyzes body poses, positioning, framing, and potentially suggestive presentation.</li><li><b>Context & Setting Analysis</b>: Considers different visual settings and contextual cues when determining content safety.</li><li><b>Zero-Tolerance Safety Classification</b>: Uses a conservative classification policy that favors safety when the content is ambiguous.</li><li><b>Structured Output</b>: Produces a machine-readable JSON response containing a caption, classification, and reasoning.</li></ul><div class="vg-section-title">Standard Instruction</div><details class="vg-dropdown"><summary class="vg-dropdown-summary">View Guardrail Zero-Tolerance System Prompt</summary><div class="vg-code-wrapper" style="border: none; border-top: 1px solid #222222; border-radius: 0; margin-bottom: 0;"><button class="vg-copy-btn" onclick="vgCopyCode(this)">Copy</button><pre class="vg-code-block">You are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.STRICT ZERO-TOLERANCE CLASSIFICATION RULES:1. Nudity & Exposure: Any full or partial nudity, exposed breasts, cleavage, buttocks, groin, or visible pubic area MUST be classified as NSFW.2. Underwear & Swimwear: Thongs, G-strings, micro-bikinis, skimpy or revealing swimwear, bras, panties, lingerie, see-through clothing, or unbuttoned tops revealing undergarments or bare torsos MUST be classified as NSFW.3. Dress-Code Analysis: Carefully analyze clothing, coverage, transparency, exposure, and the overall dress code. Revealing or sexually provocative clothing MUST be classified as NSFW.4. Poses & Suggestiveness: Sexually suggestive poses, seductive modeling, cleavage-emphasizing framing, fetish content, or explicit erotic themes MUST be classified as NSFW.5. Context & Setting: Consider the visual setting, composition, framing, and contextual cues when evaluating potentially sensitive content.6. Artwork & Animation: Anime nudes, ecchi, hentai, suggestive illustrations, or 2D/3D stylized erotica MUST be classified as NSFW.7. Sensitive Visual Content: Explicit or highly suggestive visual content MUST be classified as NSFW even when presented in non-photorealistic or artistic formats.8 unmodified lines"nsfw": 1 | 0,"safe": 1 | 0}</pre></div></details><div class="vg-section-title">Quick Start with Transformers</div><div class="vg-code-wrapper"><div class="vg-code-label">bash</div><button class="vg-copy-btn" onclick="vgCopyCode(this)">Copy</button><pre class="vg-code-block">pip install transformerspip install accelerate</pre></div><div class="vg-code-wrapper"><div class="vg-code-label">python</div><button class="vg-copy-btn" onclick="vgCopyCode(this)">Copy</button><pre class="vg-code-block">from transformers import Qwen3_5ForConditionalGeneration, AutoProcessorimport torchmodel = Qwen3_5ForConditionalGeneration.from_pretrained(45 unmodified lines)print(output_text[0])</pre></div><div class="vg-section-title">Training Details</div><div class="vg-table-container"><table class="vg-spec-table"><tbody><tr><th>Setting</th><td>Value</td></tr><tr><th>Base Model</th><td>Qwen/Qwen3.5-4B</td></tr><tr><th>Model</th><td>VisionGuardrail-4B</td></tr><tr><th>Model Type</th><td>Multimodal Content-Safety Classifier</td></tr><tr><th>Training Dataset</th><td><a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link" target="_blank" rel="noopener noreferrer">prithivMLmods/ImageShield-Guardrail-Pro</a></td></tr><tr><th>Training Objective</th><td>Content-safety guardrail classification</td></tr><tr><th>Primary Classification</th><td>Safe / Unsafe</td></tr><tr><th>Safety Focus</th><td>Not Safe for Work (NSFW) Sensual Content</td></tr><tr><th>Visual Analysis</th><td>Dress Codes, Poses, Exposure & Settings</td></tr><tr><th>Training Framework</th><td>TRL</td></tr></tbody></table></div><div class="vg-section-title">Intended Use</div><ul class="vg-plus-list"><li><b>Content Safety Classification</b>: Classifying visual media as safe or unsafe.</li><li><b>NSFW Sensual Content Detection</b>: Supporting research into automated detection of potentially sensitive and sexually suggestive visual content.</li><li><b>Parental Controls</b>: Building conservative visual content-safety filtering systems.</li>3 unmodified lines<li><b>Visual Safety Analysis</b>: Analyzing clothing, dress codes, poses, framing, and visual settings for content-safety signals.</li></ul><div class="vg-section-title">Limitations</div><ul class="vg-plus-list"><li><b>Experimental Model</b>: The model may produce incorrect or inconsistent classifications.</li><li><b>False Positives</b>: Benign content may occasionally be classified as unsafe due to the conservative classification threshold.</li><li><b>False Negatives</b>: Unsafe content may occasionally be missed.</li>3 unmodified lines<li><b>Automated Classification</b>: The model should not be treated as a definitive legal or safety determination.</li></ul><div class="vg-section-title">Acknowledgements</div><div class="vg-ack-container"><ul class="vg-plus-list"><li><a href="https://huggingface.co/Qwen/Qwen3.5-4B" class="vg-link" target="_blank" rel="noopener noreferrer">Qwen/Qwen3.5-4B</a>: Base multimodal model used for this project.</li><li><a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link" target="_blank" rel="noopener noreferrer">ImageShield-Guardrail-Pro</a>: Content-safety guardrail dataset used for training VisionGuardrail-4B.</li><li><b>TRL</b> – <a href="https://huggingface.co/docs/trl/en/index" class="vg-link" target="_blank" rel="noopener noreferrer">Transformers Reinforcement Learning</a>: TRL is a full-stack library providing tools to train transformer language models with methods including Supervised Fine-Tuning (SFT), Group Relative Policy Optimization (GRPO), Direct Preference Optimization (DPO), Reward Modeling, and more.</li><li><a href="https://huggingface.co/docs/transformers/en/index" class="vg-link" target="_blank" rel="noopener noreferrer">Transformers</a>: Transformers provides state-of-the-art machine learning models for text, computer vision, audio, video, and multimodal tasks, supporting both inference and training.</li></ul></div></div><script>function vgCopyCode(btn) {var wrapper = btn.closest('.vg-code-wrapper');var codeElement = wrapper.querySelector('.vg-code-block');var textToCopy = codeElement.innerText;if (navigator.clipboard && window.isSecureContext) {navigator.clipboard.writeText(textToCopy).then(function() {showSuccess(btn);}).catch(function() {fallbackCopy(textToCopy, btn);});} else {fallbackCopy(textToCopy, btn);}}function fallbackCopy(text, btn) {var textArea = document.createElement("textarea");textArea.value = text;textArea.style.position = "fixed";textArea.style.left = "-999999px";textArea.style.top = "-999999px";document.body.appendChild(textArea);textArea.focus();textArea.select();try {document.execCommand('copy');showSuccess(btn);} catch (err) {btn.innerText = "Error";}document.body.removeChild(textArea);}function showSuccess(btn) {btn.innerText = "Copied!";setTimeout(function() {btn.innerText = "Copy";}, 2000);}</script>1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851863 unmodified lines1901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922938 unmodified lines30230330430530630730830931031131231331431531631731831932032132232332432532632732832945 unmodified lines3753763773783793803813823833843853863873883893903913923933943953963973983994003 unmodified lines4044054064074084094104113 unmodified lines415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466<link href="https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,400&family=Ubuntu+Mono:wght@400;700&display=swap" rel="stylesheet"><style>.vg-wrap {font-family: 'Ubuntu', sans-serif;background-color: #000000;color: #FFFFFF;max-width: 920px;margin: 0 auto;padding: 36px 30px;border: 1px solid #1a1a1a;border-radius: 14px;line-height: 1.65;box-sizing: border-box;}.vg-title {font-size: 34px;font-weight: 700;letter-spacing: -0.5px;margin: 0 0 18px 0;color: #FFFFFF;}.vg-lead {font-size: 15.5px;color: #FFFFFF;margin-bottom: 24px;}.vg-link {color: #FF4500;text-decoration: none;font-weight: 500;}.vg-link:hover {text-decoration: underline;}/* Blockquote as structured isolated box */.vg-notice-box {background: #000000;border: 1px solid #292929;border-left: 4px solid #444444;border-radius: 6px;padding: 16px 20px;margin: 24px 0 32px 0;font-size: 14px;color: #FFFFFF;}.vg-section-head {font-size: 21px;font-weight: 700;color: #FFFFFF;margin: 36px 0 16px 0;display: flex;align-items: center;gap: 8px;}/* Plus-style list formatting */.vg-bullet-list {list-style: none;padding: 0;margin: 0 0 24px 0;}.vg-bullet-list li {position: relative;padding-left: 22px;margin-bottom: 12px;font-size: 14.5px;color: #FFFFFF;}.vg-bullet-list li::before {content: "+";position: absolute;left: 0;top: 0;color: #FFFFFF;font-weight: 700;font-size: 16px;line-height: 1.4;}/* Expandable / Dropdown sections */.vg-accordion {border: 1px solid #222222;border-radius: 8px;margin-bottom: 22px;background-color: #000000;overflow: hidden;}.vg-accordion-summary {list-style: none;padding: 16px 20px;font-size: 16px;font-weight: 700;color: #FFFFFF;cursor: pointer;display: flex;justify-content: space-between;align-items: center;user-select: none;background: #080808;border-bottom: 1px solid transparent;transition: background 0.2s;}.vg-accordion-summary::-webkit-details-marker {display: none;}.vg-accordion-summary:hover {background: #111111;}.vg-accordion[open] .vg-accordion-summary {border-bottom: 1px solid #222222;}.vg-accordion-summary::after {content: "+";font-size: 18px;font-weight: 700;color: #FFFFFF;transition: transform 0.2s ease;}.vg-accordion[open] .vg-accordion-summary::after {content: "−";}.vg-accordion-content {padding: 18px;background: #000000;}/* Code block shells & actions */.vg-code-wrapper {position: relative;background: #000000;border: 1px solid #242424;border-radius: 8px;margin-bottom: 20px;overflow: hidden;}.vg-code-topbar {display: flex;justify-content: space-between;align-items: center;background: #090909;padding: 8px 14px;border-bottom: 1px solid #1c1c1c;}.vg-code-label {font-size: 12px;font-family: 'Ubuntu Mono', monospace;text-transform: uppercase;letter-spacing: 0.8px;color: #FFFFFF;}.vg-copy-trigger {background: #181818;color: #FFFFFF;border: 1px solid #333333;border-radius: 4px;padding: 4px 10px;font-family: 'Ubuntu', sans-serif;font-size: 12px;cursor: pointer;transition: background 0.2s, border-color 0.2s;}.vg-copy-trigger:hover {background: #252525;border-color: #555555;}3 unmodified linesoverflow-x: auto;font-family: 'Ubuntu Mono', monospace;font-size: 13.5px;line-height: 1.55;color: #FFFFFF;white-space: pre;background: #000000;}/* Table styling */.vg-specs-table {width: 100%;border-collapse: collapse;margin: 10px 0 28px 0;font-size: 14px;}.vg-specs-table th,.vg-specs-table td {border: 1px solid #222222;padding: 12px 16px;text-align: left;color: #FFFFFF;}.vg-specs-table th {background-color: #080808;width: 32%;font-weight: 700;}.vg-specs-table td {background-color: #000000;}.vg-ack-entry {font-size: 14.5px;margin-bottom: 14px;color: #FFFFFF;line-height: 1.5;}.vg-divider {border: 0;height: 1px;background: #222222;margin: 32px 0;}</style><div class="vg-wrap"><div class="vg-title">VisionGuardrail-4B</div><div class="vg-lead"><b>VisionGuardrail-4B</b> is a multimodal content-safety classifier based on <b>Qwen/Qwen3.5-4B</b> and trained on the <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link">prithivMLmods/ImageShield-Guardrail-Pro</a> content-safety guardrail dataset. The model is designed to classify visual content as <b>Safe</b> or <b>Unsafe</b>, with a particular focus on detecting <b>Not Safe for Work (NSFW) sensual content</b> and other potentially sensitive visual content. VisionGuardrail-4B excels at detecting <b>explicit and sensitive visual content</b>, with detailed analysis of <b>dress codes, clothing exposure, poses, framing, and different visual settings</b> to support conservative content-safety classification.</div><div class="vg-notice-box">This model is an experimental release and may generate unexpected behaviors or reasoning artifacts in certain scenarios. <b>This model is intended for research and content-safety classification only.</b> Any outputs generated by this model are the sole responsibility of the user. The authors and hosting platform disclaim all liability for generated content. Users must ensure safe, ethical, and lawful usage.</div><div class="vg-section-head">Key Highlights</div><ul class="vg-bullet-list"><li><b>Qwen 3.5 Foundation</b>: Built on <b>Qwen/Qwen3.5-4B</b>.</li><li><b>Multimodal Content Filter</b>: Designed for visual content-safety classification.</li><li><b>ImageShield-Guardrail-Pro Training</b>: Fine-tuned on the <b>prithivMLmods/ImageShield-Guardrail-Pro</b> content-safety guardrail dataset.</li><li><b>Safe / Unsafe Classification</b>: Classifies visual content as either <b>Safe</b> or <b>Unsafe</b>.</li><li><b>NSFW Sensual Content Detection</b>: Focused on identifying potentially <b>Not Safe for Work (NSFW) sensual content</b> and related sensitive visual material.</li><li><b>Explicit & Sensitive Content Detection</b>: Excels at identifying explicit, revealing, provocative, and otherwise potentially sensitive visual content.</li><li><b>Dress-Code Analysis</b>: Performs detailed analysis of clothing, dress codes, exposure, and revealing garments.</li><li><b>Pose Analysis</b>: Analyzes body poses, positioning, framing, and potentially suggestive presentation.</li><li><b>Context & Setting Analysis</b>: Considers different visual settings and contextual cues when determining content safety.</li><li><b>Zero-Tolerance Safety Classification</b>: Uses a conservative classification policy that favors safety when the content is ambiguous.</li><li><b>Structured Output</b>: Produces a machine-readable JSON response containing a caption, classification, and reasoning.</li></ul><details class="vg-accordion"><summary class="vg-accordion-summary">Standard Instruction</summary><div class="vg-accordion-content"><div class="vg-code-wrapper"><div class="vg-code-topbar"><span class="vg-code-label">System Prompt & Schema</span><button class="vg-copy-trigger" onclick="handleCopy(this)">Copy</button></div><pre class="vg-code-block">You are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.STRICT ZERO-TOLERANCE CLASSIFICATION RULES:1. Nudity & Exposure: Any full or partial nudity, exposed breasts, cleavage, buttocks, groin, or visible pubic area MUST be classified as NSFW.2. Underwear & Swimwear: Thongs, G-strings, micro-bikinis, skimpy or revealing swimwear, bras, panties, lingerie, see-through clothing, or unbuttoned tops revealing undergarments or bare torsos MUST be classified as NSFW.3. Dress-Code Analysis: Carefully analyze clothing, coverage, transparency, exposure, and the overall dress code. Revealing or sexually provocative clothing MUST be classified as NSFW.4. Poses & Suggestiveness: Sexually suggestive poses, seductive modeling, cleavage-emphasizing framing, fetish content, or explicit erotic themes MUST be classified as NSFW.5. Context & Setting: Consider the visual setting, composition, framing, and contextual cues when evaluating potentially sensitive content.6. Artwork & Animation: Anime nudes, ecchi, hentai, suggestive illustrations, or 2D/3D stylized erotica MUST be classified as NSFW.7. Sensitive Visual Content: Explicit or highly suggestive visual content MUST be classified as NSFW even when presented in non-photorealistic or artistic formats.8 unmodified lines"nsfw": 1 | 0,"safe": 1 | 0}</pre></div></div></details><details class="vg-accordion"><summary class="vg-accordion-summary">Quick Start with Transformers</summary><div class="vg-accordion-content"><div class="vg-code-wrapper"><div class="vg-code-topbar"><span class="vg-code-label">Bash Installation</span><button class="vg-copy-trigger" onclick="handleCopy(this)">Copy</button></div><pre class="vg-code-block">pip install transformerspip install accelerate</pre></div><div class="vg-code-wrapper"><div class="vg-code-topbar"><span class="vg-code-label">Python Inference</span><button class="vg-copy-trigger" onclick="handleCopy(this)">Copy</button></div><pre class="vg-code-block">from transformers import Qwen3_5ForConditionalGeneration, AutoProcessorimport torchmodel = Qwen3_5ForConditionalGeneration.from_pretrained(45 unmodified lines)print(output_text[0])</pre></div></div></details><div class="vg-section-head">Training Details</div><table class="vg-specs-table"><tr><th>Setting</th><td>Value</td></tr><tr><th>Base Model</th><td>Qwen/Qwen3.5-4B</td></tr><tr><th>Model</th><td>VisionGuardrail-4B</td></tr><tr><th>Model Type</th><td>Multimodal Content-Safety Classifier</td></tr><tr><th>Training Dataset</th><td>prithivMLmods/ImageShield-Guardrail-Pro</td></tr><tr><th>Training Objective</th><td>Content-safety guardrail classification</td></tr><tr><th>Primary Classification</th><td>Safe / Unsafe</td></tr><tr><th>Safety Focus</th><td>Not Safe for Work (NSFW) Sensual Content</td></tr><tr><th>Visual Analysis</th><td>Dress Codes, Poses, Exposure & Settings</td></tr><tr><th>Training Framework</th><td>TRL</td></tr></table><div class="vg-section-head">Intended Use</div><ul class="vg-bullet-list"><li><b>Content Safety Classification</b>: Classifying visual media as safe or unsafe.</li><li><b>NSFW Sensual Content Detection</b>: Supporting research into automated detection of potentially sensitive and sexually suggestive visual content.</li><li><b>Parental Controls</b>: Building conservative visual content-safety filtering systems.</li>3 unmodified lines<li><b>Visual Safety Analysis</b>: Analyzing clothing, dress codes, poses, framing, and visual settings for content-safety signals.</li></ul><div class="vg-section-head">Limitations</div><ul class="vg-bullet-list"><li><b>Experimental Model</b>: The model may produce incorrect or inconsistent classifications.</li><li><b>False Positives</b>: Benign content may occasionally be classified as unsafe due to the conservative classification threshold.</li><li><b>False Negatives</b>: Unsafe content may occasionally be missed.</li>3 unmodified lines<li><b>Automated Classification</b>: The model should not be treated as a definitive legal or safety determination.</li></ul><hr class="vg-divider"><div class="vg-section-head">Acknowledgements</div><div class="vg-ack-entry"><a href="https://huggingface.co/Qwen/Qwen3.5-4B" class="vg-link">Qwen/Qwen3.5-4B</a>: Base multimodal model used for this project.</div><div class="vg-ack-entry"><a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-link">ImageShield-Guardrail-Pro</a>: Content-safety guardrail dataset used for training VisionGuardrail-4B.</div><div class="vg-ack-entry"><a href="https://huggingface.co/docs/trl/en/index" class="vg-link">TRL</a> – Transformers Reinforcement Learning: TRL is a full-stack library providing tools to train transformer language models with methods including Supervised Fine-Tuning (SFT), Group Relative Policy Optimization (GRPO), Direct Preference Optimization (DPO), Reward Modeling, and more.</div><div class="vg-ack-entry"><a href="https://huggingface.co/docs/transformers/en/index" class="vg-link">Transformers</a>: Transformers provides state-of-the-art machine learning models for text, computer vision, audio, video, and multimodal tasks, supporting both inference and training.</div></div><script>function handleCopy(button) {const codeBlock = button.closest('.vg-code-wrapper').querySelector('.vg-code-block');if (!codeBlock) return;const textToCopy = codeBlock.innerText;if (navigator.clipboard && window.isSecureContext) {navigator.clipboard.writeText(textToCopy).then(() => setSuccessState(button)).catch(() => fallbackCopy(textToCopy, button));} else {fallbackCopy(textToCopy, button);}}function fallbackCopy(text, button) {const textArea = document.createElement("textarea");textArea.value = text;textArea.style.position = "fixed";textArea.style.opacity = "0";document.body.appendChild(textArea);textArea.focus();textArea.select();try {document.execCommand('copy');setSuccessState(button);} catch (err) {button.innerText = "Failed";setTimeout(() => { button.innerText = "Copy"; }, 2000);}document.body.removeChild(textArea);}function setSuccessState(button) {const originalText = button.innerText;button.innerText = "Copied!";setTimeout(() => {button.innerText = originalText;}, 2000);}</script>
README.md+205-183