SpecKV: Adaptive Speculative Decoding with Compression-Aware Gamma Selection

📄 arXiv: 2605.02888v1 📥 PDF

作者: Shikhar Shukla

分类: cs.LG, cs.AI, cs.CL, cs.DC, eess.SY

发布日期: 2026-05-04

备注: 11 pages, 8 figures, 7 tables. Code and data available at: https://github.com/Amorfati123/SpecKV


💡 一句话要点

提出SpecKV以优化大语言模型推理中的推测解码

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 推测解码 自适应控制 大语言模型 模型压缩 多层感知机 自然语言处理 实时推理

📋 核心要点

  1. 现有推测解码方法通常使用固定的推测长度,未能适应不同任务和模型压缩水平的需求。
  2. 本文提出SpecKV,通过草稿模型提取信号自适应选择推测长度γ,以提高推测解码的效率。
  3. 实验结果表明,SpecKV在推测解码中实现了56.0%的性能提升,且统计显著性高(p < 0.001)。

📝 摘要(中文)

推测解码通过使用小型草稿模型提出候选标记,从而加速大型语言模型(LLM)的推理过程。关键超参数推测长度γ决定了草稿模型每步提出的标记数量。现有系统通常使用固定的γ值(通常为4),但实证研究表明,最佳值因任务类型和目标模型的压缩水平而异。本文提出了SpecKV,一个轻量级自适应控制器,能够根据草稿模型提取的信号在每个推测步骤中选择γ。我们在四个任务类别、四个推测长度和三个压缩级别(FP16、INT8、NF4)下对推测解码进行了分析,收集了5112个步骤级记录,展示了最佳γ在不同压缩状态下的变化,以及草稿模型的置信度和熵是接受率的强预测因子。SpecKV通过小型多层感知机(MLP)最大化每步的预期标记数,相较于固定γ=4的基线实现了56.0%的提升,且每次决策仅增加0.34毫秒的开销。

🔬 方法详解

问题定义:本文旨在解决现有推测解码方法中固定推测长度γ导致的效率低下问题。固定的γ值未能适应不同任务和模型压缩水平,影响了推测解码的性能。

核心思路:论文提出的SpecKV通过实时分析草稿模型的信号,动态选择推测长度γ,从而优化每一步的推测效率。这种设计使得模型能够根据当前任务和状态自适应调整,提升了整体性能。

技术框架:SpecKV的整体架构包括信号提取模块、决策模块和执行模块。信号提取模块从草稿模型中获取置信度和熵,决策模块使用小型多层感知机(MLP)根据这些信号选择最佳的推测长度γ,执行模块则进行实际的推测解码。

关键创新:SpecKV的主要创新在于其自适应选择推测长度的能力,区别于传统方法的固定选择。通过利用草稿模型的内部信号,SpecKV能够在不同压缩状态下优化推测过程。

关键设计:在设计中,SpecKV使用了小型MLP来处理提取的信号,损失函数旨在最大化每步的预期标记数。参数设置上,考虑了不同的压缩级别(FP16、INT8、NF4),以确保在多种环境下的有效性。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,SpecKV在推测解码中实现了56.0%的性能提升,相较于固定推测长度γ=4的基线,且每次决策仅增加0.34毫秒的开销,统计显著性达到p < 0.001,表明该方法在效率和准确性上均有显著改进。

🎯 应用场景

该研究的潜在应用领域包括自然语言处理、对话系统和文本生成等。通过优化推测解码,SpecKV能够显著提升大型语言模型在实时推理中的效率,降低计算资源消耗,具有重要的实际价值和广泛的应用前景。

📄 摘要(原文)

Speculative decoding accelerates large language model (LLM) inference by using a small draft model to propose candidate tokens that a larger target model verifies. A critical hyperparameter in this process is the speculation length~$γ$, which determines how many tokens the draft model proposes per step. Nearly all existing systems use a fixed~$γ$ (typically~4), yet empirical evidence suggests that the optimal value varies across task types and, crucially, depends on the compression level applied to the target model. In this paper, we present \textbf{SpecKV}, a lightweight adaptive controller that selects~$γ$ per speculation step using signals extracted from the draft model itself. We profile speculative decoding across 4~task categories, 4~speculation lengths, and 3~compression levels (FP16, INT8, NF4), collecting 5,112 step-level records with per-step acceptance rates, draft entropy, and draft confidence. We demonstrate that the optimal~$γ$ shifts across compression regimes and that draft model confidence and entropy are strong predictors of acceptance rate (correlation~$\approx 0.56$). SpecKV uses a small MLP trained on these signals to maximize expected tokens per speculation step, achieving a 56.0\% improvement over the fixed-$γ$=4 baseline with only 0.34\,ms overhead per decision ($<$0.5\% of step time). The improvement is statistically significant ($p < 0.001$, paired bootstrap test). We release all profiling data, trained models, and notebooks as open-source artifacts.