Hugging Face Blog

Introducing SafeCoder

arXiv AI
Sep 24

InGuard: Towards Generalized Inner Guardrail for Safe Text-to-Image Generation

InGuard introduces an inner guardrail for text-to-image generation that operates within the model’s own representations, avoiding external classifiers. It grades prompts using the text encoder’s embeddings, modifies risky embeddings with SAGE to produce safe images, and employs a latent detector to halt generation early. Evaluated on the RevGen Safety Benchmark, InGuard achieves a 97.9–98.8% safety rate across five open-weight models while reducing benign disturbances, model parameters, and denoising steps.

By Zeyu Wang, Xiaodan Li, Zhiwen Li, Yuefeng Chen, Hui Xue
arXiv AI
Oct 5

Keep It CALM: Analyzing the Limits of Global Unsafety in Text-to-Image Generation

The paper examines the limitations of global unsafety signals used in training‑free safeguards for text‑to‑image generation, showing a trade‑off between coverage and selectivity. It introduces CALM, a counterfactual adaptive local modulation method that locally corrects unsafe token representations while preserving benign content. Experiments demonstrate that CALM outperforms global removal approaches in suppressing unsafe content without compromising utility.

By NaHyeon Park, Minhyun Lee, Hyunjung Shim
arXiv Computer Vision
Sep 4

SafeRI: Recognition and Intervention for Token-Level Safety Intervention in Large Vision Language Models

SafeRI proposes an on-demand safety alignment approach for large vision-language models, contrasting with existing always-on methods that globally modify model behavior. The framework uses a lightweight recognizer to evaluate token-level safety during autoregressive generation, gating a LoRA module that only activates when unsafe content is detected. By training the LoRA on unsafe prefixes and safe continuations, SafeRI redirects unsafe generations back to safe responses without perturbing the model’s original reasoning path.

By Caoyuan Ma, Tian Gu, Wenpu Liu, Weichu Xie, Shuai Dong, Yuqi Xu, Ji Zhao, Ziyue Wang, Wenzheng Chang, Taiqiang Wu, Yongfu Zhu, Wenqi Shao, Zheng Wang, Yinqiang Zheng
arXiv Computer Vision
Nov 9

No Safe Dose: How Training Data Drives Unsafe Image Generation

The study investigates how the proportion of unsafe images in training data influences the safety of text‑to‑image models. By training identical models on corpora ranging from 0% to 9.6% unsafe content and evaluating 10,000 generations per model, the authors find that unsafe output increases monotonically with contamination, saturating at 26.4% for the highest contamination level. Filtering a fixed fraction of unsafe images is equally effective across different dataset sizes and does not degrade image quality, yet it cannot eliminate unsafe generation entirely, indicating that data curation and encoder choices are complementary but insufficient alone.

By Felix Friedrich, Lukas Helff, Niharika Hegde, Patrick Schramowski, Kristian Kersting
arXiv Computation and Language
Aug 31

Steering Multimodal Large Language Models Decoding for Context-Aware Safety

The paper introduces Safety-aware Contrastive Decoding (SafeCoDe), a lightweight, model‑agnostic framework designed to improve context‑aware safety in Multimodal Large Language Models (MLLMs). SafeCoDe operates in two stages: a contrastive decoding step that highlights tokens sensitive to visual context by contrasting real and Gaussian‑noised images, and a global‑aware token modulation strategy that adjusts refusals based on scene‑level reasoning and predicted safety verdicts. Experiments across various MLLM architectures and safety benchmarks demonstrate that SafeCoDe consistently enhances context‑sensitive refusal behaviors while maintaining model helpfulness.

By Zheyuan Liu, Zhangchen Xu, Guangyao Dou, Xiangchi Yuan, Zhaoxuan Tan, Radha Poovendran, Meng Jiang