Hydra:用于Medusa解码的序列依赖型草稿头
Hydra: Sequentially-Dependent Draft Heads for Medusa Decoding
AI总结:
针对现有Medusa解码中序列独立型草稿头推测准确率低的问题,提出序列依赖的Hydra头及优化方案Hydra++,显著提升了大语言模型推测解码的端到端速度与吞吐量。
摘要:
为应对自回归大语言模型(LLM)推理受内存带宽限制的特性,已有研究提出了推测解码框架。执行推测解码时,小型草稿模型会生成输入序列的候选续接内容,随后由基础模型并行验证。近期Medusa解码框架采用的一种草稿模型实现方式,是一组在基础模型隐藏状态上运行的轻量头,称为草稿头。截至目前,所有现有草稿头均为序列独立型,即它们对候选续接内容中词元的推测与候选续接内的任何前置词元无关。本研究提出Hydra头:一种可直接替换标准草稿头的序列依赖型方案,能显著提升草稿头推测的准确率。我们进一步探索了Hydra头训练目标与架构的设计空间,并提出了经过精心调优的Hydra头方案,命名为Hydra++,其解码吞吐量相较于Medusa解码和自回归解码分别提升最高达1.31倍和2.70倍。总体而言,Hydra头是对标准草稿头的一种简单且有充分理论依据的改进,能显著提升基于草稿头的推测解码的端到端速度。我们已在https://github.com/zankner/Hydra 公开代码。
英文摘要:
To combat the memory bandwidth-bound nature of autoregressive LLM inference, previous research has proposed the speculative decoding frame-work. To perform speculative decoding, a small draft model proposes candidate continuations of the input sequence that are then verified in parallel by the base model. One way to specify the draft model, as used in the recent Medusa decoding framework, is as a collection of lightweight heads, called draft heads, that operate on the base model's hidden states. To date, all existing draft heads have been sequentially independent, meaning that they speculate tokens in the candidate continuation independently of any preceding tokens in the candidate continuation. In this work, we propose Hydra heads: a sequentially-dependent drop-in replacement for standard draft heads that significantly improves the accuracy of draft head speculation. We further explore the design space of Hydra head training objectives and architectures, and propose a carefully tuned Hydra head recipe, which we call Hydra++, that improves decoding throughput by up to 1.31x and 2.70x compared to Medusa decoding and autoregressive de-coding respectively. Overall, Hydra heads are a simple and well-motivated intervention on standard draft heads that significantly improve the end-to-end speed of draft head-based speculative decoding. We make our code publicly available at https://github.com/zankner/Hydra.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。