Text-to-image diffusion models can generate harmful or sensitive content, such as pornographic or violent imagery, raising serious security concerns. Model editing has recently emerged as an efficient approach to mitigate this issue. It modifies pretrained models with minimal parameter updates to alter specific concepts while preserving overall model capabilities. However, due to the entangled representations of different concepts in diffusion models, direct modifications inevitably disrupt non-target concepts. Meanwhile, U-Net's hierarchical heterogeneity hinders unified strategies from balancing erasure and quality. To address these issues, we propose Hierarchical Orthogonal Subspace Erasure (HOSE). This method projects parameter updates into the subspace orthogonal to general knowledge, thereby eliminating interference with non-target concepts. Considering the hierarchical heterogeneity of the U-Net architecture, we further propose a hierarchical adaptive mechanism, constructing differentiated subspace projections for different layers to precisely adapt to the model's hierarchical structure, thereby resolving the inherent trade-off between erasure and image quality in unified constraints. Experimental results demonstrate the proposed method reduces harmful content generation by 80% compared with the unedited model. While it inevitably incurs some image quality degradation, it still outperforms other editing-based baselines in terms of quality preservation, and achieves a significantly better trade-off between harmful content suppression and quality loss than these baselines. Notably, our approach demonstrates higher adversarial robustness than existing SOTA method, indicating that the target concepts have been more thoroughly erased. The source code is publicly available at https://github.com/sevenqiiu/HOSE.
Figures & tables
Fig. 1: Visual comparison of concept erasure results. Compared with the UCE-edited model, the proposed HOSE method effectively removes harmful concepts while preserving image quality and benign concepts.
Fig. 2: Overview of the proposed HOSE based safety alignment framework, including hierarchical grouping, orthogonal projection, and constrained updating for harmful concept erasure and benign concept preservation.
Fig. 4: Qualitative Evaluation of Erasure Tasks. Visual comparison of (a) harmful concept erasure for safety alignment and (b) ”Van Gogh” style removal. Our method effectively eliminates target concepts while preserving the surrounding semantic and structural integrity.
Unsafe Concept Detection (NudeNet Counts & %HARM)
COCO caption
Methods
Gen(F)
Gen(M)
Br(F)
Br(M)
Anus
Belly
Butt
Arm
Feet
Total ↓
%HARM ↓
CS ↑
LPIPS ↓
FID ↓
SD v1.4
9
4
236
42
0
96
36
123
14
560
3.86%
26.38
-
32.57
ESD
2
2
28
22
0
31
20
36
6
147
3.49%
25.18
0.38
45.22
SDD
1
3
39
16
1
41
21
30
4
156
1.96%
24.68
0.48
43.32
UCE
3
1
38
19
0
38
23
29
8
159
1.82%
23.98
0.61
38.60
RECE
2
1
20
14
0
25
13
15
8
98
1.49%
24.85
0.58
40.37
TABLE I: Quantitative results on I2P (Erasure) and COCO caption (Preservation). We report the number of nude body parts detected by NudeNet (threshold 0.7) and %HARM. Bold / Underlined denote best/second-best. ( Gen : Genitalia, Br : Breasts, Butt : Buttocks, Arm : Armpits. F: Female, M: Male)
Attack
Methods
Gen(F)
Gen(M)
Br(F)
Br(M)
Anus
Belly
Butt
Arm
Feet
Total ↓
%HARM ↓
Ring-on-Bell
SD v1.4
3
0
59
28
0
62
3
68
8
231
44.4%
ESD
0
0
13
9
0
6
1
15
2
46
36.4%
SDD
0
0
10
14
0
4
2
11
3
44
26.0%
UCE
1
0
26
16
0
16
1
8
5
73
13.6%
RECE
0
0
4
6
0
9
1
3
3
26
11.0%
SPEED
0
0
15
2
0
18
1
4
2
42
22.2%
TABLE II: Evaluation of robustness against adversarial attacks. We report NudeNet detection counts for specific body parts. Bold / Underlined denote best/second-best. Our method consistently shows strong adversarial resistance. ( Gen : Genitalia, Br : Breasts, Butt : Buttocks, Arm : Armpits. F: Female, M: Male)
Erasure
Preservation
Methods
CLIP Score ↓
LPIPS ↑
CLIP Score ↑
LPIPS ↓
SD v1.4
27.89
-
27.60
-
ESD
25.76
0.68
25.88
0.45
SDD
25.08
0.72
23.35
0.44
UCE
26.33
0.44
26.35
0.41
RECE
25.39
0.71
26.53
0.44
TABLE III: Quantitative results for Van Gogh style erasure. Bold / Underlined denote best/second-best.
Target Concept Erased
Evaluated Class
English Springer
Cassette Player
Church
Parachute
Tench
English Springer
83.33
5.55
2.78
-2.78
2.78
Cassette Player
0.00
55.60
2.78
0.00
11.11
Church
0.00
2.78
90.11
2.78
11.11
Parachute
-2.77
2.78
2.78
97.22
2.78
Tench
2.78
5.56
2.78
2.78
63.89
TABLE IV: Object detection rate drop (%). Higher diagonal values indicate successful target erasure, while lower off-diagonal values reflect better preservation of unrelated classes.
Fig. 5: Qualitative comparison of object erasure results while preserving non-target visual content.
NudeNet Counts (I2P)
COCO Metrics
Settings
Gen(F)
Gen(M)
Br(F)
Br(M)
Anus
Belly
Butt
Arm
Feet
Total ↓
CS ↑
LPIPS ↓
FID ↓
SD v1.4
9
4
236
42
0
96
36
123
14
560
26.38
-
32.57
w/o H.& O.
3
1
38
19
0
38
23
29
8
159
23.98
0.61
38.60
w/o H.
2
2
30
5
0
38
11
18
3
109
25.98
0.40
37.82
Uniform ( εshallow )
6
1
74
1
0
62
9
10
15
178
26.20
0.35
31.26
Uniform ( εdeep )
1
2
21
3
0
10
1
12
4
54
25.25
0.46
40.28
TABLE V: Ablation study and comparison of constraint strategies, including uniform, per-layer, and our tripartite design, results show the trade-off between nudity content removal and image quality. (w/o H.& O.: w/o Hierarchical & Orthogonal. w/o H.: w/o Hierarchical. Uniform ( εshallow) : with shallow constraint. Uniform ( εdeep) : with deep constraint.)
Fig. 6: Comparative visualization of layer-wise activation distributions.
Fig. 7: Cross-attention on the feature distributions of different concepts across different layers.
Fig. 8: Visual comparison of the effects of different constraint strategies in the ablation study.
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
Fig. 9: Comparison of latent MSE values under layer-wise noise injection.
Fig. 10: Nudity detection performance under eigenvalue threshold variations
Method
Paradigm
One-time Prep.
Erase Latency
ESD
Fine-tuning
None
197 min
SDD
Fine-tuning
None
213 min
UCE
Model Editing
None
42 s
RECE
Model Editing
None
3 min
SPEED
Model Editing
180 min
20 s
Ours
Model Editing
183 min
5 s
Appendix
TABLE VI: Comparison of concept erasure time among different methods.
Threshold = 0.5
Methods
Genitalia (F/M)
Genita
Breasts (F)
Breasts (M)
Anus
Belly
Buttocks
Armpits
Feet
Total
SD V1.4
24
21
216
50
0
201
58
262
78
910
ESD
11
9
76
28
0
80
32
100
72
408
SDD
23
11
68
37
0
101
25
97
60
422
UCE
6
17
70
22
0
98
30
94
58
395
RECE
25
0
103
22
0
96
14
115
47
422
Appendix
TABLE VII: NSFW detection statistics under different NudeNet confidence thresholds
Fig. 11: Zoomed-in local texture artifacts when erasing the cassette player.
Body Region
Original SD Baseline
HOSE
Paired t -test
Mean
SD
95% CI [Low, Up]
Mean
SD
95% CI [Low, Up]
t -stat
p -value
Genitalia
6.50
0.00
[6.50, 6.50]
1.10
0.22
[0.83, 1.37]
54.80
4.5×10−5
Chest & Breast
139.00
0.00
[139.00, 139.00]
28.50
1.93
[26.10, 30.90]
113.03
0
Gluteal Region
36.00
0.00
[36.00, 36.00]
5.60
0.89
[4.49, 6.71]
76.00
0
Other Body Parts
77.67
0.00
[77.67, 77.67]
17.47
1.56
[15.53, 19.41]
85.74
1.0×10−5
Appendix
TABLE VIII: Statistical significance tests and confidence intervals for body-part exposure results over five runs. Lower values indicate better safety erasure. Paired t -tests compare HOSE with the original SD baseline under matched settings ( df=4 ).