arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2501.18280cs.CLcs.AIcs.LGcs.NE
收藏

利用面向文本嵌入模型的通用魔法词破解大语言模型的安全防护

Jailbreaking LLMs' Safeguard with Universal Magic Words for Text Embedding Models

Dept. of Comp. Sci. and Tech., Inst. for AI, Tsinghua-Bosch Joint ML Center, THBI Lab, BNRist Center, Tsinghua University, Beijing, 100084, China(计算机科学与技术系、人工智能研究所、清华-博世联合机器学习中心、THBI实验室、BNRist中心、清华大学、北京);Department of Mathematical Sciences, Tsinghua University(数学科学系、清华大学);BIMSA, Beijing, China(BIMSA、北京、中国)

Haoyu Liang, Youran Sun, Yunfeng Cai, Jun Zhu, Bo Zhang

AI总结:

本研究发现文本嵌入模型输出分布存在严重偏差,提出搜索通用魔法词的攻击方法可破解大语言模型的嵌入类安全防护,同时提出无训练的防御方案以修正偏差、提升安全性。

摘要:

大语言模型(LLM)的安全问题近年来受到广泛关注,研究人员已开发多种防御机制以阻止有害输出,其中基于文本嵌入模型的安全防护是一类基础防御手段。经测试我们发现,文本嵌入模型的输出分布存在严重偏差,均值较大。受这一观察启发,我们提出了多种新颖高效的方法,用于搜索攻击文本嵌入模型的**通用魔法词**。作为后缀的通用魔法词可将任意文本的嵌入向量向偏差方向偏移,从而操控任意文本对的相似度,误导安全防护机制。攻击者可通过在用户提示词后附加魔法词,并要求大语言模型以魔法词结束回答,来破解安全防护。实验表明,魔法词攻击会显著降低JailbreakBench(越狱基准测试集)上安全防护的性能,在全流程攻击中可让真实世界的聊天机器人产生有害输出,且能跨输入/输出文本、模型和语言泛化。为根除这一安全风险,我们还提出了针对此类攻击的防御方法,该方法无需训练即可纠正文本嵌入的偏差并提升下游任务性能。

英文摘要:

The security issue of large language models (LLMs) has gained wide attention recently, with various defense mechanisms developed to prevent harmful output, among which safeguards based on text embedding models serve as a fundamental defense. Through testing, we discover that the output distribution of text embedding models is severely biased with a large mean. Inspired by this observation, we propose novel, efficient methods to search for **universal magic words** that attack text embedding models. Universal magic words as suffixes can shift the embedding of any text towards the bias direction, thus manipulating the similarity of any text pair and misleading safeguards. Attackers can jailbreak the safeguards by appending magic words to user prompts and requiring LLMs to end answers with magic words. Experiments show that magic word attacks significantly degrade safeguard performance on JailbreakBench, cause real-world chatbots to produce harmful outputs in full-pipeline attacks, and generalize across input/output texts, models, and languages. To eradicate this security risk, we also propose defense methods against such attacks, which can correct the bias of text embeddings and improve downstream performance in a train-free manner.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑