Diffusion transformers (DiTs) equipped with multimodal attention (MM-Attn) have become a dominant paradigm for image generation. However, preventing the generation of harmful content remains a critical challenge, particularly in image-to-image (I2I) editing tasks. Existing safety mechanisms are primarily designed for text-to-image (T2I) synthesis or U-Net-based architectures, which limits their effectiveness for unified safety mitigation in DiT-based frameworks. To bridge this gap, we propose Unified Visual Safety Regulator (UVR), a training-free safe generation framework that regulates unsafe semantics in generated images. UVR is grounded in an analysis of attention dynamics from the perspective of information flow in MM-Attn. We identify a task-independent start-up stage, during which unsafe semantics in output patches rapidly emerge and can be accurately localized, followed by task-specific semantic amplification and interference stages, where harmful signals are further propagated and entangled with benign content. Based on these observations, UVR mitigates unsafe generation through unified, targeted attention modulation and explicit restriction of harmful information flow over the identified unsafe output patches. Experiments across various concepts show that UVR achieves state-of-the-art safety performance by achieving 91% and 77% erase rate in image synthesis and editing tasks, while preserving visual quality and fidelity with minimal degradation. Code is available at https://github.com/deng12yx/UVR.
翻译:扩散变换器(DiTs)配备多模态注意力(MM-Attn)已成为图像生成的主导范式。然而,防止有害内容生成仍是一项关键挑战,尤其在图像到图像(I2I)编辑任务中。现有安全机制主要针对文本到图像(T2I)合成或基于U-Net的架构设计,这限制了它们在基于DiT框架中实现统一安全缓解的有效性。为弥补这一差距,我们提出统一视觉安全调节器(UVR),这是一种无需训练的安全生成框架,可调节生成图像中的不安全语义。UVR基于对MM-Attn中信息流视角下注意力动态的分析。我们识别出一个与任务无关的启动阶段,在此阶段输出块中的不安全语义迅速出现且可精确定位,随后进入任务特定的语义放大与干扰阶段,有害信号进一步传播并与良性内容交织。基于这些观察,UVR通过统一、针对性的注意力调制和显式限制已识别不安全输出块上的有害信息流来缓解不安全生成。跨多种概念的实验表明,UVR在图像合成和编辑任务中分别达到91%和77%的擦除率,实现了最先进的安全性能,同时以最小退化保留视觉质量和保真度。代码见https://github.com/deng12yx/UVR。