arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2310.08461cs.CLcs.AIcs.LG
收藏

DistillSpec:通过知识蒸馏改进投机解码

DistillSpec: Improving Speculative Decoding via Knowledge Distillation

Google Research(谷歌研究院);University of Toronto(多伦多大学);Google DeepMind(谷歌DeepMind);Princeton University(普林斯顿大学);Mila(米拉计算科学研究所)

Yongchao Zhou, Kaifeng Lyu, Ankit Singh Rawat, Aditya Krishna Menon, Afshin Rostamizadeh, Sanjiv Kumar, Jean-François Kagy, Rishabh Agarwal

AI总结:

本文提出 DistillSpec,在投机解码前用知识蒸馏对齐草稿模型与目标模型,通过在线策略数据生成和定制散度函数,在多个基准上实现 10-45% 加速,并结合有损 SD 控制延迟与性能权衡。

摘要:

投机解码(SD)通过使用更快的草稿模型生成多个 token,再由更大的目标模型并行验证来加速大语言模型推理,从而使生成的文本符合目标模型的分布。然而,找到一个与目标模型高度对齐的紧凑草稿模型具有挑战性。为解决这一问题,我们提出 DistillSpec,在应用 SD 之前利用知识蒸馏使草稿模型与目标模型更好地对齐。DistillSpec 做出了两个关键设计选择,我们通过系统研究证明它们对于改善草稿模型与目标模型的对齐至关重要:利用来自草稿模型的在线策略数据生成,以及根据任务和解码策略定制散度函数。值得注意的是,在一系列标准基准上,使用贪心和非贪心采样时,DistillSpec 相比标准 SD 取得了令人印象深刻的 10 - 45% 的加速。此外,我们将 DistillSpec 与有损 SD 结合,以实现对延迟与任务性能之间权衡的细粒度控制。最后,在模型规模不同的实际场景中,先使用蒸馏提升目标模型的性能,再应用 DistillSpec 训练一个对齐良好的草稿模型,与不使用蒸馏的标准解码相比,可以将解码延迟降低 6-10 倍,同时性能下降最小。

英文摘要:

Speculative decoding (SD) accelerates large language model inference by employing a faster draft model for generating multiple tokens, which are then verified in parallel by the larger target model, resulting in the text generated according to the target model distribution. However, identifying a compact draft model that is well-aligned with the target model is challenging. To tackle this issue, we propose DistillSpec that uses knowledge distillation to better align the draft model with the target model, before applying SD. DistillSpec makes two key design choices, which we demonstrate via systematic study to be crucial to improving the draft and target alignment: utilizing on-policy data generation from the draft model, and tailoring the divergence function to the task and decoding strategy. Notably, DistillSpec yields impressive 10 - 45% speedups over standard SD on a range of standard benchmarks, using both greedy and non-greedy sampling. Furthermore, we combine DistillSpec with lossy SD to achieve fine-grained control over the latency vs. task performance trade-off. Finally, in practical scenarios with models of varying sizes, first using distillation to boost the performance of the target model and then applying DistillSpec to train a well-aligned draft model can reduce decoding latency by 6-10x with minimal performance drop, compared to standard decoding without distillation.

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

↑