arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.34440cs.LGcs.DCcs.PF
收藏

混合专家模型的推测解码:专家字节、内核带宽与最优草稿长度

Speculative Decoding for Mixture-of-Experts Models: Expert Bytes, Kernel Bandwidth and the Best Draft Length

ReClan AI Studio, LLC(ReClan AI 工作室有限责任公司)

Yuzheng Lan

AI总结:

该研究针对MoE模型的推测解码,提出去重引擎方法,推导最优草稿长度条件,在Metal、MLX-LM、CUDA等平台验证,预测去重加速效果,为MoE模型推测解码优化提供依据。

摘要:

推测解码在一次验证过程中可检查多个草稿令牌。在混合专家(MoE)模型中,连续令牌常选择相同的专家。去重引擎每次过程仅读取每个选中专家一次,因此其请求的字节数少于按令牌读取的按槽引擎。我们将一步的时间表示为每个内核在其有效带宽上请求的字节数加上固定时间。在几何接受率下,我们从该步时间推导出推测解码快于普通解码的条件。最优草稿长度是接受率的单调阶梯函数。我们界定了带宽误差对各结果的影响,并在Lean中验证了主要步骤。去重仅在其占按槽字节的份额$\bar{u}(n)$低于其占按槽带宽的比率$r(n)$时更快。在Metal、MLX-LM和我们修改以支持去重的CUDA上,按槽内核具有更高的有效带宽($r=0.32$至$0.75$)。因此去重仅在每次过程5至8个令牌时更快,否则不更快。我们对单层专家操作的带宽进行拟合,每个模型单独运行耗时不到一小时。路由轨迹的字节数结合这些带宽可预测去重节省的时间。在CUDA和MLX-LM上,测量的节省量在其误差范围内,在Metal的48个点中占36个点。交叉点是去重更快的首次过程大小。预测在引擎、模型和深度的12种配置中的10种中,将其置于一个过程大小范围内。我们在测量后计算这些预测。在DeepSeek-V2-Lite上,其推测运行前测量的操作时间在所有22个接受值下给出了最优草稿长度。

英文摘要:

Speculative decoding checks several drafted tokens in one verification pass. On a mixture-of-experts (MoE) model, consecutive tokens often select the same experts. A deduplicating engine reads each selected expert once per pass, so it requests fewer bytes than a per-slot engine, which reads it once per token. We write a step's time as the bytes each kernel requests over its effective bandwidth, plus fixed time. Under geometric acceptance, we derive from this step time when speculation is faster than plain decoding. The best draft length is a monotone staircase in the acceptance rate. We bound how a bandwidth error moves each result, and we check the main steps in Lean. Deduplication is faster exactly where its share $\bar u(n)$ of the per-slot bytes is below its ratio $r(n)$ of the per-slot bandwidth. On llama.cpp Metal, MLX-LM and llama.cpp CUDA, which we modified to deduplicate, the per-slot kernel has the higher effective bandwidth (r = 0.32 to 0.75). Thus deduplication is faster only from 5 to 8 tokens per pass, or never. We fit the bandwidths on one layer's expert operation, run alone, in under an hour per model. Bytes from routing traces over these bandwidths predict the time that deduplication saves. The measured saving lies inside its error bound at every point on CUDA and MLX-LM and at 36 of 48 points on Metal. The crossover is the first pass size at which deduplication is faster. The prediction places it within one pass size in 10 of 12 configurations of engine, model and depth. We computed these predictions after the measurements. On DeepSeek-V2-Lite, operation times measured before its speculative runs give the best draft length on CUDA within one at all 22 acceptance values.

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

↑