Abstract
Multimodal Large Language Models (MLLMs) are increasingly vulnerable to complex safety risks where the combination of text and image inputs triggers harmful outputs. Traditional static defensive prompting often fails to address these nuanced, scenario-specific, or compositional risks. We present RapGuard, a training-free framework that utilizes multimodal chain-of-thought reasoning to generate "safety rationales." These rationales inform adaptive defensive prompts that effectively mitigate risks without compromising model utility on benign tasks.
Introduction: The Multimodal Safety Gap
While Large Language Models (LLMs) have undergone extensive safety alignment, MLLMs introduce a broader and more complex attack surface. A text prompt like "Teach a kid to buy this drink" is benign in isolation but becomes hazardous when paired with an image of alcohol. Current defenses primarily rely on static defensive prompting—prepending generic "be a safe AI" instructions to every query. This approach suffers from two major flaws: a lack of specificity for nuanced scenarios (e.g., medical or legal advice) and a failure to recognize "emergent" risks that only appear when text and images are combined.
Methodology: Rationale-Aware Defense
RapGuard addresses these limitations through a three-stage, inference-time pipeline that moves beyond "one-size-fits-all" security in favor of an adaptive approach.
- Multimodal Safety Rationale Generation: Instead of directly answering the user, the model first evaluates the input against a set of safety rules. It uses multimodal chain-of-thought (CoT) reasoning to produce a rationale explaining why a specific image-text combination might be risky.
- Rationale-Aware Defensive Prompting: This rationale is transformed into an adaptive defensive prompt. This prompt is prepended to the original user query, providing the model with a context-specific "shield" tailored to the immediate risk.
- Self-Checking for Harmful Content Detection: To ensure the model doesn't become "over-defensive" (refusing benign queries), RapGuard employs a self-check. If an initial raw response is flagged as potentially harmful, the model re-queries using the adaptive defensive prompt. If the raw response is safe, it is returned immediately to maintain utility.
Experimental Evaluation
The researchers evaluated RapGuard using several key benchmarks: MM-SafetyBench (over 5,000 instances across 13 scenarios), VLSafe (malicious image-text pairs), and MM-Vet (a utility benchmark to ensure standard task performance remains intact).
Key Results
RapGuard consistently achieves state-of-the-art safety performance across various configurations. On MM-SafetyBench, it reached an average harmless rate of approximately 98%, significantly outperforming vanilla models and existing defenses like ECSO and AdaShield.
Crucially, RapGuard demonstrates zero utility degradation. In tests on the MM-Vet benchmark, RapGuard matched the performance of "Vanilla" models exactly, proving that safety enhancements do not necessarily incur a "tax" of reduced intelligence on safe tasks. The method also proved effective across five different state-of-the-art MLLMs, including LLaVA-1.5, CogVLM, and Qwen-VL, suggesting the approach is architecture-agnostic.
Discussion and Insights
The core insight of RapGuard is that safety in MLLMs is relational. By turning the model's reasoning capabilities inward, it can identify "multimodal traps"—risks that only emerge at the intersection of text and imagery, such as a request for a recipe paired with a photo of poisonous fungi. While the framework adds some inference latency due to its multi-step nature, its training-free design makes it highly accessible for immediate deployment into existing MLLM architectures.
Conclusion and Future Work
RapGuard provides a robust, adaptive layer of protection for MLLMs by leveraging the model's own reasoning to defend against complex attacks. Future research will focus on reducing computational overhead and testing the framework against increasingly sophisticated adversarial inputs.
Summary updated