DuoDecoding: Hardware-aware Heterogeneous Speculative Decoding with Dynamic Multi-Sequence Drafting
提出了DuoDecoding,一种硬件感知的异构推测解码方法,通过动态多序列草稿设计,显著提高了大型语言模型的生成速度。
更新于 2025-03-04。作者:Kai Lv、Honglin Guo、Qipeng Guo、Xipeng Qiu。
中文摘要
大型语言模型(LLMs)在广泛的任务中表现出卓越的性能;然而,它们的逐词自回归生成过程显著降低了推理速度。投机解码提出了一种有前景的先草案后验证框架,能够在保持输出分布保真度的同时减少生成延迟。尽管如此,草案模型引入了额外的计算开销,成为性能瓶颈并增加了首次标记时间(TTFT)。先前缓解草案模型开销的方法主要依赖于启发式方法,并且通常无法达到草案语言模型的质量。为了应对这些挑战,我们提出了DuoDecoding,这是一种新颖的方法,它策略性地在CPU和GPU上分别部署草案和目标模型,从而实现并行解码同时保持草案质量。我们的方法结合了硬件感知的最优草案预算以最小化空闲时间,并采用动态多序列草案来提升草案质量。在七个任务上的大量实验表明,DuoDecoding在生成延迟上实现了高达2.61倍的加速,同时将TTFT降低到传统投机解码的83%。代码可在https://github.com/KaiLv69/DuoDecoding获取。
英文摘要
Large language models (LLMs) exhibit exceptional performance across a wide range of tasks; however, their token-by-token autoregressive generation process significantly hinders inference speed. Speculative decoding presents a promising draft-then-verify framework that reduces generation latency while maintaining output distribution fidelity. Nevertheless, the draft model introduces additional computational overhead, becoming a performance bottleneck and increasing the time to first token (TTFT). Previous approaches to mitigate draft model overhead have primarily relied on heuristics and generally failed to match the quality of the draft language models. To address these challenges, we propose DuoDecoding, a novel approach that strategically deploys the draft and target models on the CPU and GPU respectively, enabling parallel decoding while preserving draft quality. Our method incorporates a hardware-aware optimal draft budget to minimize idle times and employs dynamic multi-sequence drafting to enhance draft quality. Extensive experiments across seven tasks show that DuoDecoding achieves up to 2.61x speedup in generation latency, while reducing TTFT to 83% of that in conventional speculative decoding. The Code is available at https://github.com/KaiLv69/DuoDecoding.
解读
一句话总结
提出了DuoDecoding,一种硬件感知的异构推测解码方法,通过动态多序列草稿设计,显著提高了大型语言模型的生成速度。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:大型语言模型(LLMs)虽然性能出色,但逐个token的自回归生成过程大大阻碍了推理速度。
- 现有方案不足:推测解码虽然能够减少生成延迟,但草稿模型引入了额外的计算开销,成为性能瓶颈,并增加了第一个token的生成时间(TTFT)。
- 研究目标:提出一种新的方法,在保持草稿质量的同时,通过在CPU和GPU上分别部署草稿模型和目标模型来实现并行解码,并最小化空闲时间。
问题2:论文的核心创新点是什么?
- 技术创新:提出在CPU上运行草稿模型,在GPU上运行目标模型,以实现并行解码。
- 方法改进:引入了硬件感知的最佳草稿预算,以最小化空闲时间,并采用动态多序列草稿设计来提高草稿质量。
- 优势:与现有方法相比,DuoDecoding实现了高达2.61倍的生成延迟加速,并将TTFT减少到传统推测解码的83%。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:在七个不同的任务上进行了广泛的实验,包括MT-Bench、机器翻译、摘要、问答、数学推理、检索增强生成和代码生成。
- 性能提升:DuoDecoding实现了高达2.61倍的生成延迟加速,并将TTFT减少了17%。
- 对比结果:与基线方法相比,DuoDecoding在所有任务中都表现出色,实现了显著的性能提升。
问题4:这个研究的实际应用价值是什么?
- 应用场景:适用于需要快速响应的场景,如交互式问答系统、机器翻译和代码生成等。
- 实施建议:在具有不同计算能力的设备上部署DuoDecoding,以充分利用硬件资源。
- 局限与展望:目前的研究主要集中在基线模型,未来可以探索在更大规模模型上的应用,并进一步优化算法以适应不同的硬件平台。