Compositional Concept Erasure in Text-to-Image Diffusion Models via Hierarchically Grounded Semantic Surgery

Chen Dai, Ganyu Zou, Nathan Self, Kevin Piper, Ramachandra Rao Seethiraju, Karthik Shyamsunder, Chang-Tien Lu, Naren RamakrishnanarXiv 2026

TL;DR

Hierarchically Grounded Semantic Surgery (HGSS) is a training-free framework that allows for precise concept erasure in text-to-image diffusion models. By combining hierarchical language reasoning with dynamic attention control, HGSS successfully removes target concepts—even when they are hidden behind specific sub-classes—while preventing "attribute leakage" where colors or textures from the erased object migrate onto the rest of the scene.

What Problem Does This Paper Address?

As text-to-image models like Stable Diffusion become ubiquitous, the ability to remove specific concepts (e.g., copyrighted characters, unsafe content, or specific objects) after deployment is a critical requirement. Existing solutions generally fall into two camps:

  1. Weight-editing: These methods fine-tune the model to "forget" a concept. While effective, they require retraining for every new target and modify the model's weights, which is cumbersome for large-scale deployment.
  2. Training-free (Inference-time): These methods, like Semantic Surgery (SS), intervene during the sampling process by modifying the text conditioning. They are lightweight but often fail on compositional prompts.

The authors identify two major failure modes in current training-free methods:

  • Hierarchical Evasion: If you try to erase "mammal," the model might still generate a "poodle" because the system only looks for the literal word "mammal" and misses its descendants.
  • Attribute Leakage: In a prompt like "a yellow car and a green tree," erasing the "car" might result in the "yellow" attribute migrating to the tree, creating a yellow tree.
Figure 1: Two motivating failures in compositional concept erasure. Top: under erase target “mammal”, prior methods can retain a hierarchical descendant. Bottom: under erase target “car”, ESD can retain the target, while SS removes it but transfers the target attribute to the preserved tree. HGSS removes the target concept while preserving non-target content.

Methods

HGSS introduces two novel modules that act as a "plug-in" for the standard diffusion sampling process without changing a single weight in the U-Net.

1. Hierarchical Span Grounding (The "What")

Instead of relying on simple keyword matching or CLIP similarity, HGSS uses a deterministic cascade to identify what needs to be erased:

  • Lexical & Taxonomic Evidence: It uses WordNet to traverse the hypernym/hyponym graph. If the target is "mammal," it identifies "poodle" as a descendant that must be erased.
  • Guards: To prevent over-erasing, it uses "guards." For example, a "compound-head guard" ensures that "baseball bat" isn't erased just because "bat" is a mammal in WordNet.

2. Dynamic Attribute Binding (The "How")

Once the target is identified, HGSS ensures the rest of the image stays intact. During the first 60% of the denoising steps (where the layout is most malleable), it applies a small gradient correction to the text embeddings:

  • Counterfactual Reference: It creates a version of the prompt where the target span is replaced by a null token to see what the "target-removed" state should look like.
  • Attention Losses: It uses a preserve-binding loss ($L_{bind}$) to keep attributes tied to their original nouns and a leakage-suppression loss ($L_{neg}$) to push the attention of preserved attributes away from the "residue" left by the erased object.
Figure 2: The HGSS pipeline showing the grounding and binding modules.

Datasets

The authors evaluated HGSS across three distinct benchmarks to test different aspects of erasure:

  • SEE (Side Effects of Erasure): A diagnostic benchmark with over 5,000 compositional variants designed to test neighboring impact, hierarchical evasion, and attribute leakage.
  • UnlearnCanvas: A benchmark for style and object unlearning across 70 different targets.
  • I2P (Image-to-Prompt): A standard safety benchmark containing 4,703 prompts across eight "unsafe" body-part classes.

Key Insights and Ideas

  • Erasure as Inverse Composition: The authors treat concept erasure as the inverse objective to compositional generation. Instead of just "deleting" a word, they actively manage how the remaining entities in the prompt bind to their attributes.
  • The Malleability Window: The paper highlights that the early stages of denoising are crucial. By focusing the dynamic updates on the first 60% of iterations, they can steer the image layout without needing to intervene in the later, fine-detail stages.
  • Language Structure Matters: Moving beyond "black-box" embeddings to structured linguistic resources like WordNet provides the precision needed to handle hierarchical relationships that CLIP-based similarity often misses.

Key Results

HGSS achieves state-of-the-art performance for training-free methods:

  • Evasion Reduction: On the SEE benchmark, HGSS cut hierarchical evasion scores from 29.54 down to 10.02, a 66% relative improvement over the Semantic Surgery baseline.
  • Attribute Preservation: Pairwise attribute leakage (AttrP) was halved compared to prior training-free methods, dropping from 82.22 to 38.30.
  • Safety: On the I2P benchmark, HGSS recorded only 25 unsafe detections, the lowest among all 12 compared methods (including weight-editing ones).
  • Efficiency: Despite the extra logic, HGSS only adds about 1.3x wall-clock time overhead per image compared to the baseline, as it only requires three extra backward passes during the entire sampling process.
Figure 3: Qualitative comparison showing HGSS successfully erasing cats/horses while preserving the background, and removing cars without leaking their colors.

Limitations and Future Work

  • Computational Cost: While 1.3x is reasonable, it is still slower than a standard single-pass inference.
  • Weight-Edit Gap: While HGSS significantly narrows the gap, some weight-editing methods still show slightly better attribute-erasure scores (AttrE) because they can suppress residual evidence directly in the model's parameters.
  • WordNet Dependency: The hierarchical grounding relies on WordNet's coverage. Future work could explore using LLMs to dynamically generate these taxonomic relationships for open-vocabulary concepts not found in traditional lexicons.

Summary updated

BibTeX
@misc{dai2026compositional,
  author = {Chen Dai and Ganyu Zou and Nathan Self and Kevin Piper and Ramachandra Rao Seethiraju and Karthik Shyamsunder and Chang-Tien Lu and Naren Ramakrishnan},
  title = {{Compositional Concept Erasure in Text-to-Image Diffusion Models via Hierarchically Grounded Semantic Surgery}},
  year = {2026},
  eprint = {2610.07337},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.07337},
}
Figure