HyperAIHyperAI

Command Palette

Search for a command to run...

Best Student Paper AwardWWW 2025

안전 영역 내 텍스트 임베딩 제약을 통한 책임 있는 확산 모델

초록

확산 모델의 뛰어난 고충실도 이미지 생성 능력은 널리 채택되는 결과를 가져왔다. 그러나 NSFW(업무상 부적절) 콘텐츠를 생성하고 사회적 편향을 나타낼 가능성에 대한 우려도 제기되어 실제 응용 분야에서의 실용적 사용과 발전을 방해하고 있다. 이러한 문제에 대응하여, 기존 연구는 주로 유해 텍스트를 식별하고 이후에 배제하기 위한 보안 필터를 사용하거나, 사전 훈련된 확산 모델을 미세 조정하여 민감한 개념을 제거하는 데 초점을 맞추어 왔다. 불행히도, 기존 방법은 정상적인 모델 출력에 상당한 영향을 미칠 수 있음에도 불구하고 일부 경우에는 유해 콘텐츠 생성을 여전히 방지하지 못하는 등 만족스러운 성능을 달성하는 데 어려움을 겪고 있다. 본 논문에서는 임베딩 공간 내 의미 방향 벡터를 식별하여 텍스트 임베딩을 안전 영역 내로 제한하는 새로운 자기 발견 접근 방식을 제안한다. 우리의 방법은 입력 텍스트의 개별 단어를 수정할 필요를 우회하고 전체 텍스트 프롬프트를 임베딩 공간의 안전 영역으로 유도함으로써, 잠재적으로 안전하지 않은 모든 프롬프트에 대한 모델 견고성을 향상시킨다. 또한, 의미 방향 벡터 초기화를 위해 LoRA(Low-Rank Adaptation)를 사용하여 다른 의미에 대한 모델 성능에 미치는 영향을 줄인다. 더 나아가, 우리의 방법은 기존 방법과 통합되어 사회적 책임 성능을 개선할 수 있다. 벤치마크 데이터셋에 대한 광범위한 실험을 통해, 우리의 방법이 여러 최신 기준선과 비교하여 확산 모델이 생성하는 NSFW 콘텐츠를 효과적으로 줄이고 사회적 편향을 완화할 수 있음을 입증한다.

One-sentence Summary

Researchers propose a self-discovery method that identifies a semantic direction vector to constrain text embeddings within a safe region in embedding space, employing Low-Rank Adaptation for initialization, thereby reducing NSFW content and social bias in diffusion models without per-word correction and integrating with existing safeguards to enhance robustness across unsafe prompts.

Key Contributions

  • The paper introduces a novel self-discovery approach that learns a semantic direction vector in the CLIP embedding space, steering entire text prompts toward a safe region and improving robustness against all potentially unsafe prompts without relying on word-level corrections.
  • The method adopts Low-Rank Adaptation (LoRA) for semantic direction vector initialization, which preserves model performance on unrelated semantics and can be integrated with existing responsible generation methods to further reduce harmful outputs.
  • Experiments on benchmark datasets show that the approach effectively reduces NSFW content and mitigates social bias in diffusion models, outperforming several state-of-the-art baselines in safe and fair generation tasks.

Introduction

Text-to-image diffusion models can generate photorealistic images from text descriptions, but they often produce unsafe or biased content, including pornography, violence, gender discrimination, and racial prejudice. Prior approaches fall into two broad categories. The first relies on external classifiers to detect and reject toxic input, yet these mechanisms are unreliable because prompts without explicit NSFW terms, such as "a beautiful woman," can still trigger unsafe image generation. The second category tries to build more responsible models through data cleaning, parameter fine-tuning, model editing, or intervention in the inference process. Data filtering and retraining are computationally expensive and degrade performance. Fine-tuning risks catastrophic forgetting. Model editing methods typically modify projection matrices in cross-attention layers for specific target words, yielding poor results for related but non-targeted concepts. Inference-time interventions avoid parameter updates but can alter image semantics and add overhead. Existing prompt-tuning methods train pseudo-tokens to symbolize specific concepts, but these operate at the token level and fail to capture global semantic directions. The authors propose a novel self-discovery approach that identifies a semantic direction vector in the embedding space and constrains text prompt embeddings within a safe region. They leverage classifier-free guidance to learn a low-rank direction vector that moves the text embedding along specific semantic dimensions without affecting other semantics. This approach reduces NSFW content generation and mitigates social bias in stable diffusion models, and it can combine linearly with existing methods to further enhance responsible generation.

Method

The authors propose a method to identify semantic directions within the text embedding space, enabling precise control over diffusion model generation for safe and fair outcomes. This approach, termed Latent Region Anchoring, involves identifying a direction vector that steers the generated content towards or away from specific target concepts.

Initially, the method explores a linear approach in the CLIP embedding space. By computing the difference between the embeddings of two contrasting prompts (e.g., "a person" versus "a person wearing clothes"), a direction vector is derived.

As shown in the figure below, this naive subtraction effectively alters specific attributes such as nudity or gender. However, it often introduces unintended distortions and affects unrelated features, indicating that a simple difference vector is insufficient for precise and safe control.

To address these limitations, the authors employ an optimization strategy integrated directly into the diffusion denoising process. The goal is to find a direction vector ddd that minimizes the discrepancy between the noise predicted by the augmented base prompt and a target noise distribution derived from the target concept coc_oco​.

Refer to the framework diagram. The process utilizes classifier-free guidance to define target noise estimates, ϵ~θ+\tilde{\epsilon}_\theta^+ϵ~θ+​ for moving towards the concept and ϵ~θ−\tilde{\epsilon}_\theta^-ϵ~θ−​ for moving away. The optimization minimizes the following objective:

d∗=arg⁡min⁡d∑c∼D∑t∼[0,T]∥ϵθ(zt,c+d,t)−ψ(zt,co,t)∥2d^* = \arg \min_d \sum_{c \sim \mathcal{D}} \sum_{t \sim [0, T]} \| \epsilon_\theta(z_t, c + d, t) - \psi(z_t, c_o, t) \|^2d∗=argdmin​c∼D∑​t∼[0,T]∑​∥ϵθ​(zt​,c+d,t)−ψ(zt​,co​,t)∥2

Crucially, this optimization occurs dynamically during the iterative denoising steps. The direction vector is updated at each time step ttt to influence the subsequent step t−1t-1t−1, allowing the model to learn a precise semantic trajectory that aligns with the target concept throughout the generation process.

Regarding the initialization of the direction vector ddd, the authors note that standard full-rank initialization often leads to distorted images due to the sensitivity of the embedding space.

As illustrated in the figure below, the authors address this by adopting Low-Rank Adaptation (LoRA) for initialization. Instead of a full-rank vector, the direction is initialized as a product of two low-rank matrices, d=BAd = BAd=BA, where BBB is initialized to zeros and AAA is drawn from a normal distribution. This constrains the search space, allowing the model to amplify relevant features without disrupting the primary pre-trained representations.

During inference, the learned direction vectors are applied to the prompt embedding PcP_cPc​ with a guidance coefficient. For safe generation, the direction pointing away from unsafe concepts is added to prevent inappropriate content. For fair generation, direction vectors corresponding to sensitive attributes (e.g., gender) are randomly selected and added with equal probability to ensure balanced attribute distribution in the outputs.

Experiment

The experiments validate the method's effectiveness in both safe and fair generation tasks using Stable Diffusion. For safety, direction vectors learned in embedding space suppressed inappropriate content across categories on the I2P benchmark and adversarial prompts, outperforming baselines except in the 'hate' category. For fairness, vectors applied to gender and race attributes reduced social bias and achieved the lowest average deviation ratio on Winobias compared to baseline methods. The direction vectors also transferred well to existing fine-tuning approaches and models with different architectures, could be linearly combined for multi-attribute control with some weakening of individual effects, and maintained image quality and text alignment on par with the original model.

The proposed method achieves the lowest inappropriate content detection ratios on the I2P benchmark across most unsafe prompt categories, outperforming all baselines in six of seven categories. It is second-best only in the hate category, where ESD is slightly better. Overall, the method shows consistent and substantial reductions in unsafe content generation compared to existing approaches. Achieves the best performance in harassment, illegal, self-harm, sexual, shocking, and violence categories. Second-best only in the hate category, where ESD yields a lower detection ratio. Overall detection ratio is the lowest among all compared methods, including original SD and negative prompting.

The table reports the ratio of inappropriate images generated from adversarial prompts for nudity and violence. the method consistently achieves the lowest ratios on both categories, demonstrating superior robustness against adversarial attacks compared to all baselines. For nudity, the method yields a ratio of 0.316, roughly half that of the closest baseline ESD at 0.537. For violence, the ratio is 0.116, far below the best baseline SPM at 0.720. Original SD and negative prompting produce very high ratios, indicating they are largely ineffective on these adversarial prompts.

The proposed method achieves the lowest average deviation ratios across both standard and extended prompt templates, indicating fairer generated images. It consistently performs best or second best across sampled professions, while baseline methods like UCE show greater sensitivity to template changes. The proposed method attains the lowest average deviation ratio for both normal and extended templates, corresponding to the most balanced attribute distributions. It ranks best or second best in most sampled professions, whereas UCE exhibits notable performance drops under the more challenging extended templates.

The proposed direction vectors improve safety performance when integrated with existing methods like SLD, ESD, and SDXL on the I2P benchmark. Across all categories, the combined approaches consistently lower unsafe scores, with notable reductions for ESD and SLD. The method also transfers to SDXL after retraining, showing effectiveness in models with multiple text encoders. Integrating the direction vectors reduces unsafe scores for SLD, ESD, and SDXL across every category tested. The improvements are most pronounced for ESD, where scores drop dramatically, often to near zero. For SDXL, which requires shape adjustment and retraining due to its dual-encoder architecture, the method still yields substantial reductions in unsafe generation.

On the COCO-30K benchmark, the proposed method maintains image fidelity and text alignment comparable to the original Stable Diffusion, while other debiasing approaches show larger degradations in either FID or CLIP scores. This indicates that the learned semantic direction is accurate and does not disrupt unrelated semantics. The method yields FID and CLIP scores close to the original Stable Diffusion, whereas SLD and ESD show noticeably worse fidelity and alignment. Compared with other debiasing techniques, the proposed approach strikes a better balance between reducing unwanted biases and preserving generation quality. The close-to-baseline performance suggests the semantic direction vector acts on relevant attributes without broadly harming prompt-image consistency.

The proposed method was evaluated across multiple benchmarks, including I2P for safety, adversarial prompts for robustness, fairness tests with standard and extended templates, and COCO-30K for generation quality. It consistently achieved the lowest inappropriate content detection ratios in most safety categories, outperformed baselines on adversarial nudity and violence prompts, and produced the most balanced attribute distributions across professions. Additionally, integrating the learned direction vectors improved safety for existing methods like SLD and ESD, while preserving image fidelity and text alignment on COCO-30K, demonstrating that the approach reduces unsafe and biased generation without sacrificing overall quality.


AI로 AI 구축

아이디어에서 출시까지 — 무료 AI 코코딩, 즉시 사용 가능한 환경, 최적의 GPU 가격으로 AI 개발을 가속화하세요.

AI 협업 코딩
바로 사용 가능한 GPU
최적의 가격

HyperAI Newsletters

최신 정보 구독하기
한국 시간 매주 월요일 오전 9시 에 이번 주의 최신 업데이트를 메일로 발송합니다
이메일 서비스 제공: MailChimp