arXiv:2502.02493cs.LG2025-02NeurIPS被引 3

让小模型分层并行推测,提升多卡大模型推理效率

EasySpec: Layer-Parallel Speculative Decoding for Efficient Multi-GPU Utilization

  • 打破小模型层间依赖,实现多卡分层并行推测
  • 最高提速4.17倍,推测准确率下降仅7%
  • 无需训练,可直接接入现有系统,适合部署优化

推测解码是加速大语言模型推理的有效无损方法。它使用较小模型生成草稿标记序列,再由原基模型验证。在多卡系统中,通过张量并行(TP)可进一步降低延迟,但草稿模型的最佳TP规模通常小于基模型,导致草稿阶段出现GPU空闲。我们观察到这种低效源于层间顺序执行,看似自然实则非必需。为此提出EasySpec,一种分层并行推测策略,通过解除草稿模型的层间数据依赖,使多层可在多设备上并行执行,实现‘模糊’推测。每次草稿-验证迭代后,仅需一次前向传播校准键值缓存,避免长期误差累积,额外延迟极低。EasySpec为免训练、即插即用方法。我们在多个主流开源LLM上评估,使用同系列更小模型作为草稿器。结果表明,相比原生解码,EasySpec最高可实现4.17倍加速,同时保持基模型原始分布。草稿阶段最高提速1.62倍,推测准确率下降最大仅7%。代码已公开于https://github.com/Yize-Wu/EasySpec。

原文摘要 · Abstract (English)

Speculative decoding is an effective and lossless method for Large Language Model (LLM) inference acceleration. It employs a smaller model to generate a draft token sequence, which is then verified by the original base model. In multi-GPU systems, inference latency can be further reduced through tensor parallelism (TP), while the optimal TP size of the draft model is typically smaller than that of the base model, leading to GPU idling during the drafting stage. We observe that such inefficiency stems from the sequential execution of layers, which is seemingly natural but actually unnecessary. Therefore, we propose EasySpec, a layer-parallel speculation strategy that optimizes the efficiency of multi-GPU utilization. EasySpec breaks the inter-layer data dependencies in the draft model, enabling multiple layers to run simultaneously across multiple devices as 'fuzzy' speculation. After each drafting-and-verification iteration, the draft model's key-value cache is calibrated in a single forward pass, preventing long-term fuzzy-error accumulation at minimal additional latency. EasySpec is a training-free and plug-in method. We evaluated EasySpec on several mainstream open-source LLMs, using smaller versions of models from the same series as drafters. The results demonstrate that EasySpec can achieve a peak speedup of 4.17x compared to vanilla decoding, while preserving the original distributions of the base LLMs. Specifically, the drafting stage can be accelerated by up to 1.62x with a maximum speculation accuracy drop of only 7%. The code is available at https://github.com/Yize-Wu/EasySpec.

推理加速推测解码多卡优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。