Abstract
Concept unlearning has emerged as a promising direction for reducing the risks of harmful content generation in text-to-image diffusion models by selectively erasing undesirable concepts from a model's parameters. Existing approaches typically rely on keywords to identify the target concept to be unlearned. However, we show that this keyword-based formulation is inherently limited: a visual concept is multi-dimensional, can be expressed in diverse textual forms, and often overlaps with related concepts in the latent space. We therefore adopt a contextual view: a concept should be unlearned through the company it keeps. Under this view, keyword-based unlearning approaches, which imprecisely indicate the target concept via a fixed representation, are brittle against prompt-rephrasing jailbreaks and highly prone to collateral over-forgetting. To address these limitations, we propose Diversified Unlearning, a framework that exposes the erasure objective to natural context-dependent embedding variations. Rather than relying on simple prompt augmentation, we construct paired contextual formulations that introduce implicit contrastive supervision directly into the forgetting process, encouraging the model to isolate the target concept while keeping surrounding contexts invariant. Through extensive experiments across multiple benchmarks and state-of-the-art baselines, we demonstrate that integrating our framework as a lightweight add-on into existing unlearning pipelines yields notable improvements in both erasure effectiveness and concept retention, while significantly hardening models against adversarial recovery attacks.
Why keywords are not enough
Existing unlearning methods describe a visual concept by an isolated keyword (“Barack Obama”, “a photo of Barack Obama”). But a visual concept is not tied to a single lexical form: the same target can appear across paraphrases, attributes, actions and surrounding scenes. Echoing the distributional principle “You shall know a word by the company it keeps” (Firth, 1957), we argue that one shall unlearn a concept by the company it keeps. A systematic analysis reveals two failure modes:
Observation 1 · Imprecise target representation
Concepts are entangled with diverse linguistic contexts, forming context-dependent regions in the text-embedding space rather than isolated points. Even after adding Gaussian noise to the embedding, the unlearned model still generates the target (e.g. top-5 detection of Church stays at 91% at α=0.3). A fixed keyword only suppresses the canonical token, leaving nearby variants untouched → vulnerable to prompt-rephrasing jailbreaks and noise-based recovery attacks.
Observation 2 · Ambiguous erasure signals in output space
The reverse process also produces co-occurring objects, attributes and backgrounds. Forcing the whole predicted trajectory toward a generic anchor never says which visual factors belong to the target and which should be preserved, so benign context is suppressed together with the target. One-sided prompt augmentation or adversarial perturbations make this worse, leading to over-forgetting (visible PSR drops on multi-object erasure).
Method: Diversified Unlearning
Diversified Unlearning pairs the target concept with natural contexts so that the context is shared by both sides of the erasure transformation. This introduces an implicit contrastive supervision: the model is pushed to change the target while keeping the context that the target and anchor have in common. It is a plug-and-play add-on with two modules, one for each family of existing methods.
Output-based Diversified Prompting
Instead of mapping an isolated keyword \(c_e\) to an anchor \(c_a\), we sample natural contexts \(c \sim \mathbf{C}\) and map \(\{c + c_e\} \rightarrow \{c + c_a\}\):
\[ \min_{\theta'} \mathbb{E}\Big[ \underbrace{\big\|\epsilon_{\theta'}(\tau(c{+}c_e)) - \epsilon_{\theta}(\tau(c{+}c_a))\big\|_2^2}_{L_1} + \delta \cdot \underbrace{\big\|\epsilon_{\theta'}(\tau(c_p)) - \epsilon_{\theta}(\tau(c_p))\big\|_2^2}_{L_2} \Big] \]The shared context \(c\) cancels out in the difference, so the erasure direction concentrates on what to erase rather than on the background (δ switches the preservation loss on for baselines that need it).
Attention-based Diversified Embedding Mixup
Naively adding context to attention-based editing (UCE, MACE) causes severe over-forgetting because the text encoder is biased by the context. We instead interpolate token-wise, only at the target token slots \(\mathcal{I}(c_e)\):
\[ f(\tau(c_e), \mathbf{C})^i = \begin{cases} \tau(c_e)^i & i \notin \mathcal{I}(c_e)\\[2pt] \frac{1}{|\mathbf{C}|}\sum_{c\in\mathbf{C}} \big(\alpha\,\tau(c_e)^i + (1-\alpha)\,\tau(c)^i\big) & i \in \mathcal{I}(c_e) \end{cases} \]With α close to 1 the target identity is retained while injecting just enough contextual diversity. The mixed contexts are also added to the preservation set, so surrounding features are explicitly protected.
Context-set construction. For every target concept an advanced LLM (GPT-4o / GPT-5) writes a small set of natural prompts following a single unified prompt-design rule — e.g. everyday actions for celebrities (“a photo of Henry Cavill smiling”), subject variations that keep the style descriptor for artistic styles, and diverse subjects blended with the keyword for explicit concepts. A recognition model filters the generated images, so no hyper-parameter tuning is needed per concept.
Qualitative Results
Across celebrities, objects, copyrighted characters and explicit content, baselines (red) often still reveal the target, while their diversified counterparts (green) erase it. Interestingly, for “Mario” the specific character identity disappears while peripheral style primitives such as colours and textures are kept — a smooth erasure rather than the destructive “hard wash” of keyword-based methods.
Quantitative Results
Celebrity erasure (10 celebrities simultaneously)
| Method | Erasure | Preservation | ||||
|---|---|---|---|---|---|---|
| CLIP-i↓ | GPT↓ | LPIPS↓ | CLIP-i↑ | CLIP-t↑ | GPT↑ | |
| ESD | 65.98 | 11.78 | 0.66 | 62.59 | 24.25 | 31.68 |
| Diversified-ESD | 62.58 | 5.50 | 0.63 | 69.73 | 26.28 | 46.15 |
| UCE | 60.59 | 4.48 | 0.65 | 62.90 | 23.97 | 31.42 |
| Diversified-UCE | 58.55 | 2.83 | 0.64 | 66.92 | 24.57 | 24.40 |
| AP | 61.14 | 13.55 | 0.79 | 49.31 | 21.34 | 14.97 |
| Diversified-AP | 60.78 | 6.10 | 0.68 | 70.50 | 27.09 | 51.15 |
| AGE | 60.68 | 18.84 | 0.83 | 42.31 | 17.96 | 6.98 |
| Diversified-AGE | 58.84 | 12.59 | 0.71 | 64.20 | 26.15 | 12.59 |
| ACE | 74.69 | 29.45 | 0.46 | 84.64 | 29.92 | 76.72 |
| Diversified-ACE | 68.67 | 13.53 | 0.39 | 85.91 | 28.88 | 75.05 |
Best of each baseline/diversified pair in bold. GPT-score is an identity-focused score computed with Qwen2.5-VL-72B (0–100). Diversified-ESD and -AP roughly halve the erasure GPT-score while raising preservation.
Explicit-content (nudity) erasure
| Method | I2P · NudeNet | MS-COCO 30K | |
|---|---|---|---|
| Total detections↓ | FID↓ | CLIP↑ | |
| SD v1.4 | 743 | 14.04 | 31.34 |
| UCE | 253 | 14.85 | 31.27 |
| Diversified-UCE | 196 | 14.87 | 29.30 |
| ESD | 377 | 14.71 | 30.82 |
| Diversified-ESD | 212 | 14.05 | 31.06 |
| AP | 355 | 14.71 | 30.98 |
| Diversified-AP | 172 | 14.21 | 31.01 |
| AGE | 300 | 14.41 | 30.99 |
| Diversified-AGE | 244 | 13.82 | 31.00 |
| ACE | 39 | 14.63 | 30.85 |
| Diversified-ACE | 26 | 14.85 | 30.60 |
Diversified-ESD and -AP cut total nudity detections by 44% and 52% relative to their baselines while keeping COCO-30K FID / CLIP close to the original SD v1.4.
Robustness against Recovery Attacks
Keyword-based unlearning often only steers generation away from the concept (guidance-based avoidance) and leaves it recoverable. Because Diversified Unlearning removes the concept across its contextual company, it behaves more like destruction-based removal. We test three attacks: Ring-A-Bell adversarial prompts (nudity), Indirect Recovery through high-context prompts that omit the name “Mario”, and Noise-based attacks on the ten-celebrity erasure models.
| Method | Ring-A-Bell ASR↓ | IR GPT↓ | ||
|---|---|---|---|---|
| K16 | K38 | K77 | Mario | |
| AP | 46.32 | 48.42 | 54.47 | 38.13 |
| Diversified-AP | 38.95 | 41.05 | 38.95 | 33.75 |
| Noise-based attack, GPT↓ | ||||
|---|---|---|---|---|
| AP | ESD | AGE | UCE | |
| Baseline | 39.63 | 28.19 | 33.00 | 2.00 |
| Diversified | 14.94 | 11.75 | 29.81 | 1.13 |
Conclusion
We revisit the brittleness of keyword-based concept unlearning in text-to-image models. Guided by the principle that a concept should be unlearned through the company it keeps, Diversified Unlearning injects implicit contrastive supervision into the unlearning pipeline via structured context pairs. Through two plug-and-play modules — Diversified Prompting and Diversified Embedding Mixup — it delivers stronger erasure, cleaner retention of benign neighbours and improved robustness against advanced recovery attacks, without architectural overhead.
BibTeX
Coming soon.