Abstract
Security concerns surrounding text-to-image diffusion models have driven researchers to unlearn inappropriate concepts through fine-tuning. Recent fine-tuning methods typically align the prediction distributions of unsafe prompts with those of predefined text anchors. However, these techniques exhibit a considerable performance trade-off between eliminating undesirable concepts and preserving other concepts. In this paper, we systematically analyze the impact of diverse text anchors on unlearning performance. Guided by this analysis, we propose AdvAnchor, a novel approach that generates adversarial anchors to alleviate the trade-off issue. These adversarial anchors are crafted to closely resemble the embeddings of undesirable concepts to maintain overall model performance, while selectively excluding defining attributes of these concepts for effective erasure. Extensive experiments demonstrate that AdvAnchor outperforms state-of-the-art methods. Our code is publicly available at https://anonymous.4open.science/r/AdvAnchor.
Introduction
Text-to-image diffusion models (DMs), such as Stable Diffusion, have revolutionized content creation but also introduced significant risks, including the generation of harmful content, copyright infringement, and unauthorized mimicry of artist styles. Retraining these models from scratch to exclude problematic data is computationally expensive and often impractical.
Machine Unlearning (MU) offers a more efficient alternative by fine-tuning models to "forget" specific concepts. Most existing MU methods align the model's output for an "unsafe" prompt (e.g., "a painting by Van Gogh") with a "safe" anchor prompt (e.g., "a painting"). However, this approach faces a critical trade-off: generic anchors can lead to a collapse in overall generation quality, while overly similar anchors may fail to erase the target concept effectively.
Methodology: The AdvAnchor Framework
AdvAnchor addresses the limitations of manual anchor selection by generating adversarial anchors through an optimization process. The core idea is to find a "Goldilocks" anchor that is semantically close to the target concept to maintain model stability but lacks the specific attributes that define the concept to be erased.
The researchers first conducted a systematic analysis of how different types of anchors (parent classes, similar styles, etc.) affect unlearning. They discovered that the ideal anchor should approximate the undesirable concept's embedding but exclude its defining attributes.
To achieve this, AdvAnchor utilizes Universal Adversarial Perturbations, where a small, optimized perturbation ($e_{adv}$) is added to the text embedding of the target concept. The method employs an "Alternating Optimization" strategy:
- Update Perturbation: The adversarial perturbation is updated to degrade the generation quality of the target concept using a loss function $L_{adv}$. Two variants were explored: $L_{adv1}$ (cosine similarity between predictions) and $L_{adv2}$ (similarity of generation changes), with $L_{adv1}$ proving more effective for total erasure.
- Fine-tune Model: The model weights ($\theta_{op}$) are fine-tuned to align the original model's predictions with this perturbed version.
Experimental Evaluation
AdvAnchor was evaluated across three primary tasks:
- Style Erasure: Removing nine distinct artist styles (e.g., Van Gogh, Picasso, Cezanne).
- Object Erasure: Removing ten object categories from the Imagenette dataset (e.g., "Church", "Chain Saw").
- Explicit Content Removal: Erasing nudity using the I2P (Inappropriate Image Prompts) benchmark, containing over 4,000 sensitive prompts.
To ensure general utility was preserved, the researchers used ImageNet and non-erased artist styles as preservation benchmarks.
Key Results and Discussion
The systematic analysis revealed that semantic proximity is crucial for stability; anchors closer in the embedding space require less drastic weight updates, better preserving unrelated model performance. AdvAnchor acts as a precision tool, targeting only the "defining attributes" of a concept.
AdvAnchor consistently outperformed state-of-the-art methods like ESD and Abconcept:
- Erasure Effectiveness: In style unlearning, classification accuracy for undesirable styles was reduced to nearly 0% in most cases.
- Preservation Quality: AdvAnchor maintained a lower average FID (75.4) for retained styles compared to Abconcept (80.8), indicating higher image quality for non-targeted concepts.
- NSFW Mitigation: On the I2P benchmark, it significantly reduced sensitive content generation while maintaining high accuracy on general ImageNet prompts compared to other unlearning techniques.
Conclusion and Future Work
AdvAnchor demonstrates that adversarial anchors can effectively navigate the trade-off between concept erasure and model preservation. While some concepts like "Van Gogh" are more deeply embedded and harder to remove, the method provides a robust framework for safer diffusion models. Future work may explore simultaneous erasure of multiple concepts and application to other generative architectures beyond Diffusion Models.
Summary updated