提出SpecFormer,让大模型推理在批量场景下也能高效并行生成。
Scaling LLM Speculative Decoding: Non-Autoregressive Forecasting in Large-Batch Scenarios
- 设计双向注意力结构,实现非自回归并行生成
- 无需复杂前缀树,在大批次下仍保持稳定加速
- 适合资源受限的批量推理场景,训练成本更低
推测解码通过利用内存到芯片数据传输期间闲置的计算资源来加速大语言模型推理。现有方法通常依赖大量算力,使用小型自回归模型生成复杂的大型草稿树以提升预测精度。然而,批处理技术因能压缩可用空闲算力,已成为主流推理系统中的更优选择。因此,在验证资源和调度开销较低的前提下实现推测解码成为关键挑战。我们提出SpecFormer,一种融合单向与双向注意力机制的新架构,兼具自回归模型对完整输入序列的建模能力与非自回归模型的并行生成优势。该设计摆脱了对大型前缀树的依赖,在大批次场景中仍可实现一致加速。通过跨不同规模模型的无损推测解码实验,证明SpecFormer在降低训练需求与计算成本的同时,为大模型推理的可扩展性树立了新标准。
原文摘要 · Abstract (English)
Speculative decoding accelerates LLM inference by utilizing otherwise idle computational resources during memory-to-chip data transfer. Current speculative decoding methods typically assume a considerable amount of available computing power, then generate a complex and massive draft tree using a small autoregressive language model to improve overall prediction accuracy. However, methods like batching have been widely applied in mainstream model inference systems as a superior alternative to speculative decoding, as they compress the available idle computing power. Therefore, performing speculative decoding with low verification resources and low scheduling costs has become an important research problem. We believe that more capable models that allow for parallel generation on draft sequences are what we truly need. Recognizing the fundamental nature of draft models to only generate sequences of limited length, we propose SpecFormer, a novel architecture that integrates unidirectional and bidirectional attention mechanisms. SpecFormer combines the autoregressive model's ability to extract information from the entire input sequence with the parallel generation benefits of non-autoregressive models. This design eliminates the reliance on large prefix trees and achieves consistent acceleration, even in large-batch scenarios. Through lossless speculative decoding experiments across models of various scales, we demonstrate that SpecFormer sets a new standard for scaling LLM inference with lower training demands and reduced computational costs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。