arXiv:2503.07389cs.CVcs.AI2025-03ICCV被引 16

提出双阶段方法,让AI图像模型可靠清除恶意概念,同时保持正常生成能力。

TRCE: Towards Reliable Malicious Concept Erasure in Text-to-Image Diffusion Models

  • 通过优化交叉注意力层,将恶意提示映射为安全提示
  • 在去噪初期利用对比学习引导生成方向,避免生成不当内容
  • 适用于需安全可控生成的AI图像应用,如内容审核与合规设计

文本到图像扩散模型虽能生成逼真图像,但也可能产出不适宜内容(如NSFW)。为缓解风险,已有概念擦除方法试图让模型遗忘特定概念,但难以彻底清除隐含于提示中的恶意语义(如隐喻或对抗性提示),同时保持正常生成能力。为此,本文提出TRCE,采用两阶段擦除策略,在可靠擦除与知识保留之间取得平衡。第一阶段,识别关键[ EoT ]嵌入,优化交叉注意力层,使恶意提示映射至语义相近但安全的概念;第二阶段,基于扩散模型采样轨迹的确定性特性,通过对比学习引导早期去噪预测朝向安全方向,远离危险输出。在多个恶意概念擦除基准上评估表明,TRCE有效擦除恶意概念,同时更好保留模型原始生成能力。代码已开源:http://github.com/ddgoodgood/TRCE。注意:本文包含可能含有冒犯性内容的模型生成结果。

原文摘要 · Abstract (English)

Recent advances in text-to-image diffusion models enable photorealistic image generation, but they also risk producing malicious content, such as NSFW images. To mitigate risk, concept erasure methods are studied to facilitate the model to unlearn specific concepts. However, current studies struggle to fully erase malicious concepts implicitly embedded in prompts (e.g., metaphorical expressions or adversarial prompts) while preserving the model's normal generation capability. To address this challenge, our study proposes TRCE, using a two-stage concept erasure strategy to achieve an effective trade-off between reliable erasure and knowledge preservation. Firstly, TRCE starts by erasing the malicious semantics implicitly embedded in textual prompts. By identifying a critical mapping objective(i.e., the [EoT] embedding), we optimize the cross-attention layers to map malicious prompts to contextually similar prompts but with safe concepts. This step prevents the model from being overly influenced by malicious semantics during the denoising process. Following this, considering the deterministic properties of the sampling trajectory of the diffusion model, TRCE further steers the early denoising prediction toward the safe direction and away from the unsafe one through contrastive learning, thus further avoiding the generation of malicious content. Finally, we conduct comprehensive evaluations of TRCE on multiple malicious concept erasure benchmarks, and the results demonstrate its effectiveness in erasing malicious concepts while better preserving the model's original generation ability. The code is available at: http://github.com/ddgoodgood/TRCE. CAUTION: This paper includes model-generated content that may contain offensive material.

图像生成安全可控概念擦除

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