Published October 31, 2024 | Version v1
Conference paper Open

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

  • 1. Università degli Studi di Modena e Reggio Emilia
  • 2. ROR icon University of Pisa
  • 3. ROR icon Institute of Informatics and Telematics

Description

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.

Files

2024_ECCV_Safe_CLIP_CameraReady.pdf

Files (986.7 kB)

Name Size Download all
md5:0bb740559aa1d3d5e336c1d302231bfe
986.7 kB Preview Download

Additional details

Funding

European Commission
ELIAS - European Lighthouse of AI for Sustainability 101120237