From Concepts to Interactions: Dynamic Graph Semantic Recomposition for Safe Visual Generation

Qinghui Gong, Jinshan Lai, Xunlei Chen, Hua Meng, Zhengchun ZhouarXiv 2026

TL;DR

Dynamic Graph Semantic Recomposition (DGSR) shifts safety alignment in visual generative models from blunt "concept erasure" to precise "interaction suppression." By dynamically building a semantic interaction graph during the sampling process, DGSR selectively suppresses harmful relationships (e.g., a knife used in an attack) while preserving benign ones (e.g., a knife used for cooking), achieving state-of-the-art safety without sacrificing image or video fidelity.

What Problem Does This Paper Address?

Current safety alignment for Text-to-Image (T2I) and Text-to-Video (T2V) models often relies on concept erasure. If a concept like "knife" is deemed potentially harmful, these methods attempt to scrub it from the model's weights or suppress its representation entirely.

The problem? Safety is contextual. A knife in a kitchen is a tool; a knife in a dark alley is a weapon. Indiscriminate erasure leads to "unrealistic" outputs—like a chef cutting vegetables with their bare hands—and degrades the model's general utility. Furthermore, most existing methods treat concepts as static entities, ignoring how semantic interactions evolve dynamically as a model iteratively denoises an image or video.

Figure 1. Motivation for relation-level safe generation. Whether a concept is harmful depends on its contextual semantic relations. Prior erasure methods suppress “knife” unconditionally, leading to unrealistic outputs (e.g., cutting vegetables bare-handed in cooking scenes). DGSR selectively suppresses harmful semantic interactions and preserves benign, valid object usage.

Methods

The authors propose Dynamic Graph Semantic Recomposition (DGSR), a framework that operates on a frozen pretrained backbone (like FLUX.1 or Open-Sora). It consists of three main components:

  1. Dynamic Semantic Interaction Graph (DSIG) Construction: At each sampling step, the model parses the prompt into semantic spans (nodes). It then uses cross-modal attention maps to determine the "visual grounding" of these nodes. To measure how strongly two concepts are interacting, it calculates the Wasserstein distance between their grounding distributions, creating a graph where edges represent spatial-semantic associations.
  2. Context-Aware Relation Prediction: A two-layer Edge-GNN processes this graph. It integrates node features (textual and visual states) with edge attributes to predict a "suppression strength" for every directed relation.
  3. Inference-Time Semantic Recomposition: These predicted strengths are used to modulate the Transformer's attention mechanism. High-risk relations are gated and suppressed, while benign interactions remain untouched.

The training process is "progressive," moving from learning coarse graph-level risk to fine-grained counterfactual relation supervision (comparing "stab the woman" vs. "slice the bread") and finally aligning the generation to ensure fidelity.

Figure 2. Overview of DGSR. DGSR constructs semantic supernodes from text–visual features and establishes a dynamic semantic interaction graph (DSIG) using Wasserstein-based grounding similarities. A two-layer Edge-GNN captures contextual dependencies and predicts harmful relation suppression strengths. These signals are mapped back to Transformer attention through semantic-level and relation-level recomposition, enabling selective suppression of harmful interactions while preserving benign semantics.

Datasets

The researchers evaluated DGSR across several rigorous benchmarks:

  • T2I Benchmarks: I2P, Prompting4Debugging (P4D), UnlearnDiffAtk, and Ring-A-Bell (RAB).
  • General Fidelity: MS-COCO-10K was used to ensure that safety measures didn't destroy the model's ability to generate high-quality, benign images.
  • T2V Benchmarks: Evaluated on Nudity and Gore using the Gen and RAB prompt sets.
  • Backbones: FLUX.1-dev (T2I), Open-Sora (T2V), and Wan2.2-TI2V-5B (T2V).

Key Insights and Ideas

  • Safety is Relational, Not Categorical: The core "aha" moment is that we shouldn't fear the object, but the interaction. By modeling the graph of interactions, the system can distinguish between a medical worker handling a blood sample and a violent scene involving blood.
  • Dynamic Grounding Matters: Semantic relations aren't fixed; they emerge and shift during the denoising process. DGSR's ability to update its graph at each sampling step allows it to intervene exactly when a risky interaction begins to materialize in the latent space.
  • Wasserstein Distance for Edges: Unlike simple pixel overlap, the Wasserstein distance accounts for the geometric displacement between concepts. This provides a much richer signal for the GNN to understand how entities are spatially related in the generated scene.
  • Minimal Overhead: By using a lightweight auxiliary module (only 0.0224% additional parameters) on a frozen backbone, the method is highly efficient and avoids the catastrophic forgetting associated with full-model fine-tuning.

Key Results

  • Superior Safety: DGSR achieved the lowest Attack Success Rate (ASR) in 10 out of 12 T2I evaluations. For video, it reduced the average unsafe frame rate by 41.2% compared to the strongest baselines.
  • High Fidelity: Unlike prior methods that cause "semantic bleeding" or unrealistic erasures, DGSR maintained high CLIP scores and low FID, effectively preserving the "safe" parts of a prompt.
  • Selective Suppression: Qualitative results show DGSR successfully generating a man shaving (safe use of a razor) while blocking a man using a razor for self-harm (unsafe).
Figure 3. Qualitative comparison of unsafe and benign generation on FLUX.1-dev. We evaluate prompts involving nudity, violence, and blood. DGSR suppresses harmful semantic interactions while preserving benign visual content under related semantic conditions.

Limitations and Future Work

  • Inference Latency: While the auxiliary module is lightweight, running a GNN and calculating Wasserstein distances at every sampling step adds some computational overhead (roughly 15-20% increase in inference time).
  • Semantic Parsing Dependency: The system relies on an initial NLP-based lexical segmentation. If the semantic parser fails to correctly identify entities or actions in complex prompts, the graph construction may be flawed.
  • Future Directions: The authors suggest exploring more efficient graph update schedules (e.g., not updating every single step) and extending the framework to handle even more complex, multi-entity social interactions.
Figure 7. Effect of intervention ratio on safety, semantic preser- vation, and inference efficiency. (a) ASR together with inference time under different intervention ratios. (b) N-FID and COCO FID for general generation quality.

Summary updated

Abstract

Recent advances in flow-matching Transformers have greatly improved Text-to-Image (T2I) and Text-to-Video (T2V) generation, but unconstrained generation risks producing illegal or unethical content. Safety alignment must therefore suppress unsafe content while preserving legitimate generation. A concept's safety depends on context: a knife used for cooking is safe, whereas its use in violence is harmful. Yet most concept erasure methods indiscriminately suppress static, isolated representations, overlooking evolving semantic interactions. Consequently, safe scenes containing potentially sensitive terms may be unintentionally suppressed, compromising generation quality. To address this, we propose Dynamic Graph Semantic Recomposition (DGSR), which dynamically constructs and updates a semantic interaction graph from evolving text visual states during sampling. Context aware graph reasoning captures semantic dependencies, while paired safe/unsafe supervision distinguishes harmful from legitimate interactions, enabling precise identification of and selective intervention on high risk semantic relationships while preserving benign semantics. DGSR freezes the pretrained backbone and supports both image and video generation. Experiments show that DGSR achieves the lowest Attack Success Rate (ASR) in 10 of 12 T2I evaluations and reduces the average T2V unsafe frame rate by 41.2\% relative to the strongest baseline, while maintaining high generation fidelity and temporal consistency.
BibTeX
@misc{gong2026from,
  author = {Qinghui Gong and Jinshan Lai and Xunlei Chen and Hua Meng and Zhengchun Zhou},
  title = {{From Concepts to Interactions: Dynamic Graph Semantic Recomposition for Safe Visual Generation}},
  year = {2026},
  eprint = {2611.15149},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.15149},
}
Figure