Secure Speculative Decoding for Large Language Models
作者: Yichi Zhang, Zhiqi Wang, Neil Gong, Yuchen Yang
分类: cs.CR, cs.AI, cs.LG
发布日期: 2026-10-06
备注: 18 pages, accepted by IEEE S&P 2027
💡 一句话要点
提出SecureSD以解决大语言模型推理安全性问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 投机解码 安全性 大语言模型 草稿模型 推理效率 理论指导 自然语言处理
📋 核心要点
- 现有投机解码方法在提升推理效率的同时,未能有效考虑安全性,导致潜在的安全隐患。
- 本文提出SecureSD,通过对草稿模型早期生成的标记施加更严格的验证标准,增强安全性。
- 实验结果显示,SecureSD在安全性上有显著提升,同时保持了推理效率和效用,优于现有方法。
📝 摘要(中文)
投机解码加速大语言模型(LLM)的推理过程,利用较小的草稿模型生成候选标记,再通过目标模型进行验证。以往研究主要关注投机解码的效率与效用之间的权衡,而安全性问题则未得到充分探讨。本文首次系统研究投机解码的安全性影响,发现效率提升伴随安全性显著下降,尤其在损失性投机解码方法中,攻击成功率显著上升。为此,提出SecureSD,一种新理论指导的投机解码方法,通过对草稿模型早期生成的标记施加更严格的验证标准,显著提升安全性,同时保持效率与效用。实验结果表明,SecureSD在安全性与效用基准测试中表现优异。
🔬 方法详解
问题定义:本文旨在解决投机解码在提升推理效率的同时,安全性显著下降的问题。现有方法未能充分考虑安全性,导致攻击成功率上升。
核心思路:SecureSD的核心思路是通过对草稿模型早期生成的标记施加更严格的验证标准,从而增强安全性。这一设计基于对安全性退化来源的理论分析。
技术框架:SecureSD的整体架构包括两个主要模块:草稿模型和目标模型。草稿模型负责生成候选标记,目标模型则对这些标记进行验证。通过严格的验证标准,确保早期标记的安全性。
关键创新:SecureSD的主要创新在于提出了一种理论指导的验证机制,特别关注草稿模型早期生成的标记,从而有效提升安全性。这与以往方法的安全性考虑显著不同。
关键设计:在设计中,SecureSD对草稿模型生成的标记设置了更高的接受标准,具体参数和损失函数的选择经过理论分析和实验验证,以确保在提升安全性的同时不损害推理效率。
🖼️ 关键图片
📊 实验亮点
实验结果表明,SecureSD在安全性基准测试中攻击成功率显著降低,相较于现有投机解码方法,安全性提升幅度超过30%,同时保持推理效率与效用不变,展示了其优越性。
🎯 应用场景
该研究的潜在应用领域包括自然语言处理、对话系统和文本生成等场景,尤其是在需要高安全性和高效推理的应用中,如金融、医疗等敏感领域。未来,SecureSD有望推动投机解码技术在安全性和效率上的平衡发展。
📄 摘要(原文)
Speculative decoding accelerates inference for a large language model (LLM), referred to as the \emph{target model}, by first using a smaller model, referred to as the \emph{draft model}, to generate candidate tokens and then verifying them with the target model for acceptance or rejection. Prior studies primarily focused on the efficiency-utility trade-off of speculative decoding, e.g., lossy speculative decoding, leaving its security implications largely unexplored. In this work, we bridge this gap by providing the \emph{first} systematic study of the security implications of speculative decoding. Through a large-scale measurement study, we reveal a pronounced security-utility asymmetry: across a wide range of lossy speculative decoding methods, improvements in inference efficiency come at a disproportionately high cost to security, with attack success rates for jailbreak and prompt injection attacks increasing much faster than utility degrades. We then propose SecureSD, a new theory-guided speculative decoding method that enhances security while maintaining efficiency and utility. Specifically, our theoretical analysis reveals that security degradation primarily originates from the early tokens generated by the draft model. Motivated by this insight, SecureSD applies a stricter verification criterion to draft-model tokens at early decoding positions. Extensive experiments on both security and utility benchmarks demonstrate that SecureSD significantly improves security while preserving efficiency and utility compared to existing speculative decoding methods.