Yue Liu, Shengfang Zhai, Mingzhe Du
Yulin Chen, Tri Cao, Hongcheng Gao, Cheng Wang
Xinfeng Li, Kun Wang, Junfeng Fang, Jiaheng Zhang, Bryan Hooi
1新加坡国立大学, 2南洋理工大学
为了提升 VLM 的安全性,本文提出了一种新颖的基于推理的 VLM 护栏模型,命名为 GuardReasoner-VL。 其核心思想是通过在线 RL,激励护栏模型在做出审核决策之前进行深思熟虑的推理。 首先,我们构建了 GuardReasoner-VLTrain,一个包含 123K 个样本和 631K 个推理步骤的推理语料库,涵盖文本、图像以及文本-图像输入。 然后,基于该语料库,我们通过 SFT 冷启动模型的推理能力。 此外,我们进一步通过在线 RL 增强与审核相关的推理能力。 具体来说,为了提升样本的多样性和难度,我们进行拒绝采样,然后通过所提出的安全感知数据拼接进行数据增强。 此外,我们使用动态裁剪参数,在早期阶段鼓励探索,在后期阶段鼓励利用。 为了平衡性能与 token 效率,我们设计了一种长度感知的安全奖励,该奖励综合了准确性、格式和 token 成本。 大量实验证明了我们模型的优越性。 值得注意的是,它在平均 F1 分数上超越了第二名 19.27%。
图 1:GuardReasoner-VL 概览。
要评估 GuardReasoner-VL,请运行以下代码。
python ./evaluate.py
结果存储在 result.csv 文件中。
Performance of GuardReasoner-VL (GuardReasoner-VL-7B):
ToxicChat ,HarmBenchPrompt ,OpenAIModeration ,AegisSafetyTest ,SimpleSafetyTests ,WildGuardTest ,Average (Text) ,HarmImageTest ,SPA-VL-Eval ,Average (All)
76.51 ,98.30 ,70.98 ,90.13 ,98.99 ,88.35 ,79.88 ,70.84 ,85.60 ,79.07
HarmBenchResponse ,SafeRLHF ,BeaverTails ,XSTestReponseHarmful,WildGuardTest ,Average (Text) ,SPA-VL-Eval ,Average (All)
87.22 ,66.37 ,84.76 ,92.72 ,79.04 ,79.42 ,73.22 ,77.58
Performance of GuardReasoner-VL (GuardReasoner-VL-Eco-7B):
ToxicChat ,HarmBenchPrompt ,OpenAIModeration ,AegisSafetyTest ,SimpleSafetyTests ,WildGuardTest ,Average (Text) ,HarmImageTest ,SPA-VL-Eval ,Average (All)
76.26 ,98.73 ,70.82 ,90.34 ,99.50 ,88.54 ,79.82 ,64.84 ,85.26 ,77.49
HarmBenchResponse ,SafeRLHF ,BeaverTails ,XSTestReponseHarmful,WildGuardTest ,Average (Text) ,SPA-VL-Eval ,Average (All)
86.22 ,66.15 ,85.51 ,93.33 ,78.60 ,79.51 ,70.81 ,76.94
Performance of GuardReasoner-VL (GuardReasoner-VL-3B):
ToxicChat ,HarmBenchPrompt ,OpenAIModeration ,AegisSafetyTest ,SimpleSafetyTests ,WildGuardTest ,Average (Text) ,HarmImageTest ,SPA-VL-Eval ,Average (All)
74.45 ,89.10 ,70.83 ,88.79 ,99.50 ,88.92 ,78.77 ,70.93 ,86.47 ,78.73
HarmBenchResponse ,SafeRLHF ,BeaverTails ,XSTestReponseHarmful,WildGuardTest ,Average (Text) ,SPA-VL-Eval ,Average (All)
85.76 ,66.37 ,85.16 ,93.08 ,76.07 ,78.83 ,71.19 ,76.56
Performance of GuardReasoner-VL (GuardReasoner-VL-Eco-3B):
ToxicChat ,HarmBenchPrompt ,OpenAIModeration ,AegisSafetyTest ,SimpleSafetyTests ,WildGuardTest ,Average (Text) ,HarmImageTest ,SPA-VL-Eval ,Average (All)
73.47 ,88.58 ,70.87 ,89.04 ,99.50 ,89.16 ,78.43 ,66.79 ,85.82 ,77.39
HarmBenchResponse ,SafeRLHF ,BeaverTails ,XSTestReponseHarmful,WildGuardTest ,Average (Text) ,SPA-VL-Eval ,Average (All)
84.72 ,66.96 ,85.39 ,93.59 ,77.39 ,79.31 ,72.01 ,77.14
图 2:GuardReasoner-VL 在多模态护栏基准上的平均性能。
表 1:提示词有害性检测任务的性能。
表 2:回复有害性检测任务的性能。
要复现 GuardReasoner-VL 的生成过程,请运行以下代码。
bash test.sh
要使用 GuardReasoner-VL,请运行以下代码。
CUDA_VISIBLE_DEVICES=0 python deploy.py
要复现 GuardReasoner 的训练过程,请参阅训练流程。
我们的方法部分基于以下资源。感谢他们的出色工作。
如果您觉得这个仓库有帮助,请引用我们的论文。
@article{GuardReasoner,
title={GuardReasoner: Towards Reasoning-based LLM Safeguards},
author={Liu, Yue and Gao, Hongcheng and Zhai, Shengfang and Jun, Xia and Wu, Tianyi and Xue, Zhiwei and Chen, Yulin and Kawaguchi, Kenji and Zhang, Jiaheng and Hooi, Bryan},
journal={arXiv preprint arXiv:2501.18492},
year={2025}
}
@article{GuardReasoner-VL,
title={GuardReasoner-VL: Safeguarding VLMs via Reinforced Reasoning},
author={Liu, Yue and Zhai, Shengfang and Du, Mingzhe and Chen, Yulin and Cao, Tri and Gao, Hongcheng and Wang, Cheng and Li, Xinfeng and Wang, Kun and Fang, Junfeng and Zhang, Jiaheng and Hooi, Bryan},
journal={arXiv preprint arXiv:2505.11049},
year={2025}
}
(返回顶部)