提出高效计算多草稿推测解码最优接受率的方法
Towards Optimal Multi-draft Speculative Decoding
- 通过求解对偶优化问题,高效计算最优接受率
- 首次量化验证算法与理论上限的差距,发现现有方法未达最优
- 证明不放回采样优于放回采样,指导未来算法设计
大型语言模型(LLMs)在自然语言处理中不可或缺,但自回归采样已成为效率瓶颈。多草稿推测解码(MDSD)通过小规模草稿模型生成多个候选序列,并由目标LLM并行验证,确保输出符合目标分布。其关键设计包括草稿采样方法和验证算法。本文分析了最优接受率对应的最优传输问题的对偶形式,实现了高效计算。首次针对词汇量达数千的情况测量了MDSD的理论效率上限,并量化了现有验证算法与该上限的差距。结果表明,草稿采样方式显著影响最优接受率,不放回采样优于放回采样;且现有验证算法均未达到理论上限。研究提示,精心设计的采样策略可提升接受率,推动更接近理论极限的验证算法发展。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have become an indispensable part of natural language processing tasks. However, autoregressive sampling has become an efficiency bottleneck. Multi-Draft Speculative Decoding (MDSD) is a recent approach where, when generating each token, a small draft model generates multiple drafts, and the target LLM verifies them in parallel, ensuring that the final output conforms to the target model distribution. The two main design choices in MDSD are the draft sampling method and the verification algorithm. For a fixed draft sampling method, the optimal acceptance rate is a solution to an optimal transport problem, but the complexity of this problem makes it difficult to solve for the optimal acceptance rate and measure the gap between existing verification algorithms and the theoretical upper bound. This paper discusses the dual of the optimal transport problem, providing a way to efficiently compute the optimal acceptance rate. For the first time, we measure the theoretical upper bound of MDSD efficiency for vocabulary sizes in the thousands and quantify the gap between existing verification algorithms and this bound. We also compare different draft sampling methods based on their optimal acceptance rates. Our results show that the draft sampling method strongly influences the optimal acceptance rate, with sampling without replacement outperforming sampling with replacement. Additionally, existing verification algorithms do not reach the theoretical upper bound for both without replacement and with replacement sampling. Our findings suggest that carefully designed draft sampling methods can potentially improve the optimal acceptance rate and enable the development of verification algorithms that closely match the theoretical upper bound.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。