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.
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:
- 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.
- 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.
- 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.
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).
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.
Summary updated