不用训练也能提速9倍,让小显存跑大模型更高效
Speculate Deep and Accurate: Lossless and Training-Free Acceleration for Offloaded LLMs via Substitute Speculative Decoding
- 用低比特替换层构建高度对齐的快速草案模型
- 在8GB显存下跑Qwen2.5-7B达9.1倍加速
- 无需训练、不降质量,适合资源受限的部署场景
大型语言模型(LLMs)的庞大参数量给内存有限的消费级GPU部署带来挑战。尽管模型压缩和参数卸载是常见策略,但压缩会降低质量,而卸载虽保持质量却导致推理缓慢。推测解码通过使用快速草案模型并行生成多个候选词元,并由目标LLM一次性验证,减少因参数卸载引发的数据传输延迟。现有方法通常依赖同系列预训练权重,需额外训练以适配自定义模型,且多数仅带来有限加速。其根源在于草案模型与目标模型对齐不足,限制了可接受的词元长度。为此,我们提出SubSpec——一种即插即用的无损、免训练加速方法。它通过从卸载的模型部分生成低比特量化替代层,构建高度对齐的草案模型;同时共享剩余驻留显存层与键值缓存,进一步降低内存开销并增强对齐。SubSpec实现高平均接受长度,在MT-Bench上使Qwen2.5-7B在8GB VRAM限制下达到9.1倍加速,在主流生成基准上使Qwen2.5-32B平均获得12.5倍加速(24GB VRAM限制)。
原文摘要 · Abstract (English)
The immense model sizes of large language models (LLMs) challenge deployment on memory-limited consumer GPUs. Although model compression and parameter offloading are common strategies to address memory limitations, compression can degrade quality, and offloading maintains quality but suffers from slow inference. Speculative decoding presents a promising avenue to accelerate parameter offloading, utilizing a fast draft model to propose multiple draft tokens, which are then verified by the target LLM in parallel with a single forward pass. This method reduces the time-consuming data transfers in forward passes that involve offloaded weight transfers. Existing methods often rely on pretrained weights of the same family, but require additional training to align with custom-trained models. Moreover, approaches that involve draft model training usually yield only modest speedups. This limitation arises from insufficient alignment with the target model, preventing higher token acceptance lengths. To address these challenges and achieve greater speedups, we propose SubSpec, a plug-and-play method to accelerate parameter offloading that is lossless and training-free. SubSpec constructs a highly aligned draft model by generating low-bit quantized substitute layers from offloaded target LLM portions. Additionally, our method shares the remaining GPU-resident layers and the KV-Cache, further reducing memory overhead and enhance alignment. SubSpec achieves a high average acceptance length, delivering 9.1x speedup for Qwen2.5 7B on MT-Bench (8GB VRAM limit) and an average of 12.5x speedup for Qwen2.5 32B on popular generation benchmarks (24GB VRAM limit).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。