Red HatWilliam Caban BabiloniaTutorial
Securing multimodal AI with NeMo Guardrails and vision models
Summary
Text-based guardrails cannot inspect image content, leaving multimodal AI chatbots vulnerable to PII leakage and prompt injection through attached images. In tests, Gemma 3 obeyed all 5 prompt-injected images, and Qwen3-VL obeyed 3 of 5, with success depending on the user’s text prompt. The solution uses a vision model as an input guardrail within NeMo Guardrails, sending each user message to a judge model with a policy prompt before the main model sees it. Two separate judges run in sequence: one for PII detection and one for prompt-injection detection, each with its own policy prompt. The approach adds latency from two judge calls per request and is a probabilistic classifier that can miss or falsely flag content, so it should complement existing deterministic checks.
Context
Multimodal AI chatbots that accept images alongside text have a security blind spot: text-based guardrails and regex rules only inspect the text message, not the image content. An image can contain PII (routing numbers, addresses) that text rails never see, or it can contain prompt-injection instructions that the model obeys. In tests, Gemma 3 (4B) obeyed all 5 prompt-injected images, and Qwen3-VL (8B) obeyed 3 of 5. The attack success depends on the user’s text prompt, so testing once is insufficient.
Approach / What changed
Use a vision model as an input guardrail within NeMo Guardrails. The content safety check input rail sends each user message (including images) to a judge vision model with a policy prompt. The judge returns ‘safe’ or ‘unsafe’ plus violated categories. An unsafe verdict stops the request before the main model processes it. Two separate judges run in sequence: one for PII detection and one for prompt-injection detection, each with its own policy prompt.
Takeaways
Text-only guardrails and regex rules cannot inspect image content, creating a blind spot for PII and prompt injection in multimodal chatbots.
A vision model used as an input guardrail within NeMo Guardrails can read image content and return a safe/unsafe verdict before the main model processes the request.
Two separate judges (one for PII, one for prompt injection) with distinct policy prompts are more effective than a single mixed prompt, because the rules for each pull in opposite directions.
FAQ
Why use two separate judges instead of one?
The approach uses two separate judge models in sequence: one for PII detection and one for prompt-injection detection. Each judge has its own policy prompt because the rules for each pull in opposite directions. A single mixed prompt would weaken both rules.
What are the main limitations of a vision judge?
The vision judge is a probabilistic classifier that can be wrong in both directions. In tests, Qwen3-VL missed a badge with PII every time (false negative), and Gemma 3 flagged redacted forms because it read field labels (false positive). It should be used as one layer alongside deterministic checks.
How much latency does the dual-rail setup add?
Both rails together mean two judge calls per request before the main model runs. In the test setup with a thinking judge, each image took 20 to 50 seconds on an otherwise idle machine. Production deployments should consider a separate, faster judge model.
Source and freshness
- Source
- developers.redhat.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.