arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.11850cs.CL
收藏

PEARL:具有自适应草稿长度的并行投机解码

PEARL: Parallel Speculative Decoding with Adaptive Draft Length

University of Science and Technology of China(中国科学技术大学);Tencent(腾讯);OpenGVLab(开放智能机器研究所);Shanghai AI Laboratory(上海人工智能实验室)

Tianyu Liu, Yun Li, Qitan Lv, Kai Liu, Jianchen Zhu, Winston Hu, Xiao Sun

AI总结:

针对投机解码中草稿模型与目标模型相互等待的问题,提出 PEARL 框架,通过预验证、后验证和自适应草稿长度并行两阶段,最高实现 4.43× 加速。

摘要:

投机解码(Speculative decoding,SD)使用一个额外的草稿模型首先提供多个草稿 token,随后由原始目标模型并行验证这些 token,已在 LLM 推理加速方面展现出强大能力。然而,现有 SD 方法存在相互等待问题,即当草稿模型猜测 token 时目标模型会停滞,反之亦然。该问题由草稿模型与目标模型的异步执行直接引发,并因投机解码中固定的草稿长度而加剧。为应对这些挑战,我们提出了一个概念简单、灵活且通用的框架来增强投机解码,即具有自适应草稿长度的并行投机解码(Parallel spEculative decoding with Adaptive dRaft Length,PEARL)。具体而言,PEARL 提出预验证,在草稿阶段提前验证第一个草稿 token;并提出后验证,在验证阶段生成更多草稿 token。PEARL 通过应用这两种策略使草稿阶段与验证阶段并行化,并针对不同场景实现自适应草稿长度,从而有效缓解相互等待问题。在多种文本生成基准上的实验证明了 PEARL 的有效性:与自回归解码和普通投机解码相比,其分别实现了最高 4.43× 和 1.50× 的优异加速性能。我们的代码可在 https://github.com/smart-lty/ParallelSpeculativeDecoding 获取。

英文摘要:

Speculative decoding (SD), where an extra draft model is employed to provide multiple draft tokens first, and then the original target model verifies these tokens in parallel, has shown great power for LLM inference acceleration. However, existing SD methods suffer from the mutual waiting problem, i.e., the target model gets stuck when the draft model is guessing tokens, and vice versa. This problem is directly incurred by the asynchronous execution of the draft model and the target model and is exacerbated due to the fixed draft length in speculative decoding. To address these challenges, we propose a conceptually simple, flexible, and general framework to boost speculative decoding, namely Parallel spEculative decoding with Adaptive dRaft Length (PEARL). Specifically, PEARL proposes pre-verify to verify the first draft token in advance during the drafting phase, and post-verify to generate more draft tokens during the verification phase. PEARL parallels the drafting phase and the verification phase via applying the two strategies, and achieves adaptive draft length for different scenarios, which effectively alleviates the mutual waiting problem. Experiments on various text generation benchmarks demonstrate the effectiveness of our PEARL, leading to a superior speed up performance up to 4.43$\times$ and 1.50$\times$, compared to auto-regressive decoding and vanilla speculative decoding, respectively. Our code is available at https://github.com/smart-lty/ParallelSpeculativeDecoding.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑