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 files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031042 unmodified lines10710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713844 unmodified lines1831841851861871881891901911921931941951961971981992002012022032042052062072082092102113 unmodified lines2152162172182192202212222233 unmodified lines227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274<div style="font-family: 'Ubuntu', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background-color: #000000; color: #FFFFFF; padding: 32px; border-radius: 12px; max-width: 900px; margin: 0 auto; line-height: 1.65; border: 1px solid #2E2E2E;"><style>@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&family=Ubuntu+Mono:wght@400;700&display=swap');/* ---------- Header ---------- */.vg-header { padding-bottom: 18px; border-bottom: 1px solid #333333; margin-bottom: 22px; }.vg-title { font-size: 30px; font-weight: 700; color: #FFFFFF; margin: 0; letter-spacing: 0.5px; }/* ---------- Sections ---------- */.vg-h2 { display: flex; align-items: center; gap: 12px; color: #FFFFFF; font-size: 21px; font-weight: 700; margin: 36px 0 16px 0; }.vg-h2::after { content: ""; flex: 1; height: 1px; background: #333333; }.vg-num { font-family: 'Ubuntu Mono', 'Courier New', monospace; font-size: 12px; font-weight: 700; color: #FFFFFF; border: 1px solid #555555; background: #141414; padding: 2px 9px; border-radius: 3px; letter-spacing: 1px; }.vg-text { color: #FFFFFF; font-size: 15px; margin: 0 0 16px 0; }.vg-lead { color: #FFFFFF; font-size: 14px; margin: 0 0 12px 0; }/* ---------- Bullets (+ symbol) ---------- */.vg-bullet { list-style: none; padding: 0; margin: 0; }.vg-bullet li { position: relative; padding-left: 24px; margin-bottom: 11px; color: #FFFFFF; font-size: 14.5px; }.vg-bullet li::before { content: "+"; position: absolute; left: 0; top: 0; color: #FFFFFF; font-weight: 700; }/* ---------- Boxed Blockquote (plain, no highlight) ---------- */.vg-boxquote { border: 1px solid #FFFFFF; border-radius: 6px; padding: 18px 20px; margin: 24px 0; background: #000000; color: #FFFFFF; font-size: 14.5px; }/* ---------- Code Blocks with Header Bar + Copy ---------- */.vg-code-container { border: 1px solid #333333; border-radius: 6px; background: #0A0A0A; margin: 0 0 22px 0; overflow: hidden; }.vg-code-header { display: flex; justify-content: space-between; align-items: center; background: #161616; border-bottom: 1px solid #333333; padding: 8px 14px; }.vg-code-label { font-family: 'Ubuntu Mono', 'Courier New', monospace; font-size: 11px; color: #FFFFFF; letter-spacing: 2px; text-transform: uppercase; }.vg-copy-btn { background: #000000; color: #FFFFFF; border: 1px solid #555555; padding: 4px 14px; cursor: pointer; border-radius: 4px; font-family: 'Ubuntu', sans-serif; font-size: 12px; font-weight: 500; transition: background 0.2s, color 0.2s; }.vg-copy-btn:hover { background: #FFFFFF; color: #000000; }.vg-copy-btn.vg-copied { background: #FFFFFF; color: #000000; }.vg-code { margin: 0; padding: 16px 18px; overflow-x: auto; color: #FFFFFF; font-family: 'Ubuntu Mono', 'Courier New', monospace; font-size: 13.5px; line-height: 1.55; white-space: pre; }/* ---------- Table ---------- */.vg-table { width: 100%; border-collapse: collapse; font-size: 14px; }.vg-table th { background: #161616; color: #FFFFFF; border: 1px solid #3A3A3A; padding: 10px 14px; text-align: left; text-transform: uppercase; font-size: 11.5px; letter-spacing: 1px; }.vg-table td { border: 1px solid #3A3A3A; padding: 10px 14px; color: #FFFFFF; }.vg-table tr:nth-child(even) td { background: #0C0C0C; }.vg-table-wrap { margin: 0 0 8px 0; }/* ---------- Links (ONLY orange element) ---------- */.vg-link { color: #FF4500; text-decoration: none; font-weight: 700; }.vg-link:hover { text-decoration: underline; }</style><!-- ==================== HEADER ==================== --><div class="vg-header"><h1 class="vg-title">VisionGuardrail-4B</h1></div><p class="vg-text"><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.</p><div class="vg-boxquote">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><!-- ==================== 01 KEY HIGHLIGHTS ==================== --><h2 class="vg-h2"><span class="vg-num">01</span> Key Highlights</h2><ul class="vg-bullet"><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><!-- ==================== 02 STANDARD INSTRUCTION ==================== --><h2 class="vg-h2"><span class="vg-num">02</span> Standard Instruction</h2><p class="vg-lead">Pass this guardrail instruction to the model to enforce strict zero-tolerance classification with structured JSON output.</p><div class="vg-code-container"><div class="vg-code-header"><span class="vg-code-label">Prompt</span><button class="vg-copy-btn" onclick="copyCode(this)">Copy</button></div><pre class="vg-code"><code>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.2 unmodified linesOutput strictly valid JSON with no extra conversational text, commentary, or markdown formatting outside the JSON object:{"caption": "<Detailed, objective visual description of the subject, clothing, exposure, pose, and setting>","is_nsfw": true | false,"reason": "<Precise reason for classification based on clothing, exposure, pose, context, or other visual cues>","nsfw": 1 | 0,"safe": 1 | 0}</code></pre></div><!-- ==================== 03 QUICK START ==================== --><h2 class="vg-h2"><span class="vg-num">03</span> Quick Start with Transformers</h2><div class="vg-code-container"><div class="vg-code-header"><span class="vg-code-label">Terminal</span><button class="vg-copy-btn" onclick="copyCode(this)">Copy</button></div><pre class="vg-code"><code>pip install transformerspip install accelerate</code></pre></div><div class="vg-code-container"><div class="vg-code-header"><span class="vg-code-label">Python</span><button class="vg-copy-btn" onclick="copyCode(this)">Copy</button></div><pre class="vg-code"><code>from transformers import Qwen3_5ForConditionalGeneration, AutoProcessorimport torchmodel = Qwen3_5ForConditionalGeneration.from_pretrained(44 unmodified linesclean_up_tokenization_spaces=False)print(output_text[0])</code></pre></div><!-- ==================== 04 TRAINING DETAILS ==================== --><h2 class="vg-h2"><span class="vg-num">04</span> Training Details</h2><div class="vg-table-wrap"><table class="vg-table"><tr><th>Setting</th><th>Value</th></tr><tr><td><b>Base Model</b></td><td><b>Qwen/Qwen3.5-4B</b></td></tr><tr><td><b>Model</b></td><td><b>VisionGuardrail-4B</b></td></tr><tr><td><b>Model Type</b></td><td><b>Multimodal Content-Safety Classifier</b></td></tr><tr><td><b>Training Dataset</b></td><td><b>prithivMLmods/ImageShield-Guardrail-Pro</b></td></tr><tr><td><b>Training Objective</b></td><td><b>Content-safety guardrail classification</b></td></tr><tr><td><b>Primary Classification</b></td><td><b>Safe / Unsafe</b></td></tr><tr><td><b>Safety Focus</b></td><td><b>Not Safe for Work (NSFW) Sensual Content</b></td></tr><tr><td><b>Visual Analysis</b></td><td><b>Dress Codes, Poses, Exposure & Settings</b></td></tr><tr><td><b>Training Framework</b></td><td><b>TRL</b></td></tr></table></div><!-- ==================== 05 INTENDED USE ==================== --><h2 class="vg-h2"><span class="vg-num">05</span> Intended Use</h2><ul class="vg-bullet"><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><!-- ==================== 06 LIMITATIONS ==================== --><h2 class="vg-h2"><span class="vg-num">06</span> Limitations</h2><ul class="vg-bullet"><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><!-- ==================== 07 ACKNOWLEDGEMENTS ==================== --><h2 class="vg-h2"><span class="vg-num">07</span> Acknowledgements</h2><ul class="vg-bullet"><li><a href="https://huggingface.co/Qwen/Qwen3.5-4B" class="vg-link">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">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">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">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><script>function copyCode(btn) {const container = btn.closest('.vg-code-container');const codeBlock = container.querySelector('code');const text = codeBlock.innerText;const done = () => {btn.innerText = 'Copied ✓';btn.classList.add('vg-copied');setTimeout(() => {btn.innerText = 'Copy';btn.classList.remove('vg-copied');}, 2000);};if (navigator.clipboard && navigator.clipboard.writeText) {navigator.clipboard.writeText(text).then(done).catch(() => copyFallback(text, done));} else {copyFallback(text, done);}}function copyFallback(text, done) {const textArea = document.createElement('textarea');textArea.value = text;textArea.style.position = 'fixed';textArea.style.opacity = '0';document.body.appendChild(textArea);textArea.select();document.execCommand('copy');document.body.removeChild(textArea);done();}</script>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293942 unmodified lines97989910010110210310410510610710810911011111211311411511611711811912012144 unmodified lines1661671681691701711721731741751761771781791801811821831841851861871881891903 unmodified lines1941951961971981992002013 unmodified lines205206207208209210211212213214<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&display=swap" rel="stylesheet"><style>.vg-card { font-family: 'Ubuntu', sans-serif; background-color: #000000; color: #FFFFFF; padding: 30px; border-radius: 12px; max-width: 900px; margin: 0 auto; line-height: 1.6; }.vg-h1 { font-size: 32px; font-weight: 700; margin-bottom: 15px; color: #FFFFFF; }.vg-p { margin-bottom: 20px; font-size: 15px; color: #FFFFFF; }.vg-a { color: #FF4500; text-decoration: none; font-weight: 500; }.vg-a:hover { text-decoration: underline; }.vg-box { border: 1px solid #333; border-radius: 8px; padding: 20px; margin-bottom: 25px; font-style: italic; color: #ccc; font-size: 14px; }.vg-h2 { font-size: 22px; font-weight: 700; margin-top: 35px; margin-bottom: 15px; color: #FFFFFF; border-bottom: 1px solid #333; padding-bottom: 8px; }.vg-list { list-style-type: none; padding-left: 5px; }.vg-list li { margin-bottom: 10px; padding-left: 25px; position: relative; font-size: 15px; }.vg-list li::before { content: "+"; color: #FF4500; position: absolute; left: 0; font-weight: bold; font-size: 18px; top: -2px; }.vg-details { border: 1px solid #333; border-radius: 8px; margin-bottom: 25px; overflow: hidden; }.vg-summary { padding: 15px 20px; cursor: pointer; font-size: 18px; font-weight: 700; color: #FFFFFF; background-color: #0a0a0a; user-select: none; }.vg-summary:hover { background-color: #111; }.vg-code-container { position: relative; background: #0a0a0a; border: 1px solid #222; border-radius: 8px; margin-bottom: 25px; }.vg-copy-btn { position: absolute; top: 10px; right: 10px; background: #222; color: #fff; border: 1px solid #444; border-radius: 4px; padding: 5px 12px; cursor: pointer; font-family: 'Ubuntu', sans-serif; font-size: 12px; z-index: 10; transition: background 0.2s; }.vg-copy-btn:hover { background: #333; }.vg-code { padding: 15px; margin: 0; overflow-x: auto; color: #ddd; font-family: 'Courier New', Courier, monospace; font-size: 13px; white-space: pre; }.vg-table { width: 100%; border-collapse: collapse; margin-bottom: 25px; font-size: 14px; }.vg-table th, .vg-table td { border: 1px solid #333; padding: 12px 15px; text-align: left; }.vg-table th { background-color: #0a0a0a; color: #FF4500; font-weight: 700; width: 35%; }.vg-table td { color: #FFFFFF; }.vg-ack { margin-bottom: 15px; font-size: 15px; }</style><script>function copyCode(btn) {var codeBlock = btn.nextElementSibling;var textArea = document.createElement("textarea");textArea.value = codeBlock.innerText;document.body.appendChild(textArea);textArea.select();try {document.execCommand('copy');btn.innerText = "Copied!";} catch (err) {btn.innerText = "Error";}document.body.removeChild(textArea);setTimeout(function(){ btn.innerText = "Copy"; }, 2000);}</script><div class="vg-card"><h1 class="vg-h1">VisionGuardrail-4B</h1><p class="vg-p"><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-a">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 class="vg-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><h2 class="vg-h2">Key Highlights</h2><ul class="vg-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-details"><summary class="vg-summary">Standard Instruction</summary><div class="vg-code-container"><button class="vg-copy-btn" onclick="copyCode(this)">Copy</button><pre class="vg-code">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.2 unmodified linesOutput strictly valid JSON with no extra conversational text, commentary, or markdown formatting outside the JSON object:{"caption": "<Detailed, objective visual description of the subject, clothing, exposure, pose, and setting>","is_nsfw": true | false,"reason": "<Precise reason for classification based on clothing, exposure, pose, context, or other visual cues>","nsfw": 1 | 0,"safe": 1 | 0}</pre></div></details><h2 class="vg-h2">Quick Start with Transformers</h2><div class="vg-code-container"><button class="vg-copy-btn" onclick="copyCode(this)">Copy</button><pre class="vg-code">pip install transformerspip install accelerate</pre></div><div class="vg-code-container"><button class="vg-copy-btn" onclick="copyCode(this)">Copy</button><pre class="vg-code">from transformers import Qwen3_5ForConditionalGeneration, AutoProcessorimport torchmodel = Qwen3_5ForConditionalGeneration.from_pretrained(44 unmodified linesclean_up_tokenization_spaces=False)print(output_text[0])</pre></div><h2 class="vg-h2">Training Details</h2><table class="vg-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><h2 class="vg-h2">Intended Use</h2><ul class="vg-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><h2 class="vg-h2">Limitations</h2><ul class="vg-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><h2 class="vg-h2">Acknowledgements</h2><div class="vg-ack"><a href="https://huggingface.co/Qwen/Qwen3.5-4B" class="vg-a">Qwen/Qwen3.5-4B</a>: Base multimodal model used for this project.</div><div class="vg-ack"><a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" class="vg-a">ImageShield-Guardrail-Pro</a>: Content-safety guardrail dataset used for training VisionGuardrail-4B.</div><div class="vg-ack"><a href="https://huggingface.co/docs/trl/en/index" class="vg-a">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"><a href="https://huggingface.co/docs/transformers/en/index" class="vg-a">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>
README.md+98-158