大模型
developer.nvidia.com ·
@Tanya Lenz
AI模型协同设计:使用推测解码加速LLM推理
本文是AI模型协同设计系列第三篇,探讨如何通过推测解码在保持准确性的同时加速LLM推理,提供技术细节和实现方法。
AI推荐理由 NVIDIA官方博客系列文章,介绍推测解码加速LLM推理,技术性强,对AI工程师有直接参考价值。
90
正文
开发者工具与技术
使用推测解码共同设计AI模型,实现更快的LLM推理
2026年9月2日
作者:Tiyasa Mitra, Maximilian Golub, Maor Ashkenazi, Samkit Jain, Nidhi Bhatia 和 Bita Darvish Rouhani
喜欢
L
T
F
R
E
AI生成摘要
推测解码通过让一个小型草稿模型提出多个令牌,并由一个更大的目标模型并行验证,从而加速LLM推理,减少解码迭代次数,同时保持输出准确性。
五条指南有助于在帕累托前沿选择最优草稿长度和机制:将GEMM推入计算受限区域而不增加KV缓存压力;当注意力占主导时,将草稿长度设置为128/G - 1;将较大的草稿长度与128的注意力内核瓦片边界对齐;在极低延迟下,仅当接受增益证明额外草稿成本合理时才增加草稿长度;并通过平衡接受长度、草稿开销以及训练和部署成本来选择草稿机制。
比较的草稿机制包括外部草稿模型、EAGLE-3、MTP、DFlash、DSpark以及后缀或n-gram方法,每种方法在训练成本、服务时内存和每个草稿令牌的推测成本方面都有不同的权衡。
SPEED-Bench是NVIDIA开发的推测解码基准,提供真实工作负载,用于测量编码和摘要等任务领域的接受长度。
NVIDIA/Model-Optimizer中提供了EAGLE-3、DFlash和DSpark的即用训练示例,包括在Nemotron 3.5 Lightning上演示的微调和量化工作流。
后续步骤
探索NVIDIA/Model-Optimizer仓库,获取训练示例和量化工作流。
使用真实提示和多样化任务领域在SPEED-Bench上基准测试接受长度。
使用NVIDIA TensorRT LLM量化草稿开销,以实现高性能推理。
由NVIDIA Nemotron提供支持。AI生成的内容可能不完整地总结信息。请验证重要信息。了解更多
本文是AI模型协同设计系列文章的第三篇。它探讨了如何使用推测解码在保持准确性的同时加速LLM推理,并提供了在帕累托前沿选择草稿长度和草稿机制的五条指南。
关于模型设计选择如何在不牺牲准确性的情况下影响吞吐量和交互性,请参阅AI模型协同设计:硬件友好的LLM设计(第1部分)。关于组大小(每个KV头的查询头数)、头维度和序列长度如何影响密集注意力的性能,请参阅协同设计AI模型注意力以实现快速、交互式长上下文推理(第2部分)。
什么是推测解码?
推测解码是一种通过每次迭代预测多个令牌来加速LLM推理自回归解码阶段的技术。一个小型草稿模型首先预测几个可能的后续令牌。然后,这些令牌通过一次通过更大的目标模型进行并行验证。
图1. 推测解码将LLM解码推向更计算受限的区域,将吞吐量-交互性帕累托前沿向上和向右移动。随着交互性向曲线右侧增加,批大小减小,GEMM在运行时中的占比大于注意力。
这种方法减少了总解码迭代次数,同时增加了目标模型的算术强度,而无需更高的并发性。目标模型按顺序接受提议的令牌,直到遇到第一个不匹配。下一个预测周期从该位置恢复。由于只有目标模型接受的令牌被保留,推测解码产生与标准解码相同的输出序列,除非接受标准被故意放宽。图2说明了这种解码流程。
草稿长度(\(D\))是每次目标迭代提议的令牌数。接受长度(\(AL\))是每次目标迭代产生的(即接受的)令牌数。\(AL\)的范围从\(1\)到\(1 + D\),因为目标除了接受的草稿令牌外,总能产生一个新的真实令牌。
推测解码的加速可以量化为目标模型顺序生成\(AL\)个令牌所需时间与并行验证D个令牌所需时间之比,同时考虑生成D个令牌的延迟开销:
\(\mathrm{speedup} = \frac{T_{\mathrm{verif}}(B) \times \mathrm{AL}}{T_{\mathrm{verif}}\left(B \times (1 + D)\right) + T_{\mathrm{draft}}(B, D)}\)
其中\(B\)是批大小,\(T_{\mathrm{verif}}(x)\)是验证\(x\)个令牌的目标验证时间,\(T_{\mathrm{draft}}(b, y)\)是为批大小\(b\)生成长度为\(y\)的草稿所需的时间。显然,为了最大化加速,需要找到最优的\(\left(D, AL, T_{\mathrm{draft}}\right)\)元组。
图2. 推测解码的草稿-然后-验证流程。一个较小的草稿模型提出\(D\)个令牌,目标模型在一次传递中一起验证它们。
选择最优草稿长度
为简单起见,如果我们忽略草稿模型延迟,推测在以下情况下提供加速:
\(\frac{T_{\mathrm{verif}}\left(B \times (1 + D)\right)}{T_{\mathrm{verif}}(B)} \frac{128}{G} – 1\),优先选择\(G \times (1 + D)\)是128的倍数的值,以避免瓦片利用率不足。
指南1相对于指南2和3的相对权重取决于在首选操作点上FFN与注意力相比在运行时中的百分比。通信也会随着D的增加增加验证成本,尽管计算和通信重叠可以减轻开销。
帕累托曲线最右侧的草稿长度
向帕累托曲线最右侧移动时,\(B\)变得非常小。在这里,固定的内核设置和后处理开销在计算和通信内核中占主导地位。
这些固定成本不会随着验证令牌数量的增加而显著增长,使得验证开销在很大程度上与草稿令牌数量无关。
虽然MoE确实会随着草稿长度的增加激活更多专家,但模型分片策略和高效内核(如分组GEMM)的组合可以保持此开销较低。因此,在低延迟区域,只要接受率保持较高,较大的草稿长度可能会有帮助。
在极低延迟下,顺序内核启动的数量决定了工作负载延迟。由于内核启动随层数线性扩展,对于与目标具有相似层结构的自回归草稿模型,加速可以近似为:
\(\mathrm{speedup} = \frac{L_{\mathrm{target}} \times \mathrm{AL}}{L_{\mathrm{target}} + D \times L_{\mathrm{draft}}}\)
其中\(L_{\mathrm{target}}\)和\(L_{\mathrm{draft}}\)分别是目标模型和草稿模型的层数。定义常数草稿深度比,\(\rho = \frac{L_{\mathrm{draft}}}{L_{\mathrm{target}}}\):
\(\mathrm{speedup} = \frac{\mathrm{AL}}{1 + \rho D}\) 且草稿开销,\(O_d = \rho D\)
换句话说,增加\(D\)只有在\(AL\)的增益足够大以抵消草稿开销时才有帮助。
指南4:在极低延迟下,仅当\(AL\)的增益证明额外草稿成本合理时才增加\(D\)。
选择草稿机制
选择\(D\)告诉您要推测多少个令牌。接下来,决定如何生成这些令牌以最大化加速。
多年来提出了多种技术,在训练、参数和运行时成本方面有不同的权衡。外部草稿建议使用一个小型独立LLM,而MTP、EAGLE-3、DFlash和DSpark使用辅助层结合目标模型的信息来预测令牌。后缀和n-gram方法是无模型的,而是重用令牌流中已经出现的模式。
表1比较了关键草稿方法,包括它们如何生成令牌、服务时内存和草稿开销。
外部草稿模型 EAGLE-3 MTP DFlash DSpark 后缀/n-gram 草稿架构 小型LLM 解码器层+线性投影 解码器层+线性投影 解码器层+线性KV融合 解码器层+线性KV融合+轻量级马尔可夫头 字符串匹配,无模型 输入 令牌ID 先前令牌嵌入+目标隐藏状态 目标最终隐藏状态 融合的目标隐藏状态用作草稿KV 融合的目标隐藏状态用作草稿KV 令牌流 生成方法 \(D\)次自回归前向传递 运行模块\(D\)次 运行模块\(D\)次 在一个并行步骤中生成\(D\)个令牌 在一个并行步骤中生成\(D\)个令牌,然后进行轻量级顺序校正 一次查找 发布方法 单独模型发布 单独的后训练头 基础模型检查点的一部分 单独的后训练头 单独的后训练头 独立于目标 训练成本 从头开始:1T-10T+令牌 蒸馏:100B-400B 适应:10M-1B 目标训练后额外1-10B令牌 通常在预训练期间与目标一起训练 目标训练后额外1-10B令牌 目标训练后额外1-10B令牌 无 激活内存成本 草稿权重+完整KV缓存 权重+小KV缓存 权重+小KV缓存 权重+由目标构建的小KV缓存 权重+由目标构建的小KV缓存 无 每个\(D\)令牌的推测成本 完整草稿模型前向 1层,串行 1层,串行 ~5层,一次 ~5层一次+轻量级马尔可夫头,串行 O(1)查找 最适合 LPU和LPU+GPU 不推荐用于GPU 不推荐 – \(AL\)低于MTP 最适合GPU上的较大模型 较小模型,批大小1 较小模型,批大小1 重复性高的工作负载 表1. 常见草稿机制在输入、生成方法、训练成本、服务时内存和草稿成本方面的比较
为了量化\(AL\)和\(O_d\)之间的权衡,首先观察\(AL\)如何随\(D\)变化。
图6显示了在SPEED-Bench上,以Qwen 3.5 122B A10B为目标,随着D增加AL如何变化。SPEED-Bench是NVIDIA开发的推测解码基准,旨在代表真实生产工作负载。它涵盖多个任务领域,如编码和摘要,并在不同输入序列长度上有多种分割。我们推荐使用SPEED-Bench进行\(AL\)比较。
在32K分割上,Qwen 3.5 35B A3B在\(D = 9\)时达到\(AL\)为6,而4B草稿达到AL超过5。MTP和DFlash的AL随着\(D\)的增长而趋于平稳。N-gram在此工作负载上接受率较低,更适合具有重复令牌模式的工作负载。
图6. 在SPEED-Bench上,不同草稿机制的\(AL\)与\(D\)的关系,吞吐量32K分割,目标为Qwen 3.5 122B A10B
更高的\(AL\)并不等于更高的加速。您还需要考虑生成草稿的成本。
如图6所示,在\(D > 3\)时,所有外部草稿的\(AL\)都高于其他草稿方法。Qwen 3.5 122B MTP要小得多,总参数为2.5B,活跃参数少于150M。在\(D = 3\)时,较大的外部草稿可能不值得额外成本。在\(D = 21\)时,其更高的AL可能使该成本值得,假设采用高效的服务策略。
同时,DFlash的\(AL\)相对较快地趋于平稳。然而,DFlash和DSpark都并行生成\(D\)个草稿令牌,降低了\(O_d\)。作为比较,在最小延迟和\(D=11\)时,一层MTP头需要11步,导致\(O_d^{\mathrm{MTP}} = \frac{11}{L_{\mathrm{target}}}\),而五层DFlash头在一次传递中生成草稿,给出\(O_d^{\mathrm{DFlash}} = \frac{5}{L_{\mathrm{target}}}\)。
对于具有许多层的大型目标模型,两种开销都可以忽略不计,但随着\(L_\mathrm{target}\)减小,草稿开销变得显著。因此,对于低延迟下的小型模型,即使\(AL\)较低,DFlash或DSpark也可能是最佳选择。
为了在\(AL\)和草稿延迟之间进行权衡,准确基准测试两者至关重要。在推测解码的背景下,这意味着使用真实提示并覆盖广泛的任务领域进行基准测试。我们推荐使用SPEED-Bench进行\(AL\)测量,并使用高性能推理框架(如NVIDIA TensorRT LLM)来量化草稿开销。
除了推理性能,草稿训练范围和成本也值得考虑。虽然MTP必须与目标模型共同训练,但EAGLE、DFlash和DSpark可以添加到最终模型检查点。类似地,外部草稿模型的创建存在一系列选项。从头训练和从目标蒸馏产生最高的AL,而通过跨模型适应技术将现有模型适应到所需目标可以显著降低训练成本,但会牺牲\(AL\)。
微调目标模型可以改变其输出分布和隐藏表示。因此,为特定目标检查点训练的学习草稿器可能会失去接受率,即使目标模型有所改进。更改目标后,在代表性工作负载上重新测量\(AL\)。所需的适应取决于草稿机制。
MTP是目标模型的一部分,应在微调期间继续训练,或在专门的后续阶段重新对齐。目标附加草稿器(如EAGLE-3、DFlash和DSpark)使用目标的隐藏状态,需要通过额外训练适应更新后的检查点。
外部草稿模型不消耗目标隐藏状态,但它们仍然近似目标的输出分布,可能需要微调或蒸馏。后缀和n-gram方法没有学习草稿器,因此不需要重新训练,尽管它们的有效性仍然取决于部署工作负载中重复出现的程度。
指南5:根据工作负载和硬件,选择在解码加速方面最佳的草稿机制,考虑\(AL\)、草稿延迟以及训练和部署成本。
开始协同设计推测解码
使用下面总结的五条指南作为在帕累托前沿选择\(D\)和草稿机制的检查清单。
增加推测解码草稿长度,将GEMM推入计算受限区域,而不增加KV缓存容量压力。
当注意力主导解码时间时,选择\(D = \frac{128}{G} – 1\)作为起点。
对于较大的草稿长度,优先选择\(G \times (1 + D)\)是128的倍数的值,以与注意力内核瓦片大小对齐。
在极低延迟下,使用快速草稿机制,并仅当\(AL\)的增益证明额外草稿成本合理时才增加\(D\)。
通过平衡工作负载和硬件的\(AL\)和草稿开销来选择草稿机制。在真实服务条件下基准测试两者,并考虑训练和部署成本。
对于后训练草稿器,NVIDIA/Model-Optimizer中提供了EAGLE-3、DFlash和DSpark的即用训练示例。查看我们如何为NVIDIA Nemotron 3.5 Lightning做到这一点:微调DSpark,然后将其量化为FP8或NVFP4。使用这些示例作为起点,然后在您自己的模型、工作负载和硬件上验证AL和端到端速度。
致谢
本文是NVIDIA跨团队的努力。我们感谢Bhargava Gopireddy、Ritika Borkar、Dor Tsur、Andrii Skliar、Benjamin Chislett、Yaniv Galron、Talor Abramovich、Yoav Miron、Rabeeh Karimi Mahabadi、Roger Waleffe、Udi Karpas、Ran Zilberstein、Brian Pharris和Eduardo Alvarez的帮助。
喜欢
标签
代理AI / 生成式AI | 数据中心 / 云 | 开发者工具与技术 | 硬件 / 半导体 | 通用 | 中级技术 | 最佳实践 | 深入探讨 | AI推理 | 推理性能 | LLM | NVFP4 | 训练AI模型
关于作者
关于Tiyasa Mitra
Tiyasa Mitra是NVIDIA的高级AI和机器学习工程师,她领导通过算法-硬件协同设计提高生成式AI效率的前沿技术工作。她在数据中心优化和网络方面拥有超过十年的经验,在构建大规模高性能AI系统方面有着良好的记录。Tiyasa拥有加州大学洛杉矶分校的电气工程硕士学位和印度理工学院卡拉格普尔分校的学士学位。
查看Tiyasa Mitra的所有帖子
关于Maximilian Golub
Maximilian Golub是NVIDIA的高级机器学习工程师,专注于通过深思熟虑的协同设计推进生成式AI的推测解码算法。他之前曾为MoE扩展、结构化稀疏性和MXFP量化格式的研究做出贡献。Maximilian拥有不列颠哥伦比亚大学的计算机工程应用科学硕士学位和华盛顿大学的电气工程学士学位。
查看Maximilian Golub的所有帖子
关于Maor Ashkenazi
Maor Ashkenazi是NVIDIA的团队负责人和高级研究员,专注于LLM推理算法。他最近的工作集中在推测解码,弥合模型研究和推理系统之间的差距,以提供实用的端到端加速。Maor已在内盖夫本-古里安大学完成计算机科学博士学位。他还拥有计算机科学硕士学位和软件工程学士学位,以优异成绩获得。
查看Maor Ashkenazi的所有帖子
关于Samkit Jain
Samkit Jain是NVIDIA的高级深度学习性能架构师,专注于优化生成式AI推理和系统的性能和能效。在加入NVIDIA之前,Samkit是Intel的软件研究科学家,领导稀疏AI和图分析加速器的硬件/软件协同设计。在他的职业生涯中,他曾在堆栈的多个层面工作,涵盖架构路径发现、性能建模和HPC系统软件。他拥有明尼苏达大学双城分校的电气工程硕士学位。
查看Samkit Jain的所有帖子
关于Nidhi Bhatia
Nidhi Bhatia是NVIDIA的高级AI/ML工程师,推动模型-硬件协同设计以提高服务生成式AI推理的效率。她曾在堆栈的多个层面工作,从GPU架构和性能建模到分布式推理算法,她的工作塑造了大规模AI推理系统的构建和优化方式。Nidhi拥有卡内基梅隆大学的电气和计算机工程硕士学位和印度BITS Pilani的电子和仪器学士学位。
查看Nidhi Bhatia的所有帖子
关于Bita Darvish Rouhani
Bita Darvish Rouhani是NVIDIA的高级杰出工程师和经理,领导算法、软件和硬件协同设计计划,以实现成本优化的生成式AI推理。在加入NVIDIA之前,Bita是Microsoft的合作伙伴组经理,共同创立并领导了OCP MX联盟。该联盟为几乎所有主流AI芯片标准化了第一批用于AI训练和推理的4位和6位数据类型。Bita拥有加州大学圣地亚哥分校的计算机工程博士学位。
查看Bita Darvish Rouhani的所有帖子
查看原文(中文正文为 AI 翻译)
Developer Tools & Techniques
Co-Designing AI Models Using Speculative Decoding for Faster LLM Inference
Sep 02, 2026
By Tiyasa Mitra, Maximilian Golub, Maor Ashkenazi, Samkit Jain, Nidhi Bhatia and Bita Darvish Rouhani
Like
L
T
F
R
E
AI-Generated Summary
Speculative decoding accelerates LLM inference by having a small draft model propose multiple tokens that a larger target model verifies in parallel, reducing decoding iterations while preserving output accuracy.
Five guidelines help select the optimal draft length and mechanism across the Pareto frontier: push GEMMs into the compute-bound region without increasing KV cache pressure; when attention dominates, set draft length to 128/G - 1; align larger draft lengths with attention kernel tile boundaries of 128; at very low latency, increase draft length only while acceptance gains justify the added draft cost; and choose the draft mechanism by balancing acceptance length, draft overhead, and training and deployment cost.
Draft mechanisms compared include external draft models, EAGLE-3, MTP, DFlash, DSpark, and suffix or n-gram methods, each with different tradeoffs in training cost, serve-time memory, and speculation cost per draft tokens.
SPEED-Bench, a speculative decoding benchmark developed by NVIDIA, provides realistic workloads for measuring acceptance length across task domains such as coding and summarization.
Ready-to-run training examples for EAGLE-3, DFlash, and DSpark are available in NVIDIA/Model-Optimizer, including fine-tuning and quantization workflows demonstrated on Nemotron 3.5 Lightning.
Next Steps
Explore the NVIDIA/Model-Optimizer repository for training examples and quantization workflows.
Benchmark acceptance length on SPEED-Bench with realistic prompts and diverse task domains.
Quantify draft overhead using NVIDIA TensorRT LLM for high-performance inference.
Powered by NVIDIA Nemotron. AI-generated content may summarize information incompletely. Verify important information. Learn more
This post is the third in a series on AI model co-design. It explores how to accelerate LLM inference while maintaining accuracy using speculative decoding and offers five guidelines for selecting draft length and draft mechanism across the Pareto frontier.
For a discussion of how model design choices impact both throughput and interactivity without sacrificing accuracy, see AI Model Co-Design: Hardware-Friendly LLM Design (Part 1). For an explanation of how group size (query heads per KV head), head dimension, and sequence length shape the performance of dense attention, see Co-Designing AI Model Attention for Fast, Interactive Long-Context Inference (Part 2).
What is speculative decoding?
Speculative decoding is a technique for accelerating the autoregressive decoding phase of LLM inference by predicting multiple tokens per iteration. A small draft model first predicts several likely next tokens. These tokens are then verified in parallel with a single pass through the larger target model.
Figure 1. Speculative decoding moves LLM decoding toward a more compute-bound region, shifting the throughput-interactivity Pareto frontier up and to the right. As interactivity increases toward the right of the curve, batch size decreases, and GEMMs account for a larger share of runtime than attention
This approach reduces the total number of decoding iterations while increasing the arithmetic intensity of the target model, without requiring higher concurrency. The target model accepts the proposed tokens in sequence until it encounters the first mismatch. The next prediction cycle then resumes from that position. Because only tokens accepted by the target model are retained, speculative decoding produces the same output sequence as standard decoding, unless the acceptance criteria are deliberately relaxed. Figure 2 illustrates this decoding flow.
The draft length (\(D\)) is the number of proposed tokens per target iteration. The acceptance length (\(AL\)) is the number of tokens produced (that is, accepted) per target iteration. \(AL\) ranges from \(1\) to (\(1 + D\)) because the target can always produce one new ground-truth token in addition to the accepted draft tokens.
The speedup from speculative decoding can be quantified as the ratio of time taken by the target model to sequentially generate \(AL\) tokens to the time taken to verify D tokens in parallel, while also accounting for the latency overhead of drafting \(D\) tokens:
\(\mathrm{speedup} = \frac{T_{\mathrm{verif}}(B) \times \mathrm{AL}}{T_{\mathrm{verif}}\left(B \times (1 + D)\right) + T_{\mathrm{draft}}(B, D)}\)
where \(B\) is the batch size, \(T_{\mathrm{verif}}(x)\) is the target verification time for \(x\) tokens, and \(T_{\mathrm{draft}}(b, y)\) is the time needed to generate a draft of length \(y\) for batch size \(b\). It is evident that to maximize speedup, it’s necessary to find the optimal \(\left(D, AL, T_{\mathrm{draft}}\right)\) tuple.
Figure 2. The draft-then-verify flow of speculative decoding. A smaller draft model proposes \(D\) tokens, and the target model verifies them together in one pass
Selecting the optimal draft length
For simplicity, if we ignore draft model latency, speculation provides a speedup when:
\(\frac{T_{\mathrm{verif}}\left(B \times (1 + D)\right)}{T_{\mathrm{verif}}(B)} \frac{128}{G} – 1\), prefer values where \(G \times (1 + D)\) is a multiple of 128 to avoid tile underutilization.
The relative weight of Guideline 1 compared to Guidelines 2 and 3 depends on the percentage of runtime spent in FFNs compared to attention at the preferred operating point. Communication also adds verification cost as D increases, although compute and communication overlap can mitigate the overhead.
Draft length at the far right of the Pareto curve
Moving towards the far right of the Pareto curve, \(B\) becomes very small. Here, fixed kernel setup and post-processing overheads dominate for both compute and communication kernels. These fixed costs don’t grow significantly with the number of verified tokens, keeping verification overhead largely invariant with the number of draft tokens.
While MoEs do see more experts activated with increasing draft length, a combination of model sharding strategies and efficient kernels such as Grouped GEMMs can keep this overhead low. Larger draft lengths can therefore help in the low latency region, as long as acceptance remains high.
At very low latency, the number of sequential kernel launches determines workload latency. Because kernel launches scale linearly with layer count, for an autoregressive draft model with a similar layer structure to the target, the speedup can be approximated as:
\(\mathrm{speedup} = \frac{L_{\mathrm{target}} \times \mathrm{AL}}{L_{\mathrm{target}} + D \times L_{\mathrm{draft}}}\)
where \(L_{\mathrm{target}}\) and \(L_{\mathrm{draft}}\) are the layer counts in the target and draft models, respectively. Defining a constant draft_depth_ratio, \(\rho = \frac{L_{\mathrm{draft}}}{L_{\mathrm{target}}}\):
\(\mathrm{speedup} = \frac{\mathrm{AL}}{1 + \rho D}\) and draft overhead, \(O_d = \rho D\)
In other words, increasing \(D\) helps only while the gain in \(AL\) is large enough to offset the draft overhead.
Guideline 4: At very low latency, increase \(D\) only while the gain in \(AL\) justifies the added draft cost.
Selecting a draft mechanism
Selecting \(D\) tells you how many tokens to speculate. Next, decide how to generate these tokens to maximize speedup.
A multitude of techniques have been proposed over the years, with different tradeoffs in training, parameter, and runtime costs. External drafting suggests using a small standalone LLM, while MTP, EAGLE-3, DFlash, and DSpark use auxiliary layers combined with information from the target model to predict tokens. Suffix and n-gram methods are model-free and instead reuse patterns already seen in the token stream.
Table 1 compares key drafting methods, including how they generate tokens, their serve-time memory, and their draft overhead.
External draft model EAGLE-3 MTP DFlash DSpark Suffix / n-gram Draft architecture Small LLM Decoder layer(s) + linear projection Decoder layer(s) + linear projection Decoder layer(s) + linear KV fusion Decoder layer(s) + linear KV fusion + lightweight Markov head String matching, no model Inputs Token IDs Previous-token embedding + target hidden states Target final hidden state Fused target hidden states used as draft KV Fused target hidden states used as draft KV Token stream Generation method \(D\) autoregressive forward passes Runs the module \(D\) times Runs the module \(D\) times Generates \(D\) tokens in one parallel step Generates \(D\) tokens in one parallel step, followed by a lightweight sequential correction One lookup Release method Separate model release Separate post-training head Part of the base model checkpoint Separate post-training head Separate post-training head Independent of target Training cost From scratch: 1T-10T+ tokens
Distilled: 100B-400B
Adapted: 10M-1B 1-10B additional tokens after target training Usually trained with the target during pretraining 1-10B additional tokens after target training 1-10B additional tokens after target training None Activation memory cost Draft weights + full KV cache Weights + small KV cache Weights + small KV cache Weights + small KV cache built from target Weights + small KV cache built from target None Speculation cost per \(D\) tokens Full draft model forward 1 layer, serial 1 layer, serial ~5 layers, once ~5 layers once + lightweight Markov head, serial O(1) lookup Best for LPU and LPU+GPU
Not recommended for GPUs Not recommended – lower \(AL\) than MTP Best for larger models on GPUs Smaller models, batch size 1 Smaller models, batch size 1 Workloads with high repetition Table 1. Comparison of common draft mechanisms across inputs, generation method, training cost, serve-time memory, and draft cost
To quantify the tradeoff between \(AL\) and \(O_d\), begin by observing how \(AL\) scales with \(D\).
Figure 6 shows how AL changes as D increases on SPEED-Bench, with Qwen 3.5 122B A10B as the target. SPEED-Bench is a speculative decoding benchmark developed by NVIDIA with the goal of representing realistic production workloads. It covers multiple task domains such as coding and summarization and has a variety of splits at different input sequence lengths. We recommend SPEED-Bench for \(AL\) comparisons.
On the 32K split, Qwen 3.5 35B A3B reaches an \(AL\) of 6 at \(D = 9\), while the 4B draft reaches an AL above 5. MTP and DFlash ALs level off as \(D\) grows. N-gram has lower acceptance on this workload and is better suited to workloads with repeated token patterns.
Figure 6. \(AL\) versus \(D\) for different draft mechanisms on SPEED-Bench, throughput 32K split, with Qwen 3.5 122B A10B as the target
Higher \(AL\) does not equal higher speedup. You also need to consider how much it costs to generate the draft.
As shown in Figure 6, all external drafts reach higher \(AL\) than other draft methods at \(D > 3\). The Qwen 3.5 122B MTP is much smaller, with 2.5B total parameters and fewer than 150M active parameters. At \(D = 3\), a larger external draft may not be worth the added cost. At \(D = 21\), its higher AL may make that cost worthwhile, assuming an efficient serving strategy.
Meanwhile, DFlash \(AL\)s level off relatively quickly. However, both DFlash and DSpark generate \(D\) draft tokens in parallel, lowering \(O_d\). For comparison, at minimum latency and with \(D=11\), a one-layer MTP head takes 11 steps, leading to \(O_d^{\mathrm{MTP}} = \frac{11}{L_{\mathrm{target}}}\), while a five-layer DFlash head generates the draft in one pass, giving \(O_d^{\mathrm{DFlash}} = \frac{5}{L_{\mathrm{target}}}\).
For a large target model with many layers, both overheads are negligible, but as \(L_\mathrm{target}\) decreases, the draft overhead becomes significant. For small models at low latency, therefore, DFlash or DSpark can be the optimal choice even with lower \(AL\).
To navigate the tradeoff between \(AL\) and draft latency, it is crucial to benchmark both accurately. In the context of speculative decoding, this means benchmarking with realistic prompts and covering a wide set of task domains. We recommend SPEED-Bench for \(AL\) measurements and high performance inference frameworks such as NVIDIA TensorRT LLM to quantify draft overhead.
Beyond inference performance, draft training scope and costs deserve consideration. While MTP must be co-trained with the target model, EAGLE, DFlash, and DSpark can be added to the final model checkpoint. Similarly, a continuum of options exists for external draft model creation. Training from scratch and distillation from the target yield the highest ALs, while adapting an existing model to the desired target through cross-model adaptation techniques can significantly reduce training costs at the expense of \(AL\).
Fine-tuning the target model can change its output distribution and hidden representations. Learned drafters trained for a particular target checkpoint can therefore lose acceptance even when the target model improves. After changing the target, remeasure \(AL\) on representative workloads. The required adaptation depends on the draft mechanism.
MTP is part of the target model and should continue to be trained during fine-tuning or be realigned in a dedicated follow-up stage. Target-attached drafters such as EAGLE-3, DFlash, and DSpark use the target’s hidden states and will need to be adapted to the updated checkpoint with additional training.
External draft models do not consume target hidden states, but they still approximate the target’s output distribution and may require fine-tuning or distillation. Suffix and n-gram methods have no learned drafter and therefore require no retraining, although their effectiveness still depends on how much repetition appears in the deployed workload.
Guideline 5: Choose the draft mechanism that gives the best decode speedup for your workload and hardware, considering \(AL\), draft latency, and training and deployment cost.
Get started co-designing speculative decoding
Use the five guidelines summarized below as a checklist for selecting \(D\) and draft mechanism across the Pareto frontier.
Increase speculative decoding draft length to push GEMMs into a compute-bound region without increasing KV cache capacity pressure.
When attention dominates decode time, choose \(D = \frac{128}{G} – 1\) as a starting point.
For larger draft lengths, prefer values where \(G \times (1 + D)\) is a multiple of 128 to align with the attention kernel tile size.
At very low latency, use a fast draft mechanism and increase \(D\) only while the gain in \(AL\) justifies the added draft cost.
Choose the draft mechanism by balancing \(AL\) and draft overhead for your workload and hardware. Benchmark both under realistic serving conditions and consider training and deployment cost.
For post-trained drafters, ready-to-run training examples are available in NVIDIA/Model-Optimizer for EAGLE-3, DFlash, and DSpark. See how we did this for NVIDIA Nemotron 3.5 Lightning: fine-tune DSpark, then quantize it to FP8 or NVFP4. Use the examples as starting points, then validate AL and end-to-end speed on your own model, workload, and hardware.
Acknowledgments
This post is a cross-team NVIDIA effort. We are grateful to Bhargava Gopireddy, Ritika Borkar, Dor Tsur, Andrii Skliar, Benjamin Chislett, Yaniv Galron, Talor Abramovich, Yoav Miron, Rabeeh Karimi Mahabadi, Roger Waleffe, Udi Karpas, Ran Zilberstein, Brian Pharris, and Eduardo Alvarez for their help.
Like
Tags
Agentic AI / Generative AI | Data Center / Cloud | Developer Tools & Techniques | Hardware / Semiconductor | General | Intermediate Technical | Best practice | Deep dive | AI Inference | Inference Performance | LLMs | NVFP4 | Training AI Models
About the Authors
About Tiyasa Mitra
Tiyasa Mitra is a senior AI and machine learning engineer at NVIDIA, where she leads work on cutting-edge technologies to improve generative AI efficiency through algorithm-hardware co-design. She has over a decade of experience in data-center optimization and networking, with a strong track record of building high-performance AI systems at scale. Tiyasa holds a master’s degree in electrical engineering from UCLA and a bachelor’s degree from IIT Kharagpur in India.
View all posts by Tiyasa Mitra
About Maximilian Golub
Maximilian Golub is a senior ML engineer at NVIDIA, focusing on advancing speculative decoding algorithms for generative AI through thoughtful co-design. He has previously contributed to research on MoE scaling, structured sparsity, and the MXFP quantization formats. Maximilian holds a Master of Applied Science in Computer Engineering from the University of British Columbia, and a bachelor’s degree in Electrical Engineering from the University of Washington.
View all posts by Maximilian Golub
About Maor Ashkenazi
Maor Ashkenazi is a team leader and senior researcher at NVIDIA, focusing on LLM inference algorithms. His recent work centers on speculative decoding, bridging model research and inference systems to deliver practical end-to-end speedups. Maor has completed his doctoral studies in Computer Science at Ben-Gurion University of the Negev. He also holds a master's degree in Computer Science and a bachelor’s degree in Software Engineering, awarded summa cum laude.
View all posts by Maor Ashkenazi
About Samkit Jain
Samkit Jain is a senior deep learning performance architect at NVIDIA, focusing on optimizing the performance and energy efficiency of generative AI inference and systems at scale. Prior to NVIDIA, Samkit was a software research scientist at Intel, where he led hardware/software co-design for sparse AI and graph analytics accelerators. Over his career, he has worked across multiple layers of the stack, spanning architecture pathfinding, performance modeling, and HPC system software. He holds a master’s degree in Electrical Engineering from the University of Minnesota, Twin Cities.
View all posts by Samkit Jain
About Nidhi Bhatia
Nidhi Bhatia is a senior AI/ML engineer at NVIDIA, driving model-hardware co-design to improve the efficiency of serving generative AI inference. She has worked across multiple layers of the stack, from GPU architecture and performance modeling to distributed inference algorithms, with her work shaping how large-scale AI inference systems are built and optimized. Nidhi holds a master's in electrical and computer engineering from Carnegie Mellon University and a bachelor's in electronics and instrumentation from BITS Pilani, India.
View all posts by Nidhi Bhatia
About Bita Darvish Rouhani
Bita Darvish Rouhani is a senior distinguished engineer and manager at NVIDIA, leading algorithms, software, and hardware co-design initiatives for cost-optimized generative AI inference. Prior to joining Nvidia, Bita was a partner group manager at Microsoft, where she co-founded and led the OCP MX consortium. The consortium standardized the first set of 4- and 6-bit data types for AI training and inference for nearly all mainstream AI chips. Bita holds a Ph.D. in computer engineering from UC San Diego.
View all posts by Bita Darvish Rouhani