通过流水线设计提升自推测解码效率,显著加速大模型推理。
Pipeline Parallelism is All You Need for Optimized Early-Exit Based Self-Speculative Decoding
- 将草稿与验证过程流水线化,重叠执行以减少空闲时间。
- 在多个基准上实现2.01倍至3.81倍的加速比,接近理论最优。
- 适合追求高吞吐、低延迟推理的场景,如实时生成应用。
大语言模型(LLMs)生成质量高,但因逐个自回归生成输出令牌而带来高昂的推理成本。基于早期退出的自推测解码(EESD)旨在缓解此问题。然而,实践中许多方法即使具备对齐良好的早期退出头和选择的退出位置,仍难以实现预期加速。分析发现,只有当大部分草稿令牌被接受时,EESD才能生效;否则草稿成本可能抵消加速收益,导致负提速。为此,我们提出流水线并行自推测解码(PPSD),完全流水化草稿与验证工作,避免失败预测造成的资源浪费。其核心创新包括:将模型层配置为流水线,使早期退出(草稿)计算与剩余层(验证)计算重叠;按令牌交织进行草稿与验证。当模型在最后几层验证当前令牌时,早期退出路径同时草稿下一个令牌。这种边验证边草稿的机制,使所有计算单元持续忙碌,类似于推测与验证阶段的流水线处理。实证结果表明,PPSD在自推测解码中实现了最先进的加速效果。在多种基准测试中,速度提升率达2.01x~3.81x,达到固定接受率与退出位置下的近最优加速,展现出高效自推测解码的强大能力。
原文摘要 · Abstract (English)
Large language models (LLMs) deliver impressive generation quality, but incur very high inference cost because each output token is generated auto-regressively through all model layers. Early-exit based self-speculative decoding (EESD) has emerged to mitigate this cost. However, in practice, many approaches struggle to achieve the expected acceleration in such draft-then-verify paradigm even with a well-aligned early-exit head and selected exit position. Our analysis reveals that EESD only pays off when the vast majority of draft tokens are accepted by the LLM. Otherwise, the draft cost may overcome the acceleration gain and lead to a negative speedup. To mitigate this, we propose Pipeline-Parallel Self-Speculative Decoding (PPSD) that fully pipelines the draft and verification work so that no effort is wasted on failed predictions. It has two key innovations. We configure the model layers as a pipeline in which early-exit (draft) computations and remaining-layer (verification) computations overlap. We interleave drafting and verification per token. While the LLM is verifying the current token in its final layers, the early-exit path simultaneously drafts the next token. Such a verify-while-draft scheme keeps all units busy and validates tokens on-the-fly analogous to pipelining the speculation and verification stages. Empirical results confirm that PPSD achieves state-of-the-art acceleration in self-speculative LLM inference. On diverse benchmarks, PPSD achieves speedup ratios in the range of 2.01x~3.81x, which gains almost the optimal acceleration at the fixed acceptance rate and exit position, showcasing its advancement in providing efficient self-speculation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。