SafeText:通过对齐文本编码器实现安全的文本到图像模型
SafeText: Safe Text-to-image Models via Aligning the Text Encoder
AI总结:
SafeText通过微调文本编码器而非扩散模块来对齐文本到图像模型,在不影响安全提示图像质量的前提下有效防止有害图像生成,并优于六种现有对齐方法。
摘要:
文本到图像模型在面对不安全提示时可能生成有害图像,带来重大的安全和社会风险。对齐方法旨在修改这些模型,以确保即使暴露于不安全提示,也仅生成无害图像。典型的文本到图像模型包含两个主要组件:1)文本编码器和2)扩散模块。现有对齐方法主要集中于修改扩散模块以防止有害图像生成。然而,这往往显著影响模型对安全提示的行为,导致生成图像质量大幅下降。在本工作中,我们提出SafeText,一种新颖的对齐方法,该方法微调文本编码器而非扩散模块。通过调整文本编码器,SafeText显著改变不安全提示的嵌入向量,同时对安全提示的嵌入向量影响极小。因此,扩散模块对不安全提示生成无害图像,同时保持安全提示的图像质量。我们在多个安全和不安全提示数据集上评估SafeText,包括通过越狱攻击生成的数据集。结果表明,SafeText有效防止有害图像生成,对安全提示图像影响较小,且SafeText优于六种现有对齐方法。论文被接收后,我们将发布代码和数据。
英文摘要:
Text-to-image models can generate harmful images when presented with unsafe prompts, posing significant safety and societal risks. Alignment methods aim to modify these models to ensure they generate only non-harmful images, even when exposed to unsafe prompts. A typical text-to-image model comprises two main components: 1) a text encoder and 2) a diffusion module. Existing alignment methods mainly focus on modifying the diffusion module to prevent harmful image generation. However, this often significantly impacts the model's behavior for safe prompts, causing substantial quality degradation of generated images. In this work, we propose SafeText, a novel alignment method that fine-tunes the text encoder rather than the diffusion module. By adjusting the text encoder, SafeText significantly alters the embedding vectors for unsafe prompts, while minimally affecting those for safe prompts. As a result, the diffusion module generates non-harmful images for unsafe prompts while preserving the quality of images for safe prompts. We evaluate SafeText on multiple datasets of safe and unsafe prompts, including those generated through jailbreak attacks. Our results show that SafeText effectively prevents harmful image generation with minor impact on the images for safe prompts, and SafeText outperforms six existing alignment methods. We will publish our code and data after paper acceptance.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。