让视觉语言模型像文本一样安全,靠文本引导视觉对齐。
Cross-Modal Safety Mechanism Transfer in Large Vision-Language Models
- 用相关文本引导视觉特征映射到语言模型隐藏层空间。
- 无需视觉模态微调,即可实现对有毒图像的识别与过滤。
- 适合关注多模态安全、模型鲁棒性的研究者与工程师。
大型视觉语言模型(LVLMs)中的视觉-语言对齐虽使语言模型能理解视觉输入,但现有方法无法将大语言模型(LLM)中已有的文本安全机制有效迁移至视觉模态,导致对有毒图像存在漏洞。我们深入分析发现,安全机制的成功激活依赖于特定Transformer层的隐藏状态,而当前方法在隐藏状态层面的视觉-语言对齐不足,导致图像与文本在隐藏空间中语义错位,从而误导安全机制。为此,我们提出一种新型文本引导视觉-语言对齐方法(TGA):通过检索与输入视觉相关的文本,引导视觉特征投影至语言模型的隐藏状态空间。实验表明,TGA无需在视觉模态上进行任何安全微调,即可成功将文本安全机制迁移至视觉,同时保持在各类视觉任务上的通用性能(安全且高效)。
原文摘要 · Abstract (English)
Vision-language alignment in Large Vision-Language Models (LVLMs) successfully enables LLMs to understand visual input. However, we find that existing vision-language alignment methods fail to transfer the existing safety mechanism for text in LLMs to vision, which leads to vulnerabilities in toxic image. To explore the cause of this problem, we give the insightful explanation of where and how the safety mechanism of LVLMs operates and conduct comparative analysis between text and vision. We find that the hidden states at the specific transformer layers play a crucial role in the successful activation of safety mechanism, while the vision-language alignment at hidden states level in current methods is insufficient. This results in a semantic shift for input images compared to text in hidden states, therefore misleads the safety mechanism. To address this, we propose a novel Text-Guided vision-language Alignment method (TGA) for LVLMs. TGA retrieves the texts related to input vision and uses them to guide the projection of vision into the hidden states space in LLMs. Experiments show that TGA not only successfully transfers the safety mechanism for text in basic LLMs to vision in vision-language alignment for LVLMs without any safety fine-tuning on the visual modality but also maintains the general performance on various vision tasks (Safe and Good).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。