Skip to main content

Adaptive Spatial-Directional Guidance for Safe Text-to-Image Diffusion Model

By
Yixiang Pan; Ting Luo; Yufeng Li; Wei Tong; Meng Han

While large-scale Text-to-Image (T2I) diffusion models have achieved significant progress in generation quality, their open-ended generation ability also brings serious ethical risks. These models can easily synthesize unsafe content, such as pornography and violence, under unconstrained conditions. To mitigate such risks, recent studies have explored inference-time safety guidance in the noise space. However, most existing methods rely on static risk proxies and direct suppression, without verifying whether the current generation trajectory is actually drifting toward unsafe semantics, which may lead to false positive intervention and degraded image fidelity. To address this problem, we propose Adaptive Spatial-Directional Guidance, called ADG. ADG reformulates unsafe content generation as a semantic drift toward risk concepts during the denoising process. Unlike direct suppression based on static risk proxies, ADG first verifies whether the current denoising trajectory is drifting toward a predefined risk direction. It measures the alignment between the user-driven denoising direction and the risk direction to obtain a trajectory-level risk score, which adaptively controls whether and how strongly safety correction is applied. To avoid unnecessary global modification, the correction is spatially restricted to risk-associated regions indicated by a cross-attention based spatial prior. This risk-confirmed local correction suppresses unsafe semantics while better preserving non-risk content. ADG requires no training and does not rely on external safety classifiers during sampling. Experiments show that ADG substantially reduces unsafe generation across multiple risk categories while achieving a favorable trade-off between safety and image quality preservation. Code is available at https://github.com/enenadfegrge/ADG

Read on IEEE Xplore