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

对齐与越狱如何工作:通过中间隐藏状态解释 LLM 安全性

How Alignment and Jailbreak Work: Explain LLM Safety through Intermediate Hidden States

Alibaba Group(阿里巴巴集团);Tsinghua University(清华大学)

Zhenhong Zhou, Haiyang Yu, Xinghua Zhang, Rongwu Xu, Fei Huang, Yongbin Li

AI总结:

本文利用弱分类器分析 LLM 中间隐藏状态,揭示预训练形成伦理概念、对齐将其转化为拒绝 token,而越狱阻断该转化,并在 7B 至 70B 模型上验证。

摘要:

大语言模型(LLM)依靠安全对齐来避免回应恶意用户输入。遗憾的是,越狱能够绕过安全防护栏,导致 LLM 生成有害内容,并引发人们对 LLM 安全性的担忧。由于参数量庞大的语言模型通常被视为黑箱,对齐和越狱的机制很难阐明。本文中,我们采用弱分类器,通过中间隐藏状态解释 LLM 的安全性。我们首先证实,LLM 是在预训练阶段而非对齐阶段学习伦理概念,并且能够在较早层识别恶意输入和正常输入。对齐实际上是将早期概念与中间层的情绪猜测关联起来,随后将其细化为用于安全生成的特定拒绝 token。越狱则会扰乱早期不道德分类向负面情绪的转化。我们在多个模型系列中从 7B 到 70B 的模型上开展实验,以证明我们的结论。总体而言,本文揭示了 LLM 安全的内在机制以及越狱如何绕过安全防护栏,为 LLM 安全提供了新的视角并缓解相关担忧。我们的代码可在 https://github.com/ydyjya/LLM-IHS-Explanation 获取。

英文摘要:

Large language models (LLMs) rely on safety alignment to avoid responding to malicious user inputs. Unfortunately, jailbreak can circumvent safety guardrails, resulting in LLMs generating harmful content and raising concerns about LLM safety. Due to language models with intensive parameters often regarded as black boxes, the mechanisms of alignment and jailbreak are challenging to elucidate. In this paper, we employ weak classifiers to explain LLM safety through the intermediate hidden states. We first confirm that LLMs learn ethical concepts during pre-training rather than alignment and can identify malicious and normal inputs in the early layers. Alignment actually associates the early concepts with emotion guesses in the middle layers and then refines them to the specific reject tokens for safe generations. Jailbreak disturbs the transformation of early unethical classification into negative emotions. We conduct experiments on models from 7B to 70B across various model families to prove our conclusion. Overall, our paper indicates the intrinsical mechanism of LLM safety and how jailbreaks circumvent safety guardrails, offering a new perspective on LLM safety and reducing concerns. Our code is available at https://github.com/ydyjya/LLM-IHS-Explanation.

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

↑