arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.06809cs.CLcs.CR
收藏

根防御策略:在解码层面确保大语言模型的安全性

Root Defence Strategies: Ensuring Safety of LLM at the Decoding Level

Aerospace Information Research Institute, Chinese Academy of Sciences(航天信息研究所,中国科学院);Dept. of Comp. Sci. and Tech., Institute for AI, Tsinghua University(计算机科学与技术系,人工智能研究院,清华大学);Shanghai Key Laboratory of Multi. Info. Processing, East China Normal University(上海多信息处理重点实验室,华东师范大学);Kuaishou-Inc(快手公司)

Xinyi Zeng, Yuying Shang, Jiawei Chen, Jingyuan Zhang, Yu Tian

AI总结:

本文提出一种解码层面的逐步防御机制,直接纠正有害查询而非拒绝,并引入推测解码加速,实验证明在提升安全性的同时保持推理速度和实用性。

摘要:

大语言模型(LLMs)已在各行业展现出巨大的实用价值。然而,随着LLMs的发展,由于错误或恶意的指令提示,产生有害输出的风险也在增加。尽管现有方法能有效应对越狱风险,但它们存在共同的局限性:1)在预填充层面判断有害响应,缺乏对模型解码输出的利用,导致有效性和鲁棒性相对较低。2)基于单一评估拒绝潜在有害响应,会显著损害模型的实用性。本文考察了LLMs识别有害输出的能力,揭示并量化了它们在评估先前令牌危险性方面的熟练程度。受预实验结果的启发,我们设计了一种在解码层面的稳健防御机制。我们新颖的面向解码器、逐步进行的防御架构直接纠正有害查询,而非直接拒绝它们。我们引入推测解码以增强可用性并便于部署,从而提升安全解码速度。大量实验表明,我们的方法在提高模型安全性的同时不牺牲推理速度。值得注意的是,我们的方法利用模型辨别危险信息的能力,与现有方法相比保持了其实用性。

英文摘要:

Large language models (LLMs) have demonstrated immense utility across various industries. However, as LLMs advance, the risk of harmful outputs increases due to incorrect or malicious instruction prompts. While current methods effectively address jailbreak risks, they share common limitations: 1) Judging harmful responses from the prefill-level lacks utilization of the model's decoding outputs, leading to relatively lower effectiveness and robustness. 2) Rejecting potentially harmful responses based on a single evaluation can significantly impair the model's helpfulness.This paper examines the LLMs' capability to recognize harmful outputs, revealing and quantifying their proficiency in assessing the danger of previous tokens. Motivated by pilot experiment results, we design a robust defense mechanism at the decoding level. Our novel decoder-oriented, step-by-step defense architecture corrects harmful queries directly rather than rejecting them outright. We introduce speculative decoding to enhance usability and facilitate deployment to boost secure decoding speed. Extensive experiments demonstrate that our approach improves model security without compromising reasoning speed. Notably, our method leverages the model's ability to discern hazardous information, maintaining its helpfulness compared to existing methods.

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

↑