SpecFold:折叠多分支冗余以加速扩散语言模型中的推测解码

·

研究论文 · 2026/10/10

扩散大语言模型(DLLM)通过迭代块去噪生成文本,多分支推测解码通过在单次前向传播中同时验证主分支和多个草稿分支来加速这一过程。以往DLLM加速方法主要利用去噪步骤间的时间冗余,而我们发现了每个推测验证步骤内一个互补的冗余维度:多分支计算冗余。在推测验证期间,草稿分支从父分支继承大部分token,仅额外解掩码少量位置,导致分支间大量隐藏状态高度相似。我们提出SpecFold,一种算法-系统协同设计,利用这种多分支冗余来降低多分支推测验证的成本。在算法上,SpecFold执行token级残差门控,并通过折叠注意力和FFN选择性重用父计算,同时保留残差隐藏状态。在系统上,Triton内核实现将这种细粒度重用转化为端到端吞吐量增益,通过高效稀疏多分支执行。SpecFold与时间缓存正交,并兼容现有DLLM推测策略。在两个DLLM系列、五个模型和五个标准基准上,SpecFold相比Spiffy实现高达1.64倍吞吐量提升,相比原始解码高达1.99倍,同时保持相当的任务性能。

该工作通过算法-系统协同设计,有效利用了多分支推测解码中的计算冗余,显著提升了扩散语言模型的推理速度,且与现有方法兼容,具有较高的实用价值。

Diffusion large language models (DLLMs) generate text through iterative block denoising, and multi-branch speculative decoding accelerates this process by verifying a main branch together with multiple draft branches in a single forward pass. While prior DLLM acceleration methods primarily exploit temporal redundancy across denoising steps, we identify a complementary redundancy axis within each speculative verification step: multi-branch computational redundancy. During speculative verification, draft branches inherit most tokens from their parents while unmasking a small set of additional positions, causing large portions of hidden states to remain highly similar across branches. We propose SpecFold, an algorithm-system co-design that exploits this multi-branch redundancy to reduce the cost of multi-branch speculative verification. Algorithmically, SpecFold performs token-level residual gating and selectively reuses parent computation through folded attention and FFN while preserving residual hidden states. Systemically, a Triton kernel implementation translates this fine-grained reuse into end-to-end throughput gains through efficient sparse multi-branch execution. SpecFold is orthogonal to temporal caching and compatible with existing DLLM speculation strategies. Across two DLLM families, five models, and five standard benchmarks, SpecFold achieves up to 1.64x throughput over Spiffy and up to 1.99x over vanilla decoding, while maintaining comparable task performance.

阅读原文

参与讨论