Sysformer: 通过自适应系统提示保护冻结的大语言模型
Sysformer: Safeguarding Frozen Large Language Models with Adaptive System Prompts
AI总结:
Sysformer通过自适应系统提示提高大语言模型的安全性,显著提升对有害提示的拒绝率和对安全提示的合规性。
摘要:
随着大语言模型(LLMs)被部署在安全关键性设置中,确保其响应符合安全标准至关重要。先前的研究发现,LLMs往往难以理解安全行为的概念,导致对无害的提示产生不合理的拒绝或生成有害内容。尽管已经做出了大量努力来提高其鲁棒性,但现有的防御措施通常依赖于昂贵的模型参数微调或采用次优的启发式技术。在本工作中,我们采取了一种新的方法来保护LLMs,通过学习在指令微调的LLMs中适应系统提示。虽然LLMs通常被预训练以遵循固定的系统提示,但我们研究了将系统提示定制到每个特定用户输入对响应安全性的影响。为此,我们提出了Sysformer,一种transformer模型,它在LLM输入嵌入空间中将初始系统提示更新为更稳健的系统提示,同时关注用户提示。在保持LLM参数冻结的情况下,Sysformer被训练以拒绝一组有害提示,同时对一组安全提示做出理想响应。通过在5个不同家族的LLMs和2个最近的基准测试上进行广泛的实验,我们证明Sysformer可以显著提高LLMs的鲁棒性,导致在有害提示上的拒绝率提升高达80%,同时在安全提示上的合规性提升高达90%。结果也很好地推广到复杂的 jailbreaking 攻击,使 LLMs 对不同攻击策略的鲁棒性提高高达100%。我们希望我们的发现能导致更经济的LLMs保护方法,并激励未来研究设计可变的系统提示。
英文摘要:
As large language models (LLMs) are deployed in safety-critical settings, it is essential to ensure that their responses comply with safety standards. Prior research has revealed that LLMs often fail to grasp the notion of safe behaviors, resulting in either unjustified refusals to harmless prompts or the generation of harmful content. While substantial efforts have been made to improve their robustness, existing defenses often rely on costly fine-tuning of model parameters or employ suboptimal heuristic techniques. In this work, we take a novel approach to safeguard LLMs by learning to adapt the system prompts in instruction-tuned LLMs. While LLMs are typically pre-trained to follow a fixed system prompt, we investigate the impact of tailoring the system prompt to each specific user input on the safety of the responses. To this end, we propose $\textbf{Sysformer}$, a trans$\textbf{former}$ model that updates an initial $\textbf{sys}$tem prompt to a more robust system prompt in the LLM input embedding space while attending to the user prompt. While keeping the LLM parameters frozen, the Sysformer is trained to refuse to respond to a set of harmful prompts while responding ideally to a set of safe ones. Through extensive experiments on $5$ LLMs from different families and $2$ recent benchmarks, we demonstrate that Sysformer can significantly enhance the robustness of LLMs, leading to upto $80\%$ gain in the refusal rate on harmful prompts while enhancing the compliance with the safe prompts by upto $90\%$. Results also generalize well to sophisticated jailbreaking attacks, making LLMs upto $100\%$ more robust against different attack strategies. We hope our findings lead to cheaper safeguarding of LLMs and motivate future investigations into designing variable system prompts.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。