Latent Guard: a Safety Framework for Text-to-image Generation

Runtao Liu, Ashkan Khakzar, Jindong Gu, Qifeng Chen, Philip Torr +1 more
4/11/2024
cs.CVcs.AIcs.LG

No official code found. Best implementation: rt219/LatentGuard (54 stars, BSD-3-Clause, last commit 2024-10-24).

Abstract

With the ability to generate high-quality images, text-to-image (T2I) models can be exploited for creating inappropriate content. To prevent misuse, existing safety measures are either based on text blacklists, which can be easily circumvented, or harmful content classification, requiring large datasets for training and offering low flexibility. Hence, we propose Latent Guard, a framework designed to improve safety measures in text-to-image generation. Inspired by blacklist-based approaches, Latent Guard learns a latent space on top of the T2I model's text encoder, where it is possible to check the presence of harmful concepts in the input text embeddings. Our proposed framework is composed of a data generation pipeline specific to the task using large language models, ad-hoc architectural components, and a contrastive learning strategy to benefit from the generated data. The effectiveness of our method is verified on three datasets and against four baselines. Code and data will be shared at https://latentguard.github.io/.

View on arXivView PDF

Code Implementations(1)

rt219/LatentGuardCommunity100%
BSD-3-Clause

This is the official repo of the paper "Latent Guard: a Safety Framework for Text-to-image Generation"

542PythonApr 11, 20241 years agoBSD-3-Clause

Similar Papers

Cite this paper

@article{liu2024latent,
  title  = {Latent Guard: a Safety Framework for Text-to-image Generation},
  author = {Runtao Liu and Ashkan Khakzar and Jindong Gu and Qifeng Chen and Philip Torr and Fabio Pizzati},
  year   = {2024},
  eprint = {2404.08031},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.08031v2},
  journal = {ECCV 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.08031.svg)](https://codeofpaper.com/paper/2404.08031)

Discussion