arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.12505cs.CLcs.CRcs.LG
收藏

针对大型语言模型红队测试与防御的攻击提示生成

Attack Prompt Generation for Red Teaming and Defending Large Language Models

University of Science and Technology of China(中国科学技术大学);National University of Singapore(新加坡国立大学);Meta AI

Boyi Deng, Wenjie Wang, Fuli Feng, Yang Deng, Qifan Wang, Xiangnan He

AI总结:

提出结合手动与自动方法的攻击提示生成框架,利用上下文学习指导LLMs模仿人类生成提示,并通过迭代交互微调受害LLMs以增强防御,同时发布SAP数据集促进安全性评估。

摘要:

大型语言模型(LLMs)易受红队测试攻击,这会诱导LLMs生成有害内容。以往研究通过手动或自动方法构建攻击提示,在构建成本和质量上各有局限。为解决这些问题,我们提出一种结合手动与自动方法的集成方法,以经济地生成高质量攻击提示。具体而言,考虑到新兴LLMs的强大能力,我们提出一种攻击框架,通过上下文学习指导LLMs模仿人类生成的提示。此外,我们提出一种防御框架,通过受害LLMs与攻击框架的迭代交互对其进行微调,以增强其抵御红队测试攻击的安全性。在不同LLMs上的大量实验验证了所提攻击和防御框架的有效性。此外,我们发布了名为SAP的系列攻击提示数据集,包含不同规模,以促进更多LLMs的安全性评估与提升。代码和数据集可在 https://github.com/Aatrox103/SAP 获取。

英文摘要:

Large language models (LLMs) are susceptible to red teaming attacks, which can induce LLMs to generate harmful content. Previous research constructs attack prompts via manual or automatic methods, which have their own limitations on construction cost and quality. To address these issues, we propose an integrated approach that combines manual and automatic methods to economically generate high-quality attack prompts. Specifically, considering the impressive capabilities of newly emerged LLMs, we propose an attack framework to instruct LLMs to mimic human-generated prompts through in-context learning. Furthermore, we propose a defense framework that fine-tunes victim LLMs through iterative interactions with the attack framework to enhance their safety against red teaming attacks. Extensive experiments on different LLMs validate the effectiveness of our proposed attack and defense frameworks. Additionally, we release a series of attack prompts datasets named SAP with varying sizes, facilitating the safety evaluation and enhancement of more LLMs. Our code and dataset is available on https://github.com/Aatrox103/SAP .

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

↑