TL;DR
Multimodal Large Language Models (MLLMs) are vulnerable to generating harmful content when presented with malicious visual inputs, despite their LLM origins. This paper introduces Constitutional Calibration (CoCA), a training-free method that amplifies MLLMs' inherent safety awareness by adjusting output probabilities, effectively restoring their safety without compromising performance.
What Problem Does This Paper Address?
Large Language Models (LLMs) have been trained to be safe and aligned with human values. However, when these LLMs are extended to handle visual inputs, forming Multimodal Large Language Models (MLLMs), a new vulnerability emerges. The integration of visual data, while enabling powerful new capabilities, seems to weaken the MLLMs' safety-awareness. This means MLLMs can be tricked by malicious images into generating harmful, unethical, or dangerous content, even if the underlying LLM would have refused. The core problem is understanding if this safety awareness is lost or merely obscured by the "modality gap" and, if so, how to restore it without extensive retraining.
Methods
The authors propose Constitutional Calibration (CoCA), a novel, training-free technique to enhance MLLM safety. The core idea is to leverage the observation that simply adding a safety principle (e.g., "The assistant cannot provide answers related to illegal activities") to the prompt can boost safety. CoCA amplifies this effect by:
- Calculating a "safety delta": This is the difference in the model's predicted token probabilities when a safety principle is included in the prompt versus when it's not, for the same input.
- Calibrating logits: This safety delta is then used to adjust the model's output logits (the raw scores before the softmax function) during inference. Specifically, the delta is scaled by a hyperparameter ($\alpha$) and added to the original logits. This effectively amplifies the influence of the safety principle on the model's output distribution.
This approach aims to "reclaim" the LLM's original safety awareness by subtly guiding its output generation process at inference time, without altering the model's weights.
Datasets
The paper evaluates CoCA on existing multimodal safety benchmarks:
- MM-SafetyBench: This benchmark includes various types of malicious image inputs, such as:
- Stable-diffusion (SD) images: AI-generated images directly related to harmful queries.
- Typography (TYPO) images: Images containing text that, when combined with a query, forms a harmful instruction.
- SD+TYPO images: A combination of both.
- FigStep: Another benchmark that uses typography to convert harmful instructions into images.
For evaluating visual understanding and reasoning capabilities, the authors use:
- MM-Vet
- MME
- VQA
- GQA
Key Insights and Ideas
- Inherent Safety Awareness: MLLMs do possess safety awareness inherited from their LLM training, but this awareness is weakened by the modality gap between visual and textual information.
- Prompting is Key: Even simple textual safety guidelines in prompts can significantly improve MLLM safety, demonstrating that the safety knowledge is transferable.
- CoCA Amplifies Safety: CoCA effectively amplifies the impact of these safety prompts by calibrating the model's output distribution, leading to substantial safety improvements.
- Training-Free is Powerful: The ability to achieve significant safety gains without any additional training is a major advantage, making the method easily applicable.
- Concise Principles Matter: Overly complex safety principles can confuse the model, suggesting that clear and concise instructions are more effective.
Key Results
- Significant Safety Improvement: CoCA consistently reduces the Attack Success Rate (ASR) across various MLLMs (LLaVA, CogVLM, Mplug-Owl2) and different types of malicious image inputs (TYPO, SD, SD+TYPO). For instance, on LLaVA-7B with SD+TYPO inputs, CoCA reduced ASR from 65.9% (with system prompt) to 38.6%.
- Preserves Capabilities: Crucially, CoCA does not degrade the MLLM's visual understanding and reasoning abilities. Experiments on MM-Vet, GQA, and VQA show comparable or even slightly improved performance compared to baseline models.
- Scalability: CoCA shows more substantial improvements with larger models, suggesting its effectiveness scales with model capacity.
- Customization Benefits: Task-specific safety principles lead to stronger safety-awareness than generic ones.
Limitations and Future Work
- Complexity of Principles: The paper notes that overly complex safety principles can be detrimental, suggesting that concise expressions are crucial. Future work could explore optimal ways to formulate these principles.
- Hyperparameter Tuning: While $\alpha$ is a hyperparameter, the paper suggests that larger values generally lead to better performance, indicating a clear direction for tuning.
- Further Exploration: The authors believe their work provides insights into MLLM safety and contributes to the development of safer models. Future research could explore more advanced calibration techniques or investigate the fundamental reasons behind the modality gap's impact on safety.
Summary updated