Papers › Semantic Surgery: Zero-Shot Concept Erasure in Diffusion Models

Semantic Surgery: Zero-Shot Concept Erasure in Diffusion Models

26 Oct 2025NeurIPSarXiv:2510.22851added by Syntology

Lexiang Xiong, Chengyu Liu, Jingwen Ye, Yan Liu, Yuecong Xu

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

Concept erasure in text-to-image diffusion models is crucial for mitigating harmful content, yet existing methods often compromise generative quality. We introduce Semantic Surgery, a novel training-free, zero-shot framework for concept erasure that operates directly on text embeddings before the diffusion process. It dynamically estimates the presence of target concepts in a prompt and performs a calibrated vector subtraction to neutralize their influence at the source, enhancing both erasure completeness and locality. The framework includes a Co-Occurrence Encoding module for robust multi-concept erasure and a visual feedback loop to address latent concept persistence. As a training-free method, Semantic Surgery adapts dynamically to each prompt, ensuring precise interventions. Extensive experiments on object, explicit content, artistic style, and multi-celebrity erasure tasks show our method significantly outperforms state-of-the-art approaches. We achieve superior completeness and robustness while preserving locality and image quality (e.g., 93.58 H-score in object erasure, reducing explicit content to just 1 instance, and 8.09 H_a in style erasure with no quality degradation). This robustness also allows our framework to function as a built-in threat detection system, offering a practical solution for safer text-to-image generation.

PaperPDFCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2510.22851")

Code

Syntology Ran 0 of 19 code samples harvested from 1 repository linked to this paper; 19 have no recorded run.

By repository: found in paper text by Syntology: 19 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Lexiang-Xiong/Semantic-Surgery found in paper text by SyntologyMIT report

Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

19 samples harvested; 0 ran; 0 honoured the contract we drafted; 19 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

19unverified

Licence: 0 of the 19 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from Lexiang-Xiong/Semantic-Surgery. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

cache_path Lexiang-Xiong/Semantic-Surgery/evaluation/eval_ASR.py found in paper text by Syntology unverified MIT (permissive) · f4ead451d398bd73 · report
compute_similarity Lexiang-Xiong/Semantic-Surgery/src/utils.py found in paper text by Syntology unverified MIT (permissive) · 31d9b92035c79e97 · report
concurrent_detection Lexiang-Xiong/Semantic-Surgery/evaluation/eval_aod.py found in paper text by Syntology unverified MIT (permissive) · 78f09e32d34ed9f9 · report
detect_AOD Lexiang-Xiong/Semantic-Surgery/src/detection_aod.py found in paper text by Syntology unverified MIT (permissive) · bbb4939397081666 · report
draw_boxes_and_save Lexiang-Xiong/Semantic-Surgery/evaluation/eval_aod.py found in paper text by Syntology unverified MIT (permissive) · d7478f40ee9494e2 · report
extract_celebrity_name Lexiang-Xiong/Semantic-Surgery/evaluation/eval_gcd.py found in paper text by Syntology unverified MIT (permissive) · bd1f73e052a52c82 · report
file_hash Lexiang-Xiong/Semantic-Surgery/evaluation/eval_ASR.py found in paper text by Syntology unverified MIT (permissive) · 2a745b1635a32599 · report
get_cache_file_path Lexiang-Xiong/Semantic-Surgery/evaluation/eval_nudity.py found in paper text by Syntology unverified MIT (permissive) · 14b4b6b059bebe6b · report
get_concept_detected_with_owlvit Lexiang-Xiong/Semantic-Surgery/evaluation/eval_owl_vit.py found in paper text by Syntology unverified MIT (permissive) · 74bd6e7cc65d3067 · report
get_file_hash Lexiang-Xiong/Semantic-Surgery/evaluation/eval_nudity.py found in paper text by Syntology unverified MIT (permissive) · 4dd56ebd3bab6032 · report
get_selected_alpha Lexiang-Xiong/Semantic-Surgery/src/utils.py found in paper text by Syntology unverified MIT (permissive) · 7d98b0ac8d4019eb · report
image_to_bytes Lexiang-Xiong/Semantic-Surgery/src/detection_aod.py found in paper text by Syntology unverified MIT (permissive) · 18ef7add7df1433c · report
load_cache Lexiang-Xiong/Semantic-Surgery/evaluation/eval_ASR.py found in paper text by Syntology unverified MIT (permissive) · f934c875a6a07f36 · report
load_cache Lexiang-Xiong/Semantic-Surgery/evaluation/eval_nudity.py found in paper text by Syntology unverified MIT (permissive) · 333c2209ff5831ac · report
load_detector Lexiang-Xiong/Semantic-Surgery/src/Inference_cli.py found in paper text by Syntology unverified MIT (permissive) · 5062c88d8f92da72 · report
parse_specify Lexiang-Xiong/Semantic-Surgery/src/SS_inference.py found in paper text by Syntology unverified MIT (permissive) · 24270e828641d37e · report
read_checkpoint Lexiang-Xiong/Semantic-Surgery/src/SS_inference.py found in paper text by Syntology unverified MIT (permissive) · 3043f283bc83b29d · report
safe_single_detection Lexiang-Xiong/Semantic-Surgery/evaluation/eval_aod.py found in paper text by Syntology unverified MIT (permissive) · 0e5bae723bce679d · report
sigmoid_kernel Lexiang-Xiong/Semantic-Surgery/src/utils.py found in paper text by Syntology unverified MIT (permissive) · e3273240409a3942 · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2510.22851, was issued in October 2025, after that date, so the archive has no leaderboard rows for it.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections