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 View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 19 code samples harvested from 1 repository linked to this paper: 17 ran (of which 0 constructed an object rather than computing a result; 5 with no instrument failure: 1 honoured, 0 violated, 4 with no contract checked; 12 where Syntology's instrument failed) · 2 unverified. Where Syntology's instrument failed: 11 where our contract draft was wrong; 1 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: found in paper text by Syntology: 19 samples from 1 repository, 17 ran (5 with no instrument failure; 12 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-25 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

Lexiang-Xiong/Semantic-Surgery found in paper text by SyntologyMITSyntology: 19 samples, 17 ran (12 instrument-failed) · 2 unverified 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: 17 ran (of which 0 constructed an object rather than computing a result; 5 with no instrument failure: 1 honoured, 0 violated, 4 with no contract checked; 12 where Syntology's instrument failed) · 2 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

1ran · honoured contract
11ran · our draft was wrong
1ran; the contract check could not run
4ran
2unverified

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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity.

Lexiang-Xiong/Semantic-Surgery found in paper text by Syntology 19 samples, 17 ran (12 instrument-failed) · 2 unverified
cache_path in 5 papers evaluation/eval_ASR.py ran · our draft was wrong fingerprinted MIT (permissive) · f4ead451d398bd73 · report fixture: signature folder:str/0/str · returned str · level recorded 2026-09-25
compute_similarity in 16 papers src/utils.py ran · our draft was wrong fingerprinted MIT (permissive) · 31d9b92035c79e97 · report fixture: signature embedding1:Tensor/3/float, embedding2:Tensor/3/float · returned Tensor · level recorded 2026-09-25
detect_AOD src/detection_aod.py ran MIT (permissive) · bbb4939397081666 · report fixture: signature img:BytesIO/0/?, concept:str/0/str, api_key:str/0/str, url:str/0/str · returned int · level recorded 2026-09-25
draw_boxes_and_save evaluation/eval_aod.py ran MIT (permissive) · d7478f40ee9494e2 · report fixture: signature image_path:str/0/str, result:dict/0/?, save_path:str/0/str, font_scale:float/0/float, thickness:int/0/int, color_map:dict/0/? · returned ndarray · level recorded 2026-09-25
extract_celebrity_name evaluation/eval_gcd.py ran · our draft was wrong MIT (permissive) · bd1f73e052a52c82 · report fixture: signature text:str/0/str · returned str · level recorded 2026-09-25
file_hash evaluation/eval_ASR.py ran · our draft was wrong MIT (permissive) · 2a745b1635a32599 · report fixture: signature path:str/0/str · returned str · level recorded 2026-09-25
get_cache_file_path evaluation/eval_nudity.py ran · our draft was wrong fingerprinted MIT (permissive) · 14b4b6b059bebe6b · report fixture: signature folder_path:str/0/str, cache_file_name:str/0/str · returned str · level recorded 2026-09-25
get_concept_detected_with_owlvit evaluation/eval_owl_vit.py ran MIT (permissive) · 74bd6e7cc65d3067 · report fixture: signature image_path:str/0/str, concept:str/0/str, device:str/0/str, score_threshold:float/0/float · returned bool · level recorded 2026-09-25
get_file_hash in 5 papers evaluation/eval_nudity.py ran · our draft was wrong MIT (permissive) · 4dd56ebd3bab6032 · report fixture: signature file_path:str/0/str · returned str · level recorded 2026-09-25
get_selected_alpha src/utils.py ran · our draft was wrong MIT (permissive) · 7d98b0ac8d4019eb · report fixture: signature alphas_raw:list/1/Tensor, th:float/0/float · returned tuple · level recorded 2026-09-25
image_to_bytes src/detection_aod.py ran · our draft was wrong MIT (permissive) · 18ef7add7df1433c · report fixture: signature img:Image/0/?, format:str/0/str · returned bytes · level recorded 2026-09-25
load_cache in 13 papers evaluation/eval_ASR.py ran · our draft was wrong fingerprinted MIT (permissive) · f934c875a6a07f36 · report fixture: signature folder:str/0/str · returned dict · level recorded 2026-09-25
load_cache in 13 papers evaluation/eval_nudity.py ran · our draft was wrong fingerprinted MIT (permissive) · 333c2209ff5831ac · report fixture: signature cache_file_path:str/0/str · returned dict · level recorded 2026-09-25
load_detector src/Inference_cli.py ran; the contract check could not run (DEP_MISSING) MIT (permissive) · 5062c88d8f92da72 · report fixture: signature detector_config:dict/0/? · returned MockNudeDetection · level recorded 2026-09-25
parse_specify src/SS_inference.py ran · our draft was wrong MIT (permissive) · 24270e828641d37e · report fixture: signature specify_classes:str/0/str · returned dict · level recorded 2026-09-25
read_checkpoint src/SS_inference.py ran · honoured contract fingerprinted MIT (permissive) · 3043f283bc83b29d · report fixture: signature folder:str/0/str · returned int · level recorded 2026-09-25
sigmoid_kernel src/utils.py ran fingerprinted MIT (permissive) · e3273240409a3942 · report fixture: signature similarity:Tensor/2/float, gamma:Tensor/0/float, bias:Tensor/0/float · returned Tensor · level recorded 2026-09-25
concurrent_detection evaluation/eval_aod.py unverified MIT (permissive) · 78f09e32d34ed9f9 · report
safe_single_detection evaluation/eval_aod.py unverified MIT (permissive) · 0e5bae723bce679d · 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.

Placed on leaderboards by Syntology Syntology

Syntology's extractor, the model Claude Sonnet 4.5, judged this paper's tables to report on 1 leaderboard (a model's judgement, not a result) and has not placed the paper on it: Text-to-Image Generation · COCO (Common Objects in Context) (rejected by the independent check). What is not shown.

Syntology has checked 8,886 of the 18,637 papers on this site that are newer than the archive (for 3,717 of them no archive leaderboard matched the paper's tables, so there was nothing further to check); 733 were read and have nothing to place (arXiv has no HTML version of the paper, or that version has no tables), 41 could not be read (the extractor's reply could not be parsed), and results from the other 8,977 appear after they are checked.

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