Introduction
Text-to-image (T2I) diffusion models have revolutionized creative content generation but face significant challenges regarding the production of harmful or inappropriate content. Existing safety mechanisms typically rely on simple text filters, computationally expensive model unlearning, or post-hoc image filtering. These approaches often suffer from being easily bypassed by adversarial prompts, degrading overall image quality, or wasting computational resources. SteerDiff addresses these issues by introducing a lightweight, modular adapter that "steers" problematic text embeddings toward safe semantic regions without modifying the underlying diffusion model's weights.
Methodology
SteerDiff operates as an intermediary between the text encoder and the diffusion model. It consists of two primary components: an Inappropriate Concepts Identifier and a Steer Model.
The Inappropriate Concepts Identifier utilizes a Multi-Layer Perceptron (MLP) and a sliding window technique to analyze text embeddings. This approach allows the system to detect harmful intent in compound phrases where individual words might appear benign. If a segment is flagged as unsafe, the Steer Model applies a linear transformation to project the unsafe embedding into a nearby "safe" region of the embedding space. This process effectively neutralizes harmful concepts (e.g., steering "killed" toward "saved") before they can influence the image generation process.
Key Insights: The Safety Subspace
A core finding of this research is that unsafe concepts tend to cluster within specific regions of the high-dimensional embedding space. By identifying the decision boundary between "safe" and "unsafe" zones, SteerDiff can apply a simple linear shift to move a prompt across that boundary without losing the original context.
Experimental Results
The effectiveness of SteerDiff was evaluated using the I2P (Inappropriate Image Prompts) benchmark and MS-COCO for image quality assessment. SteerDiff significantly reduces the probability of generating inappropriate content, achieving an overall probability of 4.51% on the I2P benchmark, outperforming baselines like Stable Diffusion (30.17%) and SLD MAX (5.15%).
Furthermore, SteerDiff demonstrates high robustness against adversarial "red-teaming" attacks like Prompting4Debugging (P4D), maintaining a much lower attack success rate (25.36%) compared to standard filters which are bypassed 95% of the time. Importantly, this safety is achieved without sacrificing image quality, as evidenced by a competitive FID score of 15.45 on COCO-30K.
Conclusion
SteerDiff provides a robust and efficient solution for enhancing the safety of T2I models. By intervening at the embedding level, it prevents the formation of harmful latent representations while remaining modular and easy to update. Beyond safety, the steering mechanism shows promise for tasks such as artist-style removal, offering a versatile tool for responsible AI development. Future work will focus on dynamic steering strengths to prevent overcorrection in borderline cases.
Summary updated