arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.08924cs.CRcs.AIcs.CL
收藏

Prefix Guidance:大型语言模型防御越狱攻击的方向盘

Prefix Guidance: A Steering Wheel for Large Language Models to Defend Against Jailbreak Attacks

University of Science and Technology of China(中国科学技术大学)

Jiawei Zhao, Kejiang Chen, Xiaojian Yuan, Weiming Zhang

AI总结:

本文提出即插即用的越狱防御框架Prefix Guidance(PG),通过设置模型输出前几个token引导其识别有害提示,结合模型内在安全能力与外部分类器,在多模型和攻击方法上验证了其高效性及对模型性能的保持。

摘要:

近年来,大型语言模型(LLMs)的快速发展在各种任务中取得了显著性能。然而,研究表明LLMs容易受到越狱攻击,攻击者可以通过精心制作的提示词诱导其生成有害内容。这种脆弱性对LLMs的安全使用和推广构成了重大挑战。现有的防御方法从不同角度提供保护,但往往存在有效性不足或对模型能力影响显著的问题。在本文中,我们提出了一种即插即用且易于部署的越狱防御框架,即Prefix Guidance(PG),它通过直接设置模型输出的前几个token来引导模型识别有害提示词。该方法将模型固有的安全能力与外部分类器相结合,以防御越狱攻击。我们在三个模型和五种攻击方法上证明了PG的有效性。与基线相比,我们的方法平均而言更有效。此外,在Just-Eval基准上的结果进一步证实了PG在保持模型性能方面的优越性。我们的代码可在https://github.com/weiyezhimeng/Prefix-Guidance获取。

英文摘要:

In recent years, the rapid development of large language models (LLMs) has achieved remarkable performance across various tasks. However, research indicates that LLMs are vulnerable to jailbreak attacks, where adversaries can induce the generation of harmful content through meticulously crafted prompts. This vulnerability poses significant challenges to the secure use and promotion of LLMs. Existing defense methods offer protection from different perspectives but often suffer from insufficient effectiveness or a significant impact on the model's capabilities. In this paper, we propose a plug-and-play and easy-to-deploy jailbreak defense framework, namely Prefix Guidance (PG), which guides the model to identify harmful prompts by directly setting the first few tokens of the model's output. This approach combines the model's inherent security capabilities with an external classifier to defend against jailbreak attacks. We demonstrate the effectiveness of PG across three models and five attack methods. Compared to baselines, our approach is generally more effective on average. Additionally, results on the Just-Eval benchmark further confirm PG's superiority to preserve the model's performance. our code is available at https://github.com/weiyezhimeng/Prefix-Guidance.

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

↑