[论文解读] Jailbreak and Guard Aligned Language Models with Only Few In-Context Demonstrations
本文表明,在不进行参数微调的情况下,少量上下文演示就能让对齐的语言模型越狱或被保护,引入 In-Context Attack (ICA) 与 In-Context Defense (ICD),并评估它们的有效性。
Large Language Models (LLMs) have shown remarkable success in various tasks, yet their safety and the risk of generating harmful content remain pressing concerns. In this paper, we delve into the potential of In-Context Learning (ICL) to modulate the alignment of LLMs. Specifically, we propose the In-Context Attack (ICA) which employs harmful demonstrations to subvert LLMs, and the In-Context Defense (ICD) which bolsters model resilience through examples that demonstrate refusal to produce harmful responses. We offer theoretical insights to elucidate how a limited set of in-context demonstrations can pivotally influence the safety alignment of LLMs. Through extensive experiments, we demonstrate the efficacy of ICA and ICD in respectively elevating and mitigating the success rates of jailbreaking prompts. Our findings illuminate the profound influence of ICL on LLM behavior, opening new avenues for improving the safety of LLMs.
研究动机与目标
- 研究在不更新参数的情况下,上下文学习如何改变 LLM 的对齐性。
- 展示一个通过少量演示实现越狱的 In-Context Attack (ICA)。
- 展示一个加强对抗性提示鲁棒性的 In-Context Defense (ICD)。
- 将 ICA/ICD 与基于优化的攻击及现有防御进行对比。
- 提供对使用上下文操作来对齐 LLM 的安全性影响的见解。
提出的方法
- 通过将 k 个对抗性示例与目标提示连接起来,定义 In-Context Attack (ICA),以产生有害输出。
- 通过在有害提示前置安全回答的示例,展示 In-Context Defense (ICD),以降低越狱成功率。
- 在黑盒和白盒设置下,使用 GCG 攻击作为威胁模型,在 Vicuna-7b 与 Llama2-7b-chat 上评估 ICA/ICD。
- 在困惑度防御下,将 ICA/ICD 与基于优化的攻击(GBDA、PEZ、GCG)进行对比。
- 衡量攻击成功率(ASR)并通过困惑度筛选和跨转移/自适应攻击的鲁棒性分析检测情况。
实验结果
研究问题
- RQ1少量上下文演示是否能在不微调的情况下有效越狱一个对齐的 LLM?
- RQ2在黑盒设定下,是否可以利用上下文演示来防御越狱尝试?
- RQ3在有效性和效率方面,IC A 与 ICD 与基于优化的攻击及其他防御相比如何?
- RQ4演示数量对攻击成功率和防御鲁棒性的影响是什么?
- RQ5防御是否对转移和白盒对抗情景具有泛化能力?
主要发现
- ICA 可以将越狱成功率从 0% 提升到五个演示后达到 44%。
- ICA 相较于基于优化的攻击更高效,只需一次前向传播,计算量在几秒级。
- ICD 可以显著降低对抗性攻击的成功率,在少量演示下将转移和白盒 ASR 降低到接近 0%。
- 困惑度基于的检测在 ICA 面前可能失效,因为演示文本是自然语言且困惑度较低。
- ICD 在 Vicuna-7b 与 Llama2-7b-chat 的转移与白盒设置中都表现出鲁棒性,显著降低 ASR。
- ICD 相较其他防御在保持低计算开销的同时提升鲁棒性。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。