SpecOPD:面向投机解码的分支并行同策略蒸馏

·

研究论文 · 2026/11/05

SpecOPD 是一种用于投机解码的分支并行在线策略蒸馏框架。传统在线策略蒸馏通过顺序的草稿-验证 rollout 收集监督信号,效率受限于顺序依赖。SpecOPD 的关键洞察是:草稿块的监督仅需参考前缀和草稿采样的历史,无需继承顺序依赖。该框架在参考锚点处从演进的草稿策略中采样多个独立分支,并行进行草稿采样和目标监督,并将这些分支打包成提议树以共享目标前缀计算。针对不同注意力机制,采用树掩码(全注意力)、分支一致的索引器组(稀疏注意力)和索引状态回放(线性注意力)来保持各分支历史。使用 E2E-TV 代理目标直接优化接受长度。实验覆盖 8B 全注意力(GQA)、27B 全线性(GQA-GDN)和 125B 稀疏线性(QSA-GDN)目标模型,三种并行草稿架构(DFlash、DSpark、DFlash V2)和四个任务领域(对话、编码、数学、智能体)。SpecOPD 在原生配置下平均接受长度提升高达 41.45%,监督令牌吞吐量是顺序 rollout OPD 的 16.09 倍,相比自回归解码生成加速高达 3.56 倍。

该研究提出了一种高效的并行在线策略蒸馏方法,显著提升了投机解码的接受长度和训练吞吐量,并在多种模型规模和架构上验证了有效性,对加速大语言模型推理具有重要实践意义。

Speculative decoding (SD) accelerates large language model inference by reducing the sequential cost of token-by-token generation. Advanced SD methods reduce proposal cost with parallel drafters that predict entire blocks in one forward pass, but overall speedup still depends on acceptance length. On-policy distillation (OPD) can push well-trained drafters beyond acceptance-length plateaus, yet conventional pipelines collect supervision through sequential draft-and-verify rollouts. Our key insight is that on-policy supervision need not inherit these dependencies: a draft block can be supervised using only its reference prefix and draft-sampled history. We propose SpecOPD, a branch-parallel OPD framework that parallelizes draft sampling and target supervision across independent branches drawn from the evolving drafter policy at reference anchors. We pack these branches into proposal trees to share target-prefix computation, using tree masks for full attention, branch-consistent indexer groups for sparse attention, and indexed state replay for linear attention to preserve each branch's history. We train the drafter with an E2E-TV surrogate that directly targets acceptance length. Our study spans 8B full-attention (GQA), 27B full-linear (GQA--GDN), and 125B sparse-linear (QSA--GDN) targets, three parallel draft architectures (DFlash, DSpark, and DFlash V2), and four task domains (dialogue, coding, mathematics, and agentic). SpecOPD achieves up to 41.45% higher mean acceptance length, 16.09times supervised-token throughput over sequential-rollout OPD under native configurations, and up to 3.56times generation speedup over autoregressive decoding.

阅读原文

参与讨论