arXiv:2504.08850cs.DCcs.AI2025-04中稿 · ISCA 2025被引 29

通过推测性提前退出,让大模型推理快两倍以上。

SpecEE: Accelerating Large Language Model Inference with Speculative Early Exiting

  • 用推测性轻量预测器,利用令牌概率相关性提速。
  • 云和电脑上分别实现2.25倍和2.43倍加速。
  • 无需修改模型,适合部署在云端或个人设备。

早期退出近年成为加速大语言模型推理的有力手段,能有效降低硬件计算与内存访问开销。本文提出SpecEE,一种基于推测性提前退出的快速推理引擎。算法层面,设计基于推测令牌与正确结果间概率相关性的轻量预测器,并充分利用GPU高并行性;系统层面,发现并非所有层都需要预测器,提出基于分布偏斜与上下文相似性的两级启发式调度机制;映射层面,指出不同解码方法具有共同特征,提出上下文感知的合并映射方案,支持高效推测解码,并兼容量化、稀疏激活等现有加速技术,在云和PC场景下均显著提升性能。SpecEE可零成本应用于任意大模型,训练开销极小且不改变原始参数。大量实验表明,其在Llama2-7B上于云和本地环境下分别实现2.25倍和2.43倍的加速。

原文摘要 · Abstract (English)

Early exiting has recently emerged as a promising technique for accelerating large language models (LLMs) by effectively reducing the hardware computation and memory access. In this paper, we present SpecEE, a fast LLM inference engine with speculative early exiting. (1) At the algorithm level, we propose the speculation-based lightweight predictor design by exploiting the probabilistic correlation between the speculative tokens and the correct results and high parallelism of GPUs. (2) At the system level, we point out that not all layers need a predictor and design the two-level heuristic predictor scheduling engine based on skewed distribution and contextual similarity. (3) At the mapping level, we point out that different decoding methods share the same essential characteristics, and propose the context-aware merged mapping for predictor with efficient GPU implementations to support speculative decoding, and form a framework for various existing orthogonal acceleration techniques (e.g., quantization and sparse activation) on cloud and personal computer (PC) scenarios, successfully pushing the Pareto frontier of accuracy and speedup. It is worth noting that SpecEE can be applied to any LLM by negligible training overhead in advance without affecting the model original parameters. Extensive experiments show that SpecEE achieves 2.25x and 2.43x speedup with Llama2-7B on cloud and PC scenarios respectively.

大模型推理早期退出加速引擎推测解码

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