利用CPU和GPU协同进行推测性解码,显著提升大模型在消费级设备上的推理速度。
Dovetail: A CPU/GPU Heterogeneous Speculative Decoding for LLM inference
- GPU跑草稿模型预生成,CPU验证输出,减少通信开销。
- 13B模型在不同设备上提速1.79倍至10.1倍,生成结果稳定一致。
- 适合资源受限的终端设备或老旧服务器部署大模型。
随着大语言模型性能不断提升,其对计算资源和内存的需求急剧增加,给消费级设备和旧服务器的高效推理带来挑战。这些设备通常具备较弱的GPU和较强的CPU。尽管参数卸载和部分卸载等技术能在一定程度上缓解显存压力,但受限于通信延迟和硬件资源利用率不足,效果有限。为此,我们提出Dovetail,一种无损推理加速方法,充分利用异构设备的互补特性与推测性解码的优势。Dovetail在GPU上部署草稿模型进行初步预测,同时在CPU上运行目标模型验证输出结果。通过降低数据传输粒度,显著减少通信开销。为进一步提升效率,我们针对异构环境优化了草稿模型:减少草稿令牌数量以降低并行验证延迟,增加模型深度以增强预测能力,并引入动态门控融合(DGF)机制,改善特征与嵌入信息的融合。我们在多种消费级GPU上对Dovetail进行了全面评估,涵盖多个任务和主流模型。实验结果显示,13B模型在不同设备上推理速度提升1.79倍至10.1倍,生成文本分布保持一致且稳定。
原文摘要 · Abstract (English)
With the continuous advancement in the performance of large language models (LLMs), their demand for computational resources and memory has significantly increased, which poses major challenges for efficient inference on consumer-grade devices and legacy servers. These devices typically feature relatively weaker GPUs and stronger CPUs. Although techniques such as parameter offloading and partial offloading can alleviate GPU memory pressure to some extent, their effectiveness is limited due to communication latency and suboptimal hardware resource utilization. To address this issue, we propose Dovetail, a lossless inference acceleration method that leverages the complementary characteristics of heterogeneous devices and the advantages of speculative decoding. Dovetail deploys a draft model on the GPU to perform preliminary predictions, while a target model running on the CPU validates these outputs. By reducing the granularity of data transfer, Dovetail significantly minimizes communication overhead. To further improve efficiency, we optimize the draft model specifically for heterogeneous hardware environments by reducing the number of draft tokens to lower parallel verification latency, increasing model depth to enhance predictive capabilities, and introducing a Dynamic Gating Fusion (DGF) mechanism to improve the integration of feature and embedding information. We conduct comprehensive evaluations of Dovetail across various consumer-grade GPUs, covering multiple tasks and mainstream models. Experimental results on 13B models demonstrate that Dovetail achieves inference speedups ranging from 1.79x to 10.1x across different devices, while maintaining consistency and stability in the distribution of generated texts.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。