Abstract
Text-to-image (T2I) diffusion models have achieved remarkable progress in generating high-quality images but also raise people's concerns about generating harmful or misleading content. While extensive approaches have been proposed to erase unwanted concepts without requiring retraining from scratch, they inadvertently degrade performance on normal generation tasks. In this work, we propose Interpret then Deactivate (ItD), a novel framework to enable precise concept removal in T2I diffusion models while preserving overall performance. ItD first employs a sparse autoencoder (SAE) to interpret each concept as a combination of multiple features. By permanently deactivating the specific features associated with target concepts, we repurpose SAE as a zero-shot classifier that identifies whether the input prompt includes target concepts, allowing selective concept erasure in diffusion models. Moreover, we demonstrate that ItD can be easily extended to erase multiple concepts without requiring further training. Comprehensive experiments across celebrity identities, artistic styles, and explicit content demonstrate ItD's effectiveness in eliminating targeted concepts without interfering with normal concept generation. Additionally, ItD is also robust against adversarial prompts designed to circumvent content filters.
Introduction
Text-to-image (T2I) models like Stable Diffusion are incredibly powerful but prone to generating "harmful" content—ranging from non-consensual imagery and copyrighted characters to specific artistic styles. Existing solutions generally fall into two camps: fine-tuning, which often leads to "catastrophic forgetting" (e.g., erasing "nudity" accidentally breaks the ability to generate a normal "person"), and external modules, which are computationally expensive and difficult to scale. The challenge lies in precision and expandability: removing a specific concept with zero impact on unrelated concepts without retraining the entire system.
The Interpret then Deactivate (ItD) Framework
The authors propose the Interpret then Deactivate (ItD) framework, which operates surgically on the text encoder rather than the image-generating U-Net. The core engine is the Sparse Autoencoder (SAE), used to decompose the "polysemantic" (messy and multi-purpose) neurons of a transformer into a massive set of sparse, interpretable features.
Cleverly, the authors repurpose the SAE as a gatekeeper. Because an SAE is trained to reconstruct specific data, its reconstruction error acts as a signal. If a prompt contains a target concept, the SAE reconstructs it with very low error. This allows the model to "detect" the concept in a zero-shot manner and only apply deactivation when necessary. When a target concept is detected, the specific features identified are scaled down or zeroed before being passed to the diffusion model.
Precision via Contrast-Based Feature Selection
A significant insight of this work is identifying why previous methods failed: features for concepts like "nudity" and "person" overlap significantly in the latent space. To ensure they don't erase "normal" features, the authors use a contrastive method.
By identifying features active for a target concept (e.g., "nudity") and subtracting any features that are also active for a "retain set" of safe concepts (e.g., "person"), the framework isolates only the features unique to the unwanted concept. This allows the model to keep "human body" features while eliminating "explicit" features.
Key Results and Robustness
The ItD framework was evaluated across several benchmarks, including celebrity identities, artistic styles, and explicit content (I2P). Key findings include:
- Total Erasure with High Preservation: In celebrity tests, ItD achieved 0.00% accuracy for target celebrities while maintaining 89.12% accuracy for remaining celebrities—virtually identical to the original model.
- Adversarial Robustness: ItD proved highly resistant to "jailbreak" prompts. Against the UnlearnDiff adversarial attack, ItD maintained the lowest Attack Success Rate (12.61%), significantly outperforming other state-of-the-art methods.
- Efficiency: The SAE adds less than 1% to the total image generation time, making it a viable "plug-and-play" solution for production environments.
Conclusion
Interpret then Deactivate (ItD) offers a precise, scalable, and efficient method for concept erasure in T2I models. By turning interpretability tools (SAEs) into active control mechanisms, it avoids the pitfalls of catastrophic forgetting. Future work will focus on reducing dependency on manually defined "retain sets" and exploring how feature deactivation scales when managing thousands of overlapping concepts simultaneously.
Summary updated