SpecPilot:面向推测解码的自主算法发现与系统优化

·

研究论文 · 2026/11/04

Speculative decoding 通过轻量级 drafter 加速内存受限的 LLM 解码,而并行 drafters 通过一次前向传播起草整个块来扩展加速。然而,尚不清楚其发布的系统(stock)是否达到并行起草允许的完全加速。我们识别了三个挑战:单请求时每步接受少量 token 但读取每个目标权重;批处理时每请求验证工作大约使自回归(AR)解码的加速减半;推测解码是部署特定的,没有通用优化适合每个服务场景、drafter、目标模型和 GPU。为解决这些挑战,我们提出 SpecPilot,一个自主代理循环,为每个部署发现算法和系统优化。每轮中,成本模型定位当前系统与其上限之间的最大差距。并行代理探索方向并整合成功的方向。Token forcing 检查每个输出 token 与 stock 对比以检测奖励黑客。结构化内存将验证的机制传递到新轮次和部署。SpecPilot 发现了一种通用无损 12 位权重格式、混合循环目标的树验证、两级验证和三种批处理机制。我们在四个目标模型、三个 drafters、两个 GPU 平台和五个基准上评估。无需训练或质量损失,它将单请求下相对于 AR 的加速从 stock 的 4.46 倍提高到 10.87 倍,批处理下从 1.94 倍提高到 3.93 倍。

SpecPilot 通过自主代理循环自动发现推测解码的算法和系统优化,显著提升加速比且无需训练或质量损失,为部署特定的优化提供了新范式。

Speculative decoding accelerates memory-bound LLM decoding with a lightweight drafter, and parallel drafters extend this speedup by drafting a whole block in one forward pass. However, it remains unclear whether their released systems (stock) attain the full speedup that parallel drafting permits. We identify three challenges. First, with one request, each step accepts few tokens but reads every target weight. Second, with batching, per-request verification work roughly halves the speedup over autoregressive (AR) decoding. Third, speculative decoding is deployment-specific, and no universal optimization fits every serving regime, drafter, target model and GPU. To address these challenges, we present SpecPilot, an autonomous agentic loop that discovers algorithms and systems optimizations for each deployment. In each round, a cost model locates the largest gaps between the current system and its ceiling. Parallel agents explore directions and integrate the successful ones. Token forcing checks every output token against stock to detect reward hacking. A structured memory carries validated mechanisms to new rounds and deployments. SpecPilot discovered a general lossless 12-bit weight format, tree verification for hybrid recurrent targets, two-level verification and three batching mechanisms. We evaluate it across four target models, three drafters, two GPU platforms and five benchmarks. Without training or quality loss, it raises the speedup over AR from stock's 4.46times to 10.87times with one request, and from 1.94times to 3.93times with batching.

阅读原文

参与讨论