In-Context Learning Can Re-learn Forbidden Tasks
作者: Sophie Xhonneux, David Dobre, Jian Tang, Gauthier Gidel, Dhanya Sridhar
分类: cs.LG, cs.CR
发布日期: 2024-02-08
备注: 19 pages, 7 figures
💡 一句话要点
研究表明上下文学习可重新学习被禁止的任务
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型 上下文学习 安全训练 模型微调 攻击方法
📋 核心要点
- 现有的安全训练方法在防止模型回答有害查询方面存在不足,模型仍可能被诱导回答被禁止的任务。
- 论文提出利用上下文学习(ICL)来重新学习被禁止的任务,尽管模型经过微调以拒绝这些任务。
- 实验结果表明,ICL攻击在Starling-7B和Vicuna-7B模型上有效,但在Llama2-7B模型上失败,显示出不同模型的安全性差异。
📝 摘要(中文)
尽管在安全训练方面进行了大量投资,现实世界中的大型语言模型(LLMs)仍然存在许多漏洞。本文研究了被设计为拒绝回答的任务,探讨上下文学习(ICL)是否能够重新学习这些被禁止的任务。通过对拒绝情感分类的玩具示例进行分析,接着在经过微调的模型上应用ICL,研究其对虚构新闻摘要的影响。结果显示,ICL能够在某些模型上有效地撤销安全训练,带来潜在的安全风险。最终,提出了一种利用聊天模板令牌的ICL攻击方法,以提高攻击成功率。
🔬 方法详解
问题定义:本文旨在解决大型语言模型在安全训练后仍可能被诱导回答被禁止任务的问题。现有方法未能有效阻止模型在特定情况下回答有害查询,存在安全隐患。
核心思路:论文的核心思路是通过上下文学习(ICL)来重新学习被禁止的任务,探讨ICL是否能够撤销模型的安全训练效果,从而评估其安全性。
技术框架:研究首先通过玩具示例展示拒绝情感分类的问题,随后在经过微调的模型上应用ICL,最后评估ICL是否能撤销安全训练。主要模块包括模型微调、ICL应用和安全性评估。
关键创新:最重要的技术创新在于提出了一种新的ICL攻击方法,利用聊天模板令牌进行提示注入,以提高攻击成功率。这种方法与现有的安全训练方法形成了鲜明对比。
关键设计:在实验中,针对不同模型(如Vicuna-7B、Starling-7B和Llama2-7B)进行了参数设置和损失函数的调整,确保ICL攻击的有效性和成功率。
🖼️ 关键图片
📊 实验亮点
实验结果显示,ICL攻击在Starling-7B和Vicuna-7B模型上能够有效撤销安全训练,成功率显著提高,而在Llama2-7B模型上则未能实现。这表明不同模型在安全性方面存在显著差异,提示了模型设计中的安全隐患。
🎯 应用场景
该研究的潜在应用领域包括大型语言模型的安全性评估和改进,尤其是在涉及敏感内容的场景中。通过理解ICL对安全训练的影响,可以为未来的模型设计提供指导,确保其在实际应用中的安全性和可靠性。
📄 摘要(原文)
Despite significant investment into safety training, large language models (LLMs) deployed in the real world still suffer from numerous vulnerabilities. One perspective on LLM safety training is that it algorithmically forbids the model from answering toxic or harmful queries. To assess the effectiveness of safety training, in this work, we study forbidden tasks, i.e., tasks the model is designed to refuse to answer. Specifically, we investigate whether in-context learning (ICL) can be used to re-learn forbidden tasks despite the explicit fine-tuning of the model to refuse them. We first examine a toy example of refusing sentiment classification to demonstrate the problem. Then, we use ICL on a model fine-tuned to refuse to summarise made-up news articles. Finally, we investigate whether ICL can undo safety training, which could represent a major security risk. For the safety task, we look at Vicuna-7B, Starling-7B, and Llama2-7B. We show that the attack works out-of-the-box on Starling-7B and Vicuna-7B but fails on Llama2-7B. Finally, we propose an ICL attack that uses the chat template tokens like a prompt injection attack to achieve a better attack success rate on Vicuna-7B and Starling-7B. Trigger Warning: the appendix contains LLM-generated text with violence, suicide, and misinformation.