Authors: Zhiqi Zhang, Xinhao Zhong, Yi Sun, Shuoyang Sun, Jiahui Wang, Bin Chen, Shu-Tao Xia, Xuan Wang
Organizations: Jilin University · Harbin Institute of Technology, Shenzhen · Peng Cheng Laboratory · Tsinghua Shenzhen International Graduate School, Tsinghua University · Work done at HITSZ, ITDL Lab.
Text-to-image diffusion models have demonstrated remarkable capabilities in generating high-quality images, yet their tendency to reproduce undesirable concepts, such as NSFW content, copyrighted styles, or specific objects, poses growing concerns for safe and controllable deployment. While existing concept erasure approaches primarily focus on DDPM-based diffusion models and rely on costly fine-tuning, the recent emergence of flow matching models introduces a fundamentally different generative paradigm for which prior methods are not directly applicable. In this paper, we propose Differential Vector Erasure (DVE), a training-free concept erasure method specifically designed for flow matching models. Our key insight is that semantic concepts are implicitly encoded in the directional structure of the velocity field governing the generative flow. Leveraging this observation, we construct a differential vector field that characterizes the directional discrepancy between a target concept and a carefully chosen anchor concept. During inference, DVE selectively removes concept-specific components by projecting the velocity field onto the differential direction, enabling precise concept suppression without affecting irrelevant semantics. Extensive experiments on FLUX demonstrate that DVE consistently outperforms existing baselines on a wide range of concept erasure tasks, including NSFW suppression, artistic style removal, and object erasure, while preserving image quality and diversity. Code is available at https://github.com/zhiqizhang23/DVE.
Figures & tables
Figure 1: DVE enables training-free concept erasure for flow matching models. Our method selectively removes target concepts while preserving irrelevant content, applicable to both T2I generation and FlowEdit-based editing tasks.
Figure 2: Overview of DVE. The left side shows the framework of our method. Given an erasure concept and an anchor concept, compute the differential vector, which is used to correct the velocity vector. The right side shows how projection-based selective correction works in different cases. It shows the situation where γ is 1 and τ is 0.
Figure 3: Generated images from DVE and other baselines which are migrated to Flux. Our method effectively removes various concepts while preserving irrelevant concepts and visual quality. The concepts marked in red are the ones to be erased. For object and style erasure, every three images form a group, representing a sample containing the erasure concept and two samples without it.
Method
Total ↓
CLIP ↑
FID ↓
Flux.1-dev*
605
30.87
21.32
CA (Model-base)*
344
29.05
22.66
CA (Noise-base)*
390
28.73
23.07
ESD*
506
28.44
23.08
UCE*
173
24.56
30.71
MACE*
256
29.52
24.15
Table 1: NSFW content erasure on the I2P dataset. We report total exposed body parts count and image quality metrics on MSCOCO10K. Best results are marked in Bold . The results with * are sourced from EraseAnything Gao et al. (2025a) .
Method
I2P ↓
MMA ↓
Ring16 ↓
Ring38 ↓
Ring77 ↓
P4D ↓
UnDiff ↓
Avg ↓
Flux.1-dev
8.1
30.8
97.9
94.7
95.8
72.8
43.0
18.1
CA (Model-base)
3.2
7.9
57.9
58.9
60.0
38.4
21.1
7.7
ESD
4.6
15.4
61.1
56.8
64.2
47.7
26.8
10.4
EraseAnything
4.7
11.2
58.9
58.9
67.4
40.4
21.8
9.6
Ours
2.4
7.1
5.3
15.8
9.5
17.2
9.9
4.0
Table 2: The ASR against adversarial attack datasets in erasing the concept ’nudity’ . Flux.1-dev is shown as the baseline reference without any erasure applied. Values are in percentages, the % symbol is omitted. Best results are marked in Bold . Our method achieves the best ASR in all datasets.
Figure 6Table 7Figure 8
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
Domain
Erasure Concept
Anchor Concept
Erasure Prompt
Anchor Prompt
NSFW
nudity
dressed
<erasure concept>
<anchor concept>
Object
church
building
<erasure concept>
<anchor concept>
golf ball
ball
English springer
dog
cassette player
electronic device
chain saw
tool
Appendix
Table 8: Details of the erasure concepts we use in different domains, the selected anchor concepts and the formulation of erasure and anchor prompts for different domains. We use the generalized concept of the erasure concept as the anchor concept.
Task
Domain
γ
τ
nmax
nmin
T2I
NSFW
3.0
-15
-
-
Object
3.0
-15
-
-
Style
3.0
-15
-
-
Edit
NSFW
3.0
0
24
0
Object
3.0
0
24
0
Style
3.0
0
24
18
Appendix
Table 9: Details on hyper-parameters, including erasure strength γ and threshold τ for projection-based selective correction for different tasks.
Figure 6: Additional visualization results for nudity erasure on each adversarial attack dataset.
Method
Total ↓
CLIP ↑
FID ↓
w/o unlearn
605
30.85
115.27
SAFREE
440
28.61
113.73
GLoCE
512
30.42
115.95
Negative Prompt
163
29.85
116.12
SLD (Hyp-Max)
362
31.61
113.82
SLD (Hyp-Ultra)
512
30.19
112.15
Appendix
Table 10: Comparison with inference-time methods on NSFW erasure. We report total exposed body parts count on I2P4703 and image quality metrics on MSCOCO480. Best results are marked in Bold .
Method
UA(%) ↓
IRA(%) ↑
CLIP ↑
FID ↓
w/o unlearn
88.3
30.85
115.27
Negative Prompt
82.9
71.7
30.05
120.66
DVE
3.3
86.3
30.43
112.63
Appendix
Table 11: Comparison with negative prompt on object erasure. Best results among unlearning methods are marked in Bold .
Figure 7: Additional visualization results for more inference-time concept erasure methods originally designed for diffusion models.
Concept
ACC
UA ↓
IRA ↑
Flux.1-dev
CA(M)
ESD
EA
Ours
CA(M)
ESD
EA
Ours
church
.70
.25
.15
.80
.00
.80
.78
.88
.84
golf ball
1.00
.15
.30
.15
.05
.85
.77
.83
.88
English springer
.65
.00
.05
.05
.00
.87
.90
.83
.89
cassette player
.30
.00
.10
.00
.00
.87
.93
.94
.90
chain saw
1.00
.00
.00
.00
.05
.85
.84
.82
.82
Appendix
Table 12: Per-concept UA and IRA for object erasure. Best results are marked in Bold . DVE achieves complete erasure on seven of these concepts.
Concepts
ACC
UA ↓
IRA ↑
Flux.1-dev
CA(M)
ESD
EA
Ours
CA(M)
ESD
EA
Ours
church + golf ball + English springer
.78
.05
.18
.10
.03
.67
.73
.64
.80
golf ball + English springer + cassette player
.65
.03
.30
.12
.00
.74
.78
.68
.86
English springer + cassette player + chain saw
.65
.00
.02
.10
.05
.84
.87
.76
.73
cassette player + chain saw + French horn
.77
.00
.25
.37
.03
.77
.84
.71
.61
chain saw + French horn + garbage truck
1.00
.00
.25
.30
.07
.72
.71
.50
.64
Appendix
Table 13: Per-multi-concepts UA and IRA for 3-concept object erasure. Best results are marked in Bold .
Figure 8: Additional visualization results for object erasure across erasure concepts and prompts used for generation. The image enclosed in the red box is the image containing the concept to be erased.
Figure 9: Additional visualization results for artist style erasure. The image enclosed in the red box is the image containing the concept to be erased.
Figure 10: Additional visualization results about the ablation study of impact of erasure strength and threshold.
Method
UA(%) ↓
IRA(%) ↑
CLIP ↑
FID ↓
w/o unlearn
88.3
30.85
115.27
Human select
3.3
86.3
30.43
112.63
LLM generate
6.7
85.9
30.43
112.55
Appendix
Table 14: Comparison of human-selected and LLM-generated anchor concepts on object erasure. Best results among unlearning methods are marked in Bold .
EraPmt
AncPmt
ACC
MSCOCO480
chur.
g.b.
e.s.
c.p.
c.s.
f.h.
g.t.
g.p.
para.
bana.
s.c.
goose
CLIP ↑
FID ↓
-
-
.70
1.00
.65
.30
1.00
1.00
1.00
1.00
.95
1.00
1.00
1.00
30.85
115.27
church
temple
.10
1.00
.70
.20
1.00
1.00
.95
1.00
1.00
.85
.90
1.00
30.50
109.58
golf ball
ball
.75
.05
.85
.15
1.00
1.00
1.00
1.00
.95
.95
1.00
1.00
30.37
111.04
English springer
cat
.80
1.00
.00
.20
1.00
1.00
.95
1.00
.95
.65
1.00
1.00
30.69
114.70
cassette player
audio player
.60
1.00
.60
.05
.95
1.00
.75
.95
.90
1.00
1.00
1.00
30.71
114.48
Appendix
Table 15: Per-concept erasure results with LLM-generated anchor concepts. Each row corresponds to erasing one concept (EraPmt) with the LLM-generated anchor (AncPmt). UA results are marked in Bold .
Method
Total ↓
CLIP ↑
FID ↓
w/o unlearn
277
31.85
22.94
γ=3,τ=−15
77
31.66
21.03
γ=3,τ=0
41
31.30
19.66
γ=2,τ=0
79
31.71
21.14
Appendix
Table 16: Hyperparameter ablation on SD3.5 Medium. The results are tested on I2P4703 and MSCOCO10k datasets. Best results are marked in Bold .
EraConcept
Method
MSCOCO480
MSCOCO10k
CLIP ↑
FID ↓
CLIP ↑
FID ↓
-
w/o unlearn
30.85
115.27
30.87
21.32
nudity
EraseAnything
30.14
117.08
30.24
21.75
DVE
29.95
108.99
30.04
21.70
church
EraseAnything
30.13
114.41
30.02
23.86
DVE
30.12
112.60
30.17
22.17
Appendix
Table 17: Comparison of CLIP and FID on COCO480 and COCO10k across different erasure concepts.
Recent advances in flow matching models have significantly improved text-to-image generation quality, but also introduce growing safety risks due to the generation of harmful or undesirable content. Existing concept erasure methods are either inference-time interventions with limited effectiveness or rely on supervised fine-tuning (SFT), which requires precisely aligned data and struggles with scalability and multi-concept settings. In this paper, we propose FlowErase-RL, the first GRPO-based framework for concept erasure in flow matching models. We reformulate concept erasure as a reward optimization problem and introduce a dynamic dual-path reward mechanism that jointly optimizes (i) a Concept Erasure (CE) reward to suppress target concepts and (ii) a Non-target Space (NS) reward to preserve generative fidelity. The two reward paths are adaptively balanced during training via a performance-driven switching strategy, enabling stable optimization without explicit supervision. Extensive experiments on nudity, object, and artistic style erasure demonstrate that our method achieves state-of-the-art erasure performance while maintaining strong image quality and semantic alignment. Moreover, it exhibits robust resistance to adversarial attacks and scales effectively to multi-concept scenarios. Our results establish a new paradigm for safe and controllable generation in flow matching models.
Yi Sun, Zhiqi Zhang, Xinhao Zhong +5
Harbin Institute of Technology, Shenzhen · Jilin University · Tsinghua Shenzhen International Graduate School, Tsinghua University +2
Recent advances in flow matching models have substantially improved the quality of text-to-image generation, but have also raised increasing safety concerns due to their potential to generate harmful or undesirable content. Existing concept erasure methods for flow matching models predominantly focus on removing individual concepts, while effectively erasing multiple concepts simultaneously remains challenging. We propose FlowErase-OPD, a framework for multi-concept erasure based on on-policy distillation (OPD). Our approach first distills multiple single-concept erased models into a unified LoRA module and introduces Anchored Multi-Teacher Distillation (AMTD), which incorporates a retention teacher to mitigate the trade-off between concept erasure and preservation of generative capabilities. To further improve the coordination of multiple erasure objectives, we develop Adaptive Retention Control (ARC), which dynamically adjusts the sampling frequency and loss weight of each erasure teacher, together with the relative contribution of erasure and retention teachers throughout training. Extensive experiments on nudity, object, and artistic-style erasure demonstrate that FlowErase-OPD consistently improves the trade-off between erasure effectiveness, image quality, and semantic alignment, achieving state-of-the-art performance across diverse multi-concept erasure settings. Furthermore, the resulting models exhibit strong robustness against adversarial attacks. These results highlight the potential of on-policy distillation as a principled framework for safe and controllable generation in flow matching models.
Yi Sun, Yimin Zhou, Xinhao Zhong +3
Harbin Institute of Technology, Shenzhen · Tsinghua Shenzhen International Graduate School, Tsinghua University · Peng Cheng Laboratory
Concept erasure removes harmful, private, or copyrighted concepts from text-to-image models while preserving their other abilities. Leading models such as FLUX and Stable Diffusion 3 are trained with flow matching, and erasure methods for them fine-tune the model toward a guided teacher's velocities under a Euclidean loss. Yet the squared distance is only one member of a larger family: Bregman divergences are exactly the losses under which flow matching recovers the correct velocity field, and each member shapes differently what is erased and what is preserved. We introduce BEM (Bregman erasure matching), which is, to our knowledge, the first to learn this divergence through bi-level optimization, so that the fine-tuned model forgets the concept on unseen prompts while its unrelated generations stay unchanged. In the experiments we target the suppression of nudity, violence, real identities, and copyrighted characters. Under the evaluation protocol of GEM, BEM removes more of the concept than GEM on most settings, cutting the unsafe rate on bloody gore from 53.9% to 14.4% and the FID on nudity from 8.64 to 6.64, while retention holds on some concepts and degrades on others.
Mohamed-Hicham Leghettas, Markus Püschel
Department of Computer Science, ETH Zurich, Switzerland