VisionGuardrail-9B-fp8

VisionGuardrail-9B-fp8 is an FP8 dynamic quantized version of prithivMLmods/VisionGuardrail-9B, a multimodal content-safety classifier based on Qwen/Qwen3.5-9B.

The model is trained on the ImageShield-Guardrail-Pro content-safety guardrail dataset and is designed to classify visual content as Safe or Unsafe, with a particular focus on detecting Not Safe for Work (NSFW) sensual content and other potentially sensitive visual content.

The FP8 dynamic quantization reduces the model's memory footprint while retaining the multimodal vision and classification capabilities of the original BF16 model, making deployment more accessible on GPUs with FP8 support.

hf.co/blog — vision-guardrail-mini-blog

This model is an experimental release and may generate unexpected behaviors or reasoning artifacts in certain scenarios.

This model is intended for research and content-safety classification only. 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.

Quantization Details

Quantization was performed using llmcompressor with the following recipe:

default_stage:
  default_modifiers:
    QuantizationModifier:
      targets: [Linear]
      ignore: ['re:.*lm_head', 're:.*embed_tokens$', 're:.*visual.*', 're:.*model.visual.*',
        're:.*linear_attn.*']
      scheme: FP8_DYNAMIC
      bypass_divisibility_checks: false
      requires_calibration_data: false

Linear layers are quantized to FP8 using dynamic per-tensor activation scaling. The lm_head, embedding table, vision components (visual), and linear_attn layers are excluded from quantization and remain at full precision.

This approach reduces the overall model size and memory requirements while preserving the vision-language representation and content-safety classification capabilities of the base model.

Base model prithivMLmods/VisionGuardrail-9B
Underlying model Qwen/Qwen3.5-9B
Quantization scheme FP8_DYNAMIC (Linear layers only)
Format compressed-tensors
Calibration required No
Excluded from quantization lm_head, embed_tokens, visual, linear_attn

Model Details

Developer prithivMLmods
Quantized by prithivMLmods
Architecture Multimodal decoder-only language model
Parameters 9B
Base model Qwen/Qwen3.5-9B
Training dataset ImageShield-Guardrail-Pro
Task Multimodal content-safety classification
Input Image + text prompt
Output Safe / Unsafe classification with reasoning
Quantization FP8 Dynamic
Format compressed-tensors

Intended Use

VisionGuardrail-9B-FP8 is intended for multimodal content-safety research and visual content classification.

The model can be used to analyze images for potentially sensitive or unsafe visual content, including:

  • NSFW sensual content
  • Explicit visual content
  • Clothing exposure
  • Dress-code related visual cues
  • Poses and body positioning
  • Framing and visual composition
  • Potentially sensitive visual settings
  • Other content requiring conservative safety classification

The model is designed to provide a Safe or Unsafe classification based on the visual content and accompanying prompt.

Usage with Transformers

The FP8 checkpoint can be loaded using the Transformers ecosystem with support for compressed-tensors quantization.

from transformers import AutoProcessor, AutoModelForImageTextToText
from PIL import Image

model_id = "prithivMLmods/VisionGuardrail-9B-fp8"

processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(
    model_id,
    device_map="auto",
)

image = Image.open("image.jpg")

messages = [
    {
        "role": "user",
        "content": [
            {"type": "image"},
            {
                "type": "text",
                "text": "Classify this image as Safe or Unsafe and explain the safety classification.",
            },
        ],
    }
]

text = processor.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)

inputs = processor(
    text=text,
    images=image,
    return_tensors="pt",
).to(model.device)

outputs = model.generate(
    **inputs,
    max_new_tokens=512,
)

response = processor.batch_decode(
    outputs,
    skip_special_tokens=True,
)[0]

print(response)

Note: Refer to the base VisionGuardrail-9B model card for the recommended prompt format and inference behavior.

Prompt Format

A simple classification prompt can be used:

Analyze the provided image for content safety.

Classify the image as either:
- Safe
- Unsafe

Provide a concise explanation for the classification.

For production applications, it is recommended to define a strict output schema and validate the generated response before consuming the classification programmatically.

Hardware Requirements

FP8 inference is recommended on GPUs with native FP8 support, such as NVIDIA Hopper and Blackwell architectures.

The quantized model can also be used on other supported GPUs where FP8 weights are dequantized during execution, although performance and memory characteristics may differ.

For best performance:

  • Use a recent PyTorch release with FP8 support.
  • Use a recent Transformers release with compressed-tensors support.
  • Prefer NVIDIA Hopper or Blackwell GPUs for native FP8 execution.
  • Use bfloat16 for non-quantized components where supported.

Quantization Recipe

The complete quantization configuration is:

default_stage:
  default_modifiers:
    QuantizationModifier:
      targets: [Linear]
      ignore:
        - 're:.*lm_head'
        - 're:.*embed_tokens$'
        - 're:.*visual.*'
        - 're:.*model.visual.*'
        - 're:.*linear_attn.*'
      scheme: FP8_DYNAMIC
      bypass_divisibility_checks: false
      requires_calibration_data: false

Quantization Strategy

  • Linear layers: FP8 Dynamic
  • Activation scaling: Dynamic
  • Calibration dataset: Not required
  • Language-model head: Full precision
  • Token embeddings: Full precision
  • Vision encoder: Full precision
  • Linear attention layers: Full precision

Keeping the vision components and selected attention layers in higher precision is intended to preserve multimodal representation quality and classification behavior.

Limitations

VisionGuardrail-9B-FP8 inherits the limitations of VisionGuardrail-9B.

The model is an experimental content-safety classifier and should not be treated as a definitive safety system. Classification errors, false positives, and false negatives may occur.

FP8 quantization may introduce small numerical differences compared with the original BF16 checkpoint. Downstream performance should therefore be evaluated against the original model for production deployments.

The model should be used as one component of a broader content-moderation pipeline rather than as the sole safety mechanism for high-risk applications.

Responsible AI

This model is intended for research, evaluation, and responsible content-safety applications.

Users are responsible for ensuring that their deployment complies with applicable laws, regulations, platform policies, and organizational safety requirements.

For the full safety guidance, intended use, limitations, and responsible AI considerations, refer to the VisionGuardrail-9B model card.

License

VisionGuardrail-9B-FP8 follows the licensing terms of the underlying Qwen/Qwen3.5-9B model and the VisionGuardrail-9B release.

Please review the applicable licenses before using the model in production or redistribution.

Related Models and Datasets

Downloads last month
-
Safetensors
Model size
9B params
Tensor type
BF16
·
F8_E4M3
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for prithivMLmods/VisionGuardrail-9B-fp8

Finetuned
Qwen/Qwen3.5-9B
Quantized
(3)
this model

Dataset used to train prithivMLmods/VisionGuardrail-9B-fp8

Collections including prithivMLmods/VisionGuardrail-9B-fp8