用三层模型加速大模型推理,小模型也能高效生成。
3-Model Speculative Decoding
- 引入中间验证模型缩小预测差距,提升小模型适用性。
- 在RTX 4090上达124词元/秒,比标准方案快1.91倍。
- 适合资源受限场景,可无缝接入现有推理流程。
推测解码(Speculative Decoding, SD)通过较小的草稿模型预提案头,由更大的目标模型验证以加速大语言模型推理。但其吞吐量受草稿模型大小与令牌接受率之间的权衡限制:草稿模型越小,生成越快,却与目标模型差异越大,导致接受率下降,提速效果减弱。本文提出金字塔推测解码(PyramidSD),在草稿模型与目标模型之间加入一个中间验证模型,弥合输出分布差距,使更小的草稿模型也可用于生成。该分层解码策略增强模型间对齐,提高接受率,并支持每阶段宽松的模糊接受阈值,进一步提升吞吐量。实验表明,PyramidSD在消费级显卡RTX 4090上达到124 tokens/s,较标准SD提升1.91倍;当使用1B参数草稿模型和8B目标模型时,仅轻微牺牲目标模型质量即可显著提升推理效率。整体而言,PyramidSD为提升推测解码效率提供了一种实用且可直接集成的方案。
原文摘要 · Abstract (English)
Speculative Decoding (SD) accelerates inference in large language models by using a smaller draft model to propose tokens, which are then verified by a larger target model. However, the throughput gains of SD are fundamentally limited by a trade-off between draft model size and token acceptance: smaller draft models generate tokens more quickly but exhibit greater divergence from the target model, resulting in lower acceptance rates and reduced speedups. We introduce Pyramid Speculative Decoding (PyramidSD), an extension of SD that inserts an intermediate qualifier model between the draft and target to bridge the distributional gap in output predictions, allowing smaller model to be used for drafting. This hierarchical decoding strategy improves alignment across models, enabling higher acceptance rates and allowing the use of significantly smaller draft models without sacrificing overall performance. PyramidSD builds on fuzzy acceptance criteria to support relaxed divergence thresholds at each stage, improving throughput. In experiments, PyramidSD achieves up to 1.91x generation speed over standard SD, reaching 124 tokens per second on a consumer GPU (RTX 4090). In small-memory settings with a 1B-parameter draft model and an 8B target model, PyramidSD minimally trades target model quality for improved throughput. Overall, PyramidSD offers a practical approach to enhancing speculative decoding efficiency and can be readily applied to existing inference pipelines.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。