arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.13847cs.CLcs.AIcs.LG
收藏

DynaSpec: 一种基于上下文的动态推测采样方法用于大词汇量语言模型

DynaSpec: Context-aware Dynamic Speculative Sampling for Large-Vocabulary Language Models

Department of Computer Science(计算机科学系);Aalto University(阿alto大学);Deep Algorithms and Systems Lab(深度算法与系统实验室);IST Austria(IST奥地利研究院);University of Bath(巴斯大学)

Jinbin Zhang, Nasib Ullah, Erik Schultheis, Rohit Babbar

AI总结:

DynaSpec通过动态短名单机制提升大词汇量语言模型的推测解码效率,实现更高的吞吐量和更精确的验证

摘要:

推测解码通过让一个小的草稿生成多个token,然后由大的目标模型在每个推测步骤中验证,从而加速LLM推理。当词汇量超过10^5时,目标模型的验证成本基本不变,但草稿生成器可能会受到O(|V|d)输出投影的限制。最近的方法(如FR-Spec、VocabTrim)通过限制草稿生成到一个固定的、按频率排名的短名单来缓解这一问题;然而,这种静态截断是语料库依赖的,并且会压制罕见或领域特定的token,从而减少接受率并限制加速效果。我们提出了DynaSpec,一种针对大词汇量推测解码的基于上下文的动态短名单机制。DynaSpec训练了轻量级的元分类器,将每个上下文路由到一小组粗略的token集群;所选顶部集群的并集定义了草稿生成器的短名单,而目标模型仍然在完整词汇上进行验证,保持精确性。系统层面,路由与草稿计算通过并行执行流重叠,从而减少端到端开销。在标准的推测解码基准上,DynaSpec一致提高了平均接受长度,恢复98.4%的完整词汇表现,比固定短名单基线的93.6%有所提升,并在具有罕见token的数据集上实现了比静态方法高达2.23倍的吞吐量提升,相比静态方法的1.91倍。

英文摘要:

Speculative decoding accelerates LLM inference by letting a small drafter propose multiple tokens which a large target model verifies once per speculation step. As vocabularies scale past 10e5 tokens,verification cost in the target model is largely unchanged, but the drafter can become bottlenecked by its O(|V|d) output projection. Recent approaches (e.g., FR-Spec, VocabTrim) mitigate this by restricting drafting to a fixed, frequency-ranked shortlist; however, such static truncation is corpus-dependent and suppresses rare or domain-specific tokens, reducing acceptance and limiting speedups. We propose DynaSpec, a context-dependent dynamic shortlisting mechanism for large-vocabulary speculative decoding. DynaSpec trains lightweight meta-classifiers that route each context to a small set of coarse token clusters; the union of the top-selected clusters defines the drafter's shortlist, while the target model still verifies over the full vocabulary, preserving exactness. Systems-wise, routing is overlapped with draft computation via parallel execution streams, reducing end-to-end overhead. Across standard speculative decoding benchmarks, DynaSpec consistently improves mean accepted length-recovering 98.4% of full-vocabulary performance for Llama-3-8B versus 93.6% for fixed-shortlist baselines-and achieves up to a 2.23x throughput gain compared to 1.91x for static approaches on the dataset with rare tokens.

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

↑