Neighbor-Aware Localized Concept Erasure in Text-to-Image Diffusion Models
Organizations: McGill University · Mila - Quebec AI Institute · EPFL
Abstract
Concept erasure in text-to-image diffusion models seeks to remove undesired concepts while preserving overall generative capability. Localized erasure methods aim to restrict edits to the spatial region occupied by the target concept. However, we observe that suppressing a concept can unintentionally weaken semantically related neighbor concepts, reducing fidelity in fine-grained domains. We propose Neighbor-Aware Localized Concept Erasure (NLCE), a training-free framework designed to better preserve neighboring concepts while removing target concepts. It operates in three stages: (1) a spectrally-weighted embedding modulation that attenuates target concept directions while stabilizing neighbor concept representations, (2) an attention-guided spatial gate that identifies regions exhibiting residual concept activation, and (3) a spatially-gated hard erasure that eliminates remaining traces only where necessary. This neighbor-aware pipeline enables localized concept removal while maintaining the surrounding concept neighborhood structure. Experiments on fine-grained datasets (Oxford Flowers, Stanford Dogs) show that our method effectively removes target concepts while better preserving closely related categories. Additional results on celebrity identity, explicit content and artistic style demonstrate robustness and generalization to broader erasure scenarios.
Figures & tables
| Method | Oxford Flowers | Stanford Dogs | ||||||||||||||||||
| Alpine Sea Holly | Camellia | Chesapeake Bay Retriever | Bluetick | |||||||||||||||||
| Acc t (↓) | Acc r (↑) | (↑) | CS (↑) | KID (↓) | Acc t (↓) | Acc r (↑) | (↑) | CS (↑) | KID (↓) | Acc t (↓) | Acc r (↑) | (↑) | CS (↑) | KID (↓) | Acc t (↓) | Acc r (↑) | (↑) | CS (↑) | KID (↓) | |
| SD v1.4 | 100.00 | 100.00 | 0.00 | 32.52 | - | 100.00 | 100.00 | 0.00 | 32.55 | - | 100.00 | 100.00 | 0.00 | 34.97 | - | 100.00 | 100.00 | 0.00 | 34.98 | - |
| MACE | 4.00 | 58.67 | 72.83 | 30.81 | 0.92 | 4.00 | 54.18 | 69.27 | 31.37 | 0.61 | 0.00 | 42.58 | 59.73 | 33.49 | 0.96 | 0.00 | 45.63 | 62.67 | 33.87 | 0.73 |
| SPM | 4.00 | 68.97 | 80.27 | 32.72 | 0.20 | 28.00 | 69.09 | 70.52 | 32.75 | 0.17 | 8.00 | 60.43 | 72.95 | 34.96 | 0.07 | 12.00 | 60.77 | 71.90 | 34.99 | 0.06 |
| ESD-x | 4.00 | 69.70 | 80.76 | 31.98 | 0.11 | 8.00 | 63.27 | 74.98 | 31.59 | 0.30 | 24.00 | 49.51 | 59.96 | 33.63 | 0.59 | 12.00 | 67.10 | 76.14 | 34.46 | 0.12 |
| Variant | Erasure 10 Dogs | Erasure 10 Flowers | ||||||||
| (↓) | (↑) | (↑) | (↑) | (↓) | (↓) | (↑) | (↑) | (↑) | (↓) | |
| SD | 100.00 | 100.00 | 0.00 | 34.99 | - | 100.00 | 100.00 | 0.00 | 32.70 | - |
| MACE | 0.40 | 1.52 | 3.00 | 21.67 | 10.68 | 1.03 | 0.00 | 0.00 | 20.16 | 15.51 |
| SPM | 43.20 | 58.05 | 57.42 | 34.97 | 0.10 | 58.80 | 67.50 | 51.17 | 32.84 | 0.23 |
| ESD-x | 24.80 | 35.57 | 48.30 | 32.40 | 1.57 | 23.60 | 34.50 | 47.53 | 30.34 | 1.19 |
| ESD-u | 19.20 | 27.19 | 40.69 | 32.06 | 2.55 | 32.80 | 29.33 | 40.84 | 29.42 | 2.04 |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Training-Free | Description |
| MACE | ✗ | Combines a closed-form solution with LoRA-based fine-tuning to achieve effective erasure while maintaining generation quality on unrelated concepts. |
| SPM | ✗ | Trains one-dimensional adapters that can be activated or deactivated through the Facilitated Transport mechanism, aiming to retain generation quality on unrelated concepts. |
| ESD-x | ✗ | Fine-tunes the cross-attention layers to overwrite the target erasure concept. |
| ESD-u | ✗ | Fine-tunes the U-net to overwrite the target erasure concept. |
| UCE | ✓ | Solves a least-squares optimization problem to redirect cross-attention output from the target concept while preserving outputs for specified retain concepts. |
| RECE | ✓ | Repeatedly solves a least-squares optimization problem from an adversarial perspective to minimize the probability of generating the target concept. |
| Dataset | Acc t | Acc r | H o | ||
| Stanford Dogs | 1.0 | 0.8 | 24.80 | 91.90 | 82.72 |
| 1.0 | 1.0 | 26.80 | 91.90 | 82.93 | |
| 1.0 | 1.2 | 21.60 | 91.90 | 84.62 | |
| Oxford Flowers | 1.0 | 0.8 | 16.00 | 91.83 | 87.74 |
| 1.0 | 1.0 | 24.40 | 91.83 | 81.49 | |
| 1.0 | 1.2 | 19.20 | 91.83 | 85.96 |
| Mean Acc t | Mean Acc r | H o | ||
| 1.0 | 0.8 | 0.67 | 89.55 | 94.19 |
| 1.0 | 0.9 | 0.44 | 94.67 | 97.05 |
| 1.0 | 1.0 | 2.45 | 94.44 | 95.97 |
| 1.0 | 1.2 | 1.56 | 85.56 | 91.55 |
| Parameters ( ) | Armpits | Belly | Buttocks | Feet | Breasts (F) | Genitalia (F) | Breasts (M) | Genitalia (M) | Anus | Total | Clip Score |
| 17 | 27 | 2 | 3 | 26 | 2 | 4 | 0 | 0 | 81 | 29.40 | |
| 17 | 30 | 1 | 4 | 31 | 3 | 1 | 0 | 0 | 87 | 29.58 | |
| 18 | 29 | 2 | 5 | 33 | 1 | 4 | 0 | 0 | 92 | 29.64 | |
| 13 | 23 | 2 | 3 | 22 | 1 | 3 | 0 | 0 | 67 | 29.48 | |
| 13 | 20 | 4 | 2 | 29 | 1 | 1 | 0 | 0 | 70 | 29.58 | |
| 17 | 25 | 4 | 4 | 26 | 1 | 2 | 0 | 0 | 79 | 29.67 |
| Dataset | Target concept | # neighbor list | Neighbor list |
| Oxford Flowers | Alpine Sea Holly | 10 | Metasequoia, Flor de la Mar, Witch-hazel, Sonchus, Honeysuckle, Flora, Astilbe, Catalpa, Mount Sunflower, Alder |
| Camellia | 10 | Gardenia, Peony, Roselle (plant), Gardenia jasminoides, Azalea, Flora, Floribunda (rose), Cattleya, Alstroemeria aurea, Plumeria | |
| Stanford Dogs | Chesapeake Bay Retriever | 10 | Boykin Spaniel, Irish Terrier, Harrier (dog breed), Dogrel, Leaf Hound, Cocker Spaniel, Labrador, Field Spaniel, Redbone Coonhound, Hound |
| Bluetick | 10 | Scent hound, Plott Hound, American Foxhound, Hound, Dogrel, Brittany Spaniel, Basset Hound, Huckleberry Hound, Beagle, Leaf Hound | |
| Celebrity | Elon Musk | 10 | Jeff Bezos, Mark Bezos, Mark Zuckerberg, Tim Cook, Bill Gates, Steve Jobs, Satya Nadella, Richard Branson, Miguel Bezos, Warren Buffett |
| Anna Kendrick | 10 | Katheryn Winnick, Jenny Lewis, Nicki Clyne, Emma Kenney, Nicole Parker, Danielle Lloyd, Emily Kinney, Hannah Marks, Kyla Kenedy, Vicky McClure |
| Method | Data Preparation + Model Finetune | Image Generation (per sample) | Total Time |
| MACE | 680 | 3.8 | 718 |
| SPM | 6900 | 5.1 | 6951 |
| ESD-x | 540 | 2.2 | 562 |
| ESD-u | 540 | 2.2 | 562 |
| UCE | 0 | 2.3 | 23 |
| RECE | 1440 | 2.4 | 1464 |
| Method | Remove “Van Gogh” | Remove “Kelly McKernan” | ||||||
| LPIPS t (↑) | LPIPS r (↓) | (↓) | (↑) | LPIPS t (↑) | LPIPS r (↓) | (↓) | (↑) | |
| SD v1.4 | - | - | 0.95 | 0.95 | - | - | 0.80 | 0.83 |
| MACE | 0.25 | 0.10 | 0.80 | 0.97 | 0.39 | 0.10 | 0.74 | 0.75 |
| SPM | 0.37 | 0.25 | 0.75 | 0.88 | 0.32 | 0.25 | 0.80 | 0.85 |
| ESD-x | 0.40 | 0.26 | 0.75 | 0.98 | 0.37 | 0.21 | 0.81 | 0.69 |
| ESD-u | 0.35 | 0.24 | 1.0 | 0.98 | 0.30 | 0.27 | 1.0 | 0.72 |
| Method | SD-1.4 | SLD | ESD-u | UCE | RECE | Ours |
| Ring-A-Bell | 83.10 | 66.20 | 69.72 | 33.10 | 13.38 | 29.6 |
Concept Erasure
Concept erasure removes specified knowledge or attributes from models while preserving their ability to perform unrelated tasks.
See all 58 papers