Skip to main content
QUICK REVIEW

[论文解读] A Wolf in Sheep's Clothing: Generalized Nested Jailbreak Prompts can Fool Large Language Models Easily

Peng Ding, J. S. Kuang|arXiv (Cornell University)|Nov 14, 2023
Computational and Text Analysis Methods被引用 4
一句话总结

该论文提出 ReNeLLM,一种自动化框架,通过提示重写与场景嵌套技术泛化越狱提示攻击,以绕过大语言模型的安全对齐机制。通过利用大语言模型生成语义保持但更具隐蔽性的提示,并将其嵌入常见任务中,ReNeLLM 在保持较低时间成本的同时,使攻击成功率较基线方法提升 40% 以上,暴露出当前防御机制中的关键漏洞。

ABSTRACT

Large Language Models (LLMs), such as ChatGPT and GPT-4, are designed to provide useful and safe responses. However, adversarial prompts known as 'jailbreaks' can circumvent safeguards, leading LLMs to generate potentially harmful content. Exploring jailbreak prompts can help to better reveal the weaknesses of LLMs and further steer us to secure them. Unfortunately, existing jailbreak methods either suffer from intricate manual design or require optimization on other white-box models, which compromises either generalization or efficiency. In this paper, we generalize jailbreak prompt attacks into two aspects: (1) Prompt Rewriting and (2) Scenario Nesting. Based on this, we propose ReNeLLM, an automatic framework that leverages LLMs themselves to generate effective jailbreak prompts. Extensive experiments demonstrate that ReNeLLM significantly improves the attack success rate while greatly reducing the time cost compared to existing baselines. Our study also reveals the inadequacy of current defense methods in safeguarding LLMs. Finally, we analyze the failure of LLMs defense from the perspective of prompt execution priority, and propose corresponding defense strategies. We hope that our research can catalyze both the academic community and LLMs developers towards the provision of safer and more regulated LLMs. The code is available at https://github.com/NJUNLP/ReNeLLM.

研究动机与目标

  • 解决手动方法与基于优化的越狱方法存在的局限性,如耗时、脆弱或语义不自然。
  • 通过识别两个核心模式——提示重写与场景嵌套——实现越狱攻击的泛化。
  • 开发一种自动化、高效且有效的框架,利用大语言模型自身生成高成功率越狱提示,无需微调或基于梯度的优化。
  • 评估当前防御机制对这些泛化攻击的鲁棒性。
  • 通过分析提示执行过程中注意力机制的表现,揭示大语言模型为何无法检测恶意内容。

提出的方法

  • ReNeLLM 将越狱攻击泛化为两个核心组件:提示重写与场景嵌套。
  • 提示重写通过语言转换(如同义词替换、句式重构、拼写错误)在保持核心语义的同时规避检测。
  • 场景嵌套将重写后的提示嵌入常见任务上下文(如表格填充、文本补全或代码生成)中,以隐藏恶意意图。
  • 该框架利用大语言模型自动探索并选择最优的重写与嵌套策略组合。
  • 其运行无需额外训练或基于梯度的优化,完全依赖大语言模型的推理与生成能力。
  • 通过注意力可视化分析大语言模型在执行过程中对外部指令与内部恶意提示的注意力分配变化,揭示其规避检测的注意力机制转移。
Figure 1: An example of jailbreak prompt given by ReNeLLM.
Figure 1: An example of jailbreak prompt given by ReNeLLM.

实验结果

研究问题

  • RQ1提示重写与场景嵌套的泛化模式是否能在多种大语言模型上显著提升越狱成功率?
  • RQ2语义保持的重写与上下文嵌套相结合,如何影响大语言模型的注意力机制与响应行为?
  • RQ3为何当前防御机制即使面对语义连贯的提示仍无法阻止 ReNeLLM 生成的越狱提示?
  • RQ4ReNeLLM 在攻击成功率与效率方面相较于现有基线方法有多大的优势?
  • RQ5在执行嵌套越狱提示时,大语言模型的注意力机制如何发生改变?这对模型安全性有何启示?

主要发现

  • 在 Llama-2-chat-70b 上,ReNeLLM 的攻击成功率较基线方法提升 40% 以上,展现出显著的性能优势。
  • 在 GPT-3.5 上,结合提示重写与场景嵌套后,攻击成功率提升超过 40%,表明两项技术之间存在强烈协同效应。
  • 注意力可视化显示,经过嵌套后,大语言模型更优先处理外部任务指令,而非内部恶意提示,从而降低被检测的可能性。
  • 基于困惑度或语义过滤的防御机制对 ReNeLLM 失效,因为重写后的提示仍保持高度流畅与连贯。
  • 与 GCG 等基于优化的方法相比,ReNeLLM 显著降低了时间成本,后者需迭代搜索与梯度计算。
  • 即使经过安全对齐的微调,大语言模型仍对 ReNeLLM 的泛化攻击模式保持脆弱,暴露出当前对齐技术的根本性缺陷。
Figure 2: Overview of ReNeLLM, an automatic jailbreak prompt generation framework. For the first time, it generalizes jailbreak prompt attacks, including two aspects, prompt rewriting and scenario nesting. The former is inspired by linguistics Chomsky ( 2002 ) , performing various rewriting operatio
Figure 2: Overview of ReNeLLM, an automatic jailbreak prompt generation framework. For the first time, it generalizes jailbreak prompt attacks, including two aspects, prompt rewriting and scenario nesting. The former is inspired by linguistics Chomsky ( 2002 ) , performing various rewriting operatio

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。