paper-with-me

홈 › Papers

SafeRoPE: Risk-specific Head-wise Embedding Rotation for Safe Generation in Rectified Flow Transformers

2026-04-02 · Xiang Yang, Feifei Li, Mi Zhang, Geng Hong, Xiaoyu You, Min Yang arxiv

Recent Text-to-Image (T2I) models based on rectified-flow transformers (e.g., SD3, FLUX) achieve high generative fidelity but remain vulnerable to unsafe semantics, especially when triggered by multi-token interactions. Existing mitigation methods largely rely on fine-tuning or attention modulation for concept unlearning; however, their expensive computational overhead and design tailored to U-Net-based denoisers hinder direct adaptation to transformer-based diffusion models (e.g., MMDiT). In this paper, we conduct an in-depth analysis of the attention mechanism in MMDiT and find that unsafe semantics concentrate within interpretable, low-dimensional subspaces at head level, where a finite set of safety-critical heads is responsible for unsafe feature extraction. We further observe that perturbing the Rotary Positional Embedding (RoPE) applied to the query and key vectors can effectively modify some specific concepts in the generated images. Motivated by these insights, we propose SafeRoPE, a lightweight and fine-grained safe generation framework for MMDiT. Specifically, SafeRoPE first constructs head-wise unsafe subspaces by decomposing unsafe embeddings within safety-critical heads, and computes a Latent Risk Score (LRS) for each input vector via projection onto these subspaces. We then introduce head-wise RoPE perturbations that can suppress unsafe semantics without degrading benign content or image quality. SafeRoPE combines both head-wise LRS and RoPE perturbations to perform risk-specific head-wise rotation on query and key vector embeddings, enabling precise suppression of unsafe outputs while maintaining generation fidelity. Extensive experiments demonstrate that SafeRoPE achieves SOTA performance in balancing effective harmful content mitigation and utility preservation for safe generation of MMDiT. Codes are available at https://github.com/deng12yx/SafeRoPE.

📄 PDF Abstract BibTeX arXiv:2604.01826

Code (0)

등록된 구현이 없습니다.

Similar Papers 제목 키워드 기반

Elementwise Language Representation

2023-02-27 · Dunam Kim, Jeeeun Kim

We propose a new technique for computational language representation called elementwise embedding, in which a material (semantic unit) is abstracted into a horizontal concatenation of lower-dimensional element (character…

Document ClassificationSpecificity

Towards Understanding Why Lookahead Generalizes Better Than SGD and Beyond

2021-12-01 · NeurIPS 2021 12 · Pan Zhou, Hanshu Yan, Xiaotong Yuan, Jiashi Feng 외

To train networks, lookahead algorithm~\cite{zhang2019lookahead} updates its fast weights $k$ times via an inner-loop optimizer before updating its slow weights once by using the latest fast weights. Any optimizer, …

What Concepts Lie Within? Detecting and Suppressing Risky Content in Diffusion Transformers

2026-05-11 · Chenyu Zhang arxiv

The rise of text-to-image (T2I) models has increasingly raised concerns regarding the generation of risky content, such as sexual, violent, and copyright-protected images, highlighting the need for effective safeguards w…

Image Generation

Asterisk*: Keep it Simple

2024-11-08 · Andrew Semenov

This paper describes Asterisk, a compact GPT-based model for generating text embeddings. The model uses a minimalist architecture with two layers, two attention heads, and 256 embedding dimensions. By applying knowledge …

ClassificationKnowledge Distillationzero-shot-classificationZero-Shot Learning

Learning to Detect and Segment for Open Vocabulary Object Detection

2022-12-23 · CVPR 2023 1 · Tao Wang, Nan Li

Open vocabulary object detection has been greatly advanced by the recent development of vision-language pretrained model, which helps recognize novel objects with only semantic categories. The prior works mainly focus on…

Objectobject-detectionObject DetectionOpen-vocabulary object detection+1