arXiv:2605.18719cs.CV2026-05

无需标注数据,通过在线强化学习提升扩散模型安全性。

SafeDiffusion-R1: Online Reward Steering for Safe Diffusion Post-Training

论文配图:SafeDiffusion-R1: Online Reward Steering for Safe Diffusion Post-Training
图 1 · 摘自论文原文
  • 采用在线策略优化,基于文本提示直接调整生成方向。
  • 安全内容占比降至18.07%,裸露检测从646次降到15次。
  • 适用于多种有害提示,无需额外训练或奖励模型。

扩散模型在去除预训练阶段学习到的不安全内容方面被广泛研究。现有方法依赖昂贵的监督数据,如不安全文本与安全图像配对或正负图像对,难以规模化。此外,离线强化学习和监督微调生成合成数据的方法易引发灾难性遗忘,导致生成质量下降。本文提出一种新型在线强化学习框架,通过在负向与正向文本提示上使用组相对策略优化(GRPO)解决数据稀缺与模型退化问题。为避免微调专用安全/不安全奖励模型,引入一种「引导奖励机制」,利用CLIP嵌入的固有特性:将文本表示在嵌入空间中朝正向安全方向引导,远离负向方向。该在线策略使模型能从多样提示(包括显式不安全内容)中学习,且无灾难性遗忘。大量实验表明,本方法将不当内容比例降至18.07%(对比SD v1.4的48.9%),裸露检测次数从646降至15,组合生成质量在GenEval上从42.08%提升至47.83%。显著地,这些安全提升可泛化至七类外部域不安全提示,达到领先性能,且无需监督配对数据或奖励调优。代码已开源。

原文摘要 · Abstract (English)

Diffusion models have been widely studied for removing unsafe content learned during pre-training. Existing methods require expensive supervised data, either unsafe-text paired with safe-image groundtruth or negative/positive image pairs, making them impractical to scale. Furthermore, offline reinforcement learning and supervised fine-tuning approaches that generate synthetic data offline suffer from catastrophic forgetting, degrading generation quality. We propose a novel online reinforcement learning framework that addresses both data scarcity and model degradation through post-training with Group Relative Policy Optimization (GRPO) on both negative and positive text prompts. To eliminate the need for fine-tuning specialized safe/unsafe reward models, we introduce a \textit{steering reward mechanism} that exploits an inherent property of CLIP embeddings: steering text representations toward positive safety directions and away from negative ones in the embedding space. Our online-policy approach enables the model to learn from diverse prompts, including explicit unsafe content, without catastrophic forgetting. Extensive experiments demonstrate that our method reduces inappropriate content to 18.07\% (vs. 48.9\% for SD v1.4) and nudity detections to 15 (vs. 646 baseline) while improving compositional generation quality from 42.08\% to 47.83\% on GenEval. Remarkably, these safety gains generalize to out-of-domain unsafe prompts across seven harm categories, achieving state-of-the-art performance without supervised paired data or reward tuning. Github: https://github.com/MAXNORM8650/SafeDiffusion-R1.

扩散模型安全生成在线学习CLIP

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。