OPSD-Erase: On-policy concept erasure for text-to-image modelsOPSD-Erase: On-Policy Concept Erasure for Text-to-Image Generative Models
The authors propose OPSD-Erase, which erases concepts along the sampling trajectory on SD1.4 and Z-Image; the authors claim it balances suppression of unsafe content with benign generation.
Open-weight text-to-image deployment: defenders can edit parameters before release; after release, attackers can independently deploy and query the model, inducing unsafe concepts through text prompts and rewrites, but without modifying model parameters; post-release fine-tuning is excluded.
- After open-weight text-to-image models are released, external filtering and inference-time guidance can be removed; the authors argue that existing weight editing also suffers from inconsistency between the training state and the actual sampling state, leading to incomplete concept erasure.
- OPSD-Erase has the current student sample from noise, and on the states it visits, aligns the one-step reverse update of the erasure condition to the frozen reference model's safe target condition, while using anchor conditions to preserve benign generation.
- The experiments cover SD1.4 and Z-Image, as well as wording changes, multi-concept and sequential erasure. The authors report that OPSD-Erase reduces unsafe rate across multiple groups while preserving benign utility; after Z-Image's ten-concept joint erasure, the occurrence of each concept is 0.00.
- The authors note that the method depends on the choice of safe targets and anchors, evaluates only text prompts, requires repeated sampling for training, and cannot guarantee that a concept will never appear. The experiments do not report the training iteration budget, the number of random repetitions, or the agreement between detectors and human judgment.
The paper proposes OPSD-Erase, an on-policy concept erasure framework that suppresses unsafe content generation in open-weight text-to-image models by editing weights. The authors point out shortcomings of existing defenses: external detection modules and inference-time guidance can be removed after weights are released, while closed-form editing and fine-tuning-based erasure train on states different from those visited by sampling from the edited model, causing train-inference mismatch and incomplete erasure. OPSD-Erase treats text-to-image generation as a unified reverse process, trains on states visited by student model sampling, uses a frozen reference model to provide a safe one-step target, and preserves benign generation capability via anchoring conditions. Experiments on SD1.4 and Z-Image show the method more reliably suppresses unsafe concept generation while preserving benign uses, and remains robust under wording variations, multi-concept erasure and sequential erasure.
Related events and news
1 events · 0 news mentions
- This event's paper
OPSD-Erase:面向文生图模型的在策略概念擦除
Paper analysis
What problem does this paper attempt to solve?
For open-weight text-to-image models, the authors redefine concept erasure as one-step reverse update alignment on the actual sampling trajectory.
Core question: how to persistently erase unsafe concepts after model weights are made public, while preserving benign generation capability.
- Open deployment risk: The authors argue that after weight release, users can run the model locally, remove peripheral safety components and search for inducing prompts, so safety cannot rely only on a hosted pipeline.
- Shortcomings of existing methods: External detection and inference-time guidance can be omitted by attackers; closed-form editing and existing fine-tuning-based erasure typically optimize on a training state different from the post-edit model's sampling state, which the authors call training–inference inconsistency.
- Core observation and hypothesis: Both diffusion and flow-matching models can be viewed as repeatedly executing a one-step reverse update. The authors hypothesize that only by aligning the updates under the erasure condition and the safe target condition at states visited by the model's own rollout can residual erasure error be reduced.
- Proposed approach: The paper proposes OPSD-Erase, trajectory-level probes and three layers of experiments, examining update alignment, unsafe concept suppression and benign utility, wording variation, and multi-concept and sequential erasure, respectively.
- Threat model (Sec. 4.2):
- Goal: The attacker induces unsafe concepts such as sexual content, violence, self-harm, hate or harassment, and illegal content through text prompts.
- Knowledge and capability: After weights are public, the model can be independently deployed and queried, and the attacker can use rewording, contextual composition or out-of-distribution wording.
- Boundary: The attacker does not modify the released parameters; the paper excludes post-release fine-tuning.
- Victim system and defense objective: An open-weight text-to-image sampler; the defender can only edit parameters before release and must balance erasure and benign utility.
What related research exists?
Related work is divided into out-of-model safety, weight-level concept erasure and on-policy post-training; this paper positions itself at the combination of the last line of thought with weight erasure.
Model-external safety and text-to-image generation
- Prompt and output detection: Markov et al. (2023), GuardT2I (2024), Latent Guard (2024) check requests or text embeddings before sampling; classifiers such as the Stable Diffusion safety filter and Q16 check output images.
- Inference-time guidance: Safe Latent Diffusion (2023) and SAFREE (2025) add safety terms during sampling without changing weights. The paper notes that such methods depend on the safety pipeline remaining in place, and can be removed once weights are open.
- Unified generation abstraction: The paper builds on latent diffusion, diffusion models and flow matching, unifying different parameterizations and solvers as a sampling process that starts from noise and repeatedly performs reverse updates.
Weight-level concept erasure
- Fine-tuning erasure: ESD (2023), CA (2023), SPM (2024), SafeGEN (2024), TRCE (2025) and others update the generative network, often acting on attention layers or small adapters; AdvUnlearn (2024) instead adversarially fine-tunes the text encoder.
- Closed-form and multi-concept editing: UCE (2024) directly rewrites attention parameters; MACE (2024) and RECE (2024) target multi-concept removal, and can be iterative or combined with low-rank updates.
- Difference of this paper: The authors place themselves in the weight-editing line, but emphasize focusing on the behavior of the deployed sampler on the states it actually visits, rather than only making static parameter modifications.
On-policy post-training
- Sequential decision-making and distillation: Dataset Aggregation reduces training–test state mismatch by rolling out the learner and labeling the states it actually reaches; PPO repeatedly samples from the current policy; recent language model distillation also provides supervision on sequences generated by the student.
- Generative model post-training: DiffusionOPD and D-OPSD evaluate the teacher on latent states visited by the current student; Flow-GRPO and DiffusionNFT sample from the current generator for online optimization; consistency distillation is mainly aimed at acceleration.
- Positioning of this paper: The authors state that OPSD-Erase is close to on-policy post-training, but uses the output of a frozen pretrained generator under the safe target condition as reference, and jointly distills anchor to preserve benign utility.
Experimental baselines and benchmarks
- SD1.4: Table 1 compares SLD, Safree, ESD, SPM, UCE, SafeGEN, RECE, MACE, AdvUnlearn, TRCE, using I2P, MMA, P4D, Ring, UnDiff; Table 3 additionally conducts I2P broad NSFW evaluation.
- Z-Image: ESD-style and DVE are used for comparison, with I2P and DPG, GenEval, PickScore, CLIP-Score, HPSv2; the paper states that some old methods cannot be directly ported, so the implementation follows architecture-compatible variants of their core optimization principles.
How does the paper address this problem?
OPSD-Erase performs safe-target distillation on the student's own sampling states, and uses anchor distillation to constrain behavior on non-erasure prompts.
OPSD-Erase divides each training step into a current student rollout and one-step supervision from a frozen reference: erasure requests are redirected to a specified safe behavior, while anchor requests that do not request erasure of the concept are kept as close as possible to the original model's behavior.
Problem formulation and defense objective
- Let c1 be the erasure condition, c2 the safe target condition, and c3 the anchor condition that does not request erasure of the concept. The defender edits parameters before release, and after release only an independently runnable sampler remains.
- For states actually visited during sampling, ideal erasure requires that the one-step reverse transition under c1 be the same as under c2; since the post-erasure target behavior cannot be obtained directly before training, the paper uses the transition of the frozen pretrained reference under c2 as the target.
- This definition applies to both stochastic and deterministic reverse processes; for deterministic sampling, the one-step update is matched directly rather than relying on any fixed training state.
Erasure and preservation objectives
- In the stochastic case, the paper writes the student's and reference's one-step transitions as Gaussians with the same covariance, whose KL divergence reduces to the mean difference, so supervision falls between the two one-step reverse updates.
- In the deterministic case, the core erasure objective is LeraseODE(θ)=E[∑j1/2|μθ(xtj,tj,tj+1,c1)−μref(xtj,tj,tj+1,c2)|22], where the states come from the student's rollout under c1.
- For anchor samples, the student matches the reference's update under the same c3 under c3. The total objective is written as Ltotal=LeraseODE+λpresLpreserveODE; in the implementation, preservation strength is controlled by mixing erasure pairs and anchor pairs, rather than explicitly computing the two expectations in the same minibatch and then weighting them.
Solver instantiation and training procedure
- For diffusion models using ε-prediction, the paper constructs the student's and reference's one-step updates using the DDIM update; for flow-matching models, it constructs the corresponding terms using the Euler update of the velocity field.
- Each round samples erasure pairs (c1,c2) and anchor pairs (c3,c3), completes a mixed-batch rollout from noise and saves the trajectory, then accumulates the squared one-step update error at each saved state and updates the student.
- Each optimization stage treats the visited states as fixed training samples and supervises only the current one-step update, without backpropagating through the entire rollout; the reference is always the fully frozen pretrained model.
Parameterization and prompt construction
- The student is fine-tuned by inserting LoRA adapters into the attention query, key, value, output and other attention projections in the architecture. Training defaults to 10 sampling steps, 512×512, CFG scale 4.
- At evaluation, SD1.4 uses 50 steps, 512×512, scale 7.5; Z-Image uses 40 steps, 1024×1024, scale 4.
- Erasure prompts use a template with the target concept as the subject, and the safe target replaces only the subject concept; anchors come from unrelated benign subjects. Appendix A states that the default rewrite-to-anchor sample ratio is 1:1, and gives the complete construction rules and examples.
Trajectory probes and success determination
- The probes record, under the same initial noise and prompt, the latent distance between the edited model and the pretrained model, as well as the edited model's one-step update error relative to the safe target at visited states.
- In safety evaluation, unsafe rate is the proportion of images judged unsafe by the corresponding detector; for benign prompts, utility metrics applicable to the model family are reported separately. The authors emphasize that erasure is not considered successful if it merely lowers detector hit rates while breaking prompt following.
- Robustness experiments use Qwen2.5-VL-7B-Instruct to identify whether the erased concept still appears in images, using concept occurrence as the erasure metric.
What experiments did the paper conduct?
The experiments cover two types of generative models, five groups of sexual content prompts and I2P broad NSFW, and test wording, multi-concept and sequential erasure.
Experimental Setup
- Models under test: SD1.4 (ε-prediction diffusion model) and Z-Image (velocity-prediction flow-matching model); both are trained with the same on-policy objective.
- Safety prompt sets: Sexual content erasure uses I2P user requests and four groups of optimized adversarial prompts: MMA, P4D, Ring, UnDiff; broad NSFW uses I2P's Hate, Harassment, Violence, Self-harm, Sexual, Shocking, Illegal Activity.
- Judgment method: NudeNet for sexual content, Q16 for broad NSFW; robustness experiments use Qwen2.5-VL-7B-Instruct to judge concept occurrence. The paper does not report detection thresholds or human review.
- Utility metrics: SD1.4 reports FID and CLIP-Score; Z-Image reports DPG, GenEval, PickScore, CLIP-Score, HPSv2; utility evaluation excludes prompts containing erased concepts.
- Training data size: Safety experiments use 2,000 English sexual-content rewrite prompts and 2,360 broad NSFW prompts; robustness experiments use 1,000 English training prompts and 100 ID test prompts per concept.
- OOD samples: Z-Image uses 200 per concept, including 100 English and 100 Chinese; SD1.4, because it does not support Chinese prompts, uses 100 English OOD prompts. The paper does not report the number of random repetitions.
Main Results
The following lists OPSD-Erase and the unedited models; full baselines are in the original tables. Sexual content results are from Table 1 and 2, broad NSFW overall results from Table 3 and 4.
Swipe horizontally to read the table
Model and task Method I2P MMA P4D Ring / UnDiff SD1.4 sexual content unsafe rate SD1.4 34.69% 79.00% 83.44% 59.49% / 57.75% SD1.4 sexual content unsafe rate OPSD-Erase 0.54% 0.60% 1.99% 0.00% / 0.00% Z-Image sexual content unsafe rate Z-Image 10.63% 42.30% 46.36% 41.77% / 17.61% Z-Image sexual content unsafe rate OPSD-Erase 1.07% 0.00% 0.00% 1.27% / 2.81% SD1.4 broad NSFW overall unsafe rate SD1.4 / OPSD-Erase 35.6% / 4.0% — — — Z-Image broad NSFW overall unsafe rate Z-Image / OPSD-Erase 12.2% / 4.1% — — — - SD1.4 sexual content: OPSD-Erase is the lowest in the table on I2P, Ring, UnDiff, and ties with TRCE at 1.99% on P4D; its FID is 27.23 and CLIP-Score is 30.79, versus 27.18 and 30.97 for the unedited model (Table 1).
- Z-Image sexual content: OPSD-Erase is lowest in four of the five groups; UnDiff is 2.81%, higher than DVE's 2.11% aside from ESD-style's 3.52%. Its GenEval is 59.05, versus 61.21 for the unedited model (Table 2).
- Broad NSFW: On SD1.4, OPSD-Erase's overall unsafe rate is 4.0%, lower than the other methods in the table; on Z-Image, ESD-style's overall rate is 1.3%, lower than OPSD-Erase, but its GenEval is 14.48, versus 55.23 for OPSD-Erase and 61.21 for the unedited model (Table 3, 4).
Trajectory-Level Mechanistic Probe
- Measurement target: On SD1.4, CA, UCE, SPM and OPSD-Erase are compared with the pretrained checkpoint, prompt set, initial noise and sampler fixed, recording state shift and one-step update error along the rollout.
- Information visible in Figure 2: Panel (a) has Denoising step on the horizontal axis and Cumulative update error on the vertical axis, ranging from 0 to 50 steps and 0.000 to 0.005; Panel (b) has State shift on the horizontal axis and Update error on the vertical axis. The text conversion does not retain reliably readable endpoint values for each curve.
- Authors' interpretation: The authors state that CA's error grows after the rollout leaves the fixed training support, UCE and SPM retain residual mismatch, while OPSD-Erase maintains lower mismatch on the states it visits; this is a trajectory measurement and the authors' mechanistic explanation, not a separate intervention experiment on the causal effect on final images.
Wording Changes and Multi-Concept Erasure
- Cat-to-dog task: On SD1.4, OPSD-Erase's ID/OOD occurrence is 0.00/0.01, CA is 0.08/0.01; on Z-Image, OPSD-Erase is 0.000/0.005, ESD-style is 0.140/0.520, DVE is 0.200/0.160 (Table 5, 6).
- Ten-concept joint erasure: On Z-Image, OPSD-Erase's occurrence for banana, basketball, candle, cat, motorcycle, snowman, spoon, succulent, umbrella, wine is all 0.00; ESD-style ranges from 0.03 to 0.50 (Table 7).
- Joint erasure utility: OPSD-Erase's DPG, GenEval, PickScore, CLIP, HPSv2 are 86.40, 60.07, 82.32, 28.51, 28.43; ESD-style is 82.85, 15.24, 77.29, 23.44, 24.25 respectively (Table 8).
Sequential Erasure and Exceptions
- Ten consecutive updates: OPSD-Erase-10's occurrence on all ten concepts is 0.00; OPSD-Erase-1 only adds the first concept, and the remaining cells are concepts not yet added to the erasure list (Table 9).
- Utility after sequential updates: OPSD-Erase-10's DPG, GenEval, PickScore, CLIP, HPSv2 are 86.49, 61.58, 82.25, 28.50, 28.18, versus 86.31, 61.21, 82.53, 28.51, 28.68 for unedited Z-Image (Table 10).
- Failure boundary: The authors explicitly state that sufficiently difficult or suggestive prompts may still cause failures; UnDiff in Table 2 and OOD in Table 6 also retain non-zero occurrence or unsafe rate.
Other Ablations and Analyses
- Architecture-compatible variants: Z-Image safety experiments use ESD-style and DVE; the paper does not give results for directly porting all of SD1.4's old methods to Z-Image.
- Training cost analysis: Sec. 9.2 only states that LoRA and shorter training rollouts reduce cost, and does not report training duration, number of queries or compute figures.
- Parameter analysis: The paper does not report numerical ablations of LoRA rank, anchor ratio or λpres.
- Statistical information: The tables do not report confidence intervals, statistical significance tests or variance across multiple runs.
What are some points that can be further explored?
The authors list dependence on safe targets, the text-prompt boundary, training overhead and the lack of formal guarantees, and propose directions for adaptive and multimodal attack evaluation.
Limitations and future directions noted by the authors
- Dependence on safe targets and anchors (Sec. 9.2): The method is not target-free erasure but redirection to a specified safe behavior; an inappropriate choice of safe target may produce unnatural or biased substitute behavior.
- Scope of the threat model (Sec. 9.2): Only text-only prompting is considered; it is not evaluated whether image conditioning, editing pipelines, control modules or downstream agent systems can recover erased content; the authors state that the results should not be interpreted as comprehensive misuse protection.
- Training cost (Sec. 9.2): On-policy supervision requires repeatedly sampling from the current edited model; LoRA and shorter rollouts can reduce cost, but the authors state it is still more expensive than simple off-policy schemes, and no cost figures are given.
- No formal guarantees (Sec. 9.2): There is no guarantee that an erased concept will never appear, and difficult or suggestive prompts may still cause failures; the authors position it as a weight-level intervention rather than a complete safety solution.
- Future directions (Sec. 9.2): The authors propose studying better safe targets and anchors, more efficient on-policy editing, and broader evaluation for adaptive and multimodal attacks.
Scope of experiments
- Models and tasks: The generative models tested are SD1.4 and Z-Image, 2 in total; the safety tasks are sexual content erasure and broad NSFW erasure across the seven I2P categories (Sec. 7).
- Prompts and language: Safety training prompts are in English; the wording variation experiment adds Chinese OOD prompts on Z-Image, while SD1.4 uses only English OOD prompts (Sec. 8, Appendix A).
- Robustness targets: Multi-concept and sequential erasure use ten groups of common visual concepts with explicit safe targets, not ten categories of unsafe concepts; the sequential experiment performs ten consecutive updates (Sec. 8.2–8.3).
- Judgment and samples: Safety results rely on NudeNet and Q16, and concept occurrence relies on Qwen2.5-VL-7B-Instruct; the paper does not report the agreement between these automatic judgments and human judgment.
- Reproduction information: The paper gives sampling steps, resolution, CFG scale and some prompt counts, but does not report the training iteration budget, LoRA rank, optimizer settings, number of random repetitions or significance tests.
Summarize the main content of the paper
The authors use on-policy self-distillation to align actual sampling updates, and report erasure, utility preservation and multi-condition robustness results on two generations of models.
OPSD-Erase is a weight-level concept erasure method for open-weight text-to-image models, addressing the problems that external safety modules can be removed and that the training state of existing edits is inconsistent with the deployment sampling state.
- Problem setting: The defender can only modify parameters before release; the attacker can afterwards independently run the model and change text prompts, but cannot modify parameters or perform post-release fine-tuning. Success requires both reducing realization of unsafe concepts and preserving benign generation.
- Method highlights: The current student rolls out from noise, and at its visited states, the one-step reverse update under the erasure condition c1 is matched to the frozen reference under the safe target condition c2; the anchor condition c3 matches the reference under the same c3. The method uses LoRA fine-tuning and adapts to diffusion and flow-matching models using DDIM and Euler updates, respectively.
- Sexual content results: On SD1.4, OPSD-Erase's unsafe rate on I2P, MMA, P4D, Ring and UnDiff is 0.54%, 0.60%, 1.99%, 0.00% and 0.00%, respectively (Table 1); on Z-Image it is 1.07%, 0.00%, 0.00%, 1.27% and 2.81%, respectively (Table 2).
- Broad NSFW results: The overall I2P unsafe rate drops from 35.6% for the unedited model to 4.0% on SD1.4, and from 12.2% to 4.1% on Z-Image (Tables 3, 4). On Z-Image, the ESD-style overall rate is 1.3%, but GenEval is 14.48, versus 55.23 for OPSD-Erase; the authors use this to argue that detector hit rates alone should not be considered.
- Robustness results: For the Z-Image cat-to-dog task, ID/OOD occurrence is 0.000/0.005 (Table 6); after joint erasure of ten concepts and after ten sequential updates, the occurrence of each concept is 0.00 (Tables 7, 9).
- Authors' conclusions and boundaries: The authors argue that effective erasure depends on maintaining the expected one-step update on the model's own sampling trajectory, and that the same principle can be used across diffusion and flow-matching models. The method still depends on safe targets and anchors, requires additional sampling for training, evaluates only text prompts, and provides no guarantee that a concept will never reappear.
Research lineage
2 foundations · 0 follow-ups in libraryNo later in-library follow-ups recorded yet.
Hover or focus a connected paper to inspect the citation context.