English

Safe-CLIP: Removing NSFW Concepts from Vision-and-Language Models

Computer Vision and Pattern Recognition 2024-07-25 v3 Artificial Intelligence Computation and Language Multimedia

Abstract

Large-scale vision-and-language models, such as CLIP, are typically trained on web-scale data, which can introduce inappropriate content and lead to the development of unsafe and biased behavior. This, in turn, hampers their applicability in sensitive and trustworthy contexts and could raise significant concerns in their adoption. Our research introduces a novel approach to enhancing the safety of vision-and-language models by diminishing their sensitivity to NSFW (not safe for work) inputs. In particular, our methodology seeks to sever "toxic" linguistic and visual concepts, unlearning the linkage between unsafe linguistic or visual items and unsafe regions of the embedding space. We show how this can be done by fine-tuning a CLIP model on synthetic data obtained from a large language model trained to convert between safe and unsafe sentences, and a text-to-image generator. We conduct extensive experiments on the resulting embedding space for cross-modal retrieval, text-to-image, and image-to-text generation, where we show that our model can be remarkably employed with pre-trained generative models. Our source code and trained models are available at: https://github.com/aimagelab/safe-clip.

Keywords

Cite

@article{arxiv.2311.16254,
  title  = {Safe-CLIP: Removing NSFW Concepts from Vision-and-Language Models},
  author = {Samuele Poppi and Tobia Poppi and Federico Cocchi and Marcella Cornia and Lorenzo Baraldi and Rita Cucchiara},
  journal= {arXiv preprint arXiv:2311.16254},
  year   = {2024}
}

Comments

ECCV 2024

R2 v1 2026-06-28T13:33:19.752Z