EC-MSD: Erasing Concepts in Diffusion Models with Minor Semantic Deviation

Xidian University
†Corresponding authors

EC-MCD can achieve precise, fine-grained, customizable, transferable and unbiased concept erasure in a low semantic deviation manner.

Abstract

Interpolate start reference image.

To eliminate inappropriate concepts in Diffusion Models (DMs), current methods typically map them to pre-defined anchor concepts through fine-tuning techniques. From this, we observe the following problems: 1) There is a semantic deviation phenomenon in images generated by the erased model: the images generated before and after concept erasure show significant changes in non-erased concept areas such as background content, protagonist position, and spatial structure layout, even resulting in the complete loss of semantic information present in the images generated before concept erasure. 2) Existing methods do not clearly distinguish between object and style erasure tasks. Most concept erasure methods are designed for tasks with distinct main objects (e.g., instances, celebrities). In contrast, image style is often distributed across the entire image area. Due to the lack of explicit differentiation between the two tasks, these methods perform poorly when handling style erasure tasks.

To effectively mitigate the aforementioned semantic deviation phenomenon, we propose EC-MSD for Erasing Concepts in Diffusion Models with Minor Semantic Deviation. This new fine-tuning framework is based on the attention resteering mechanism, which can customize and remanipulate the cross-attention matrices of target and anchor concepts according to the characteristics of different erasure tasks. We also propose a semantic retention loss based on concept disentanglement to assist the attention resteering mechanism in preserving non-target concept semantics during fine-tuning. Extensive experiments have demonstrated that our method can not only erase target concepts but also successfully mitigate semantic deviations in images generated by the erased model, achieving fine-grained, customizable unbiased semantic erasure tailored to different task characteristics.

Our Method

Interpolate start reference image.



Our proposed EC-MSD is a general concept erasure framework. We design a customizable attention resteering mechanism based on the characteristics of the object and style concept erasure tasks, which plays a role in retaining the semantic information of non-target concepts during the construction of latent variables.

We also design a semantic retention loss based on concept decoupling to assist the attention resteering mechanism in addressing the potential loss of non-target concept semantic information during the fine-tuning process.

Results

Object Concept Removal

Interpolate start reference image.

Single Object Erasure results for multiple concepts.

Interpolate start reference image.

Single Object Erasure results compared with existing methods.

Artistic Style Removal

Interpolate start reference image.

Style Erasure results compared with existing methods.

More Results

Interpolate start reference image.

Samples from SD v2.1 with one and multiple objects erased.