Position-Aware Depth Decay Decoding ($D^3$): Boosting Large Language Model Inference Efficiency

📄 arXiv: 2503.08524v2 📥 PDF

作者: Siqi Fan, Xuezhi Fang, Xingrun Xing, Peng Han, Shuo Shang, Yequan Wang

分类: cs.CL

发布日期: 2025-03-11 (更新: 2025-11-26)


💡 一句话要点

提出位置感知深度衰减解码以提升大语言模型推理效率

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大语言模型 推理效率 动态计算 位置感知 深度衰减解码 无训练算法 计算资源优化

📋 核心要点

  1. 现有的大语言模型在推理阶段消耗大量资源,传统的模型压缩方法需要重训练,限制了其应用。
  2. 本文提出了一种位置感知的层跳过框架,通过动态调整生成过程中的层数,显著提高推理效率。
  3. 实验结果显示,$D^3$在多个基准任务上实现了1.5倍的速度提升,同时性能损失小于1%。

📝 摘要(中文)

由于大语言模型(LLMs)参数众多,其推理阶段资源消耗巨大。与传统模型压缩方法不同,最近的动态计算方法表明并非所有组件在推理时都是必需的,从而实现了无需重训练的管道。本文聚焦于LLM生成的动态深度,提出了一种基于令牌位置感知的层跳过框架,能够在保持性能的同时高效节省1.5倍的计算量。我们首次观察到后预测的令牌具有较低的困惑度,因此需要更少的计算。我们提出了一种名为位置感知深度衰减解码($D^3$)的无训练算法,利用幂律衰减函数来确定生成令牌时保留的层数。实验表明,$D^3$在多个生成任务中首次实现了成功,且在与全推理管道的比较中,平均实现了1.5倍的速度提升,性能下降几乎为零(<1%)。

🔬 方法详解

问题定义:本文旨在解决大语言模型推理阶段的高资源消耗问题,现有方法的痛点在于需要重训练以实现模型压缩。

核心思路:提出一种位置感知的深度衰减解码算法($D^3$),通过动态调整生成令牌时保留的层数,利用后预测令牌的低困惑度特性,节省计算资源。

技术框架:$D^3$算法基于幂律衰减函数,决定在生成每个令牌时应保留的层数,整体流程包括输入令牌、计算层数、生成输出等主要模块。

关键创新:$D^3$的创新在于首次实现了无重训练的动态深度调整,显著提升了推理效率,与传统方法相比,减少了计算量而不影响性能。

关键设计:算法中使用的幂律衰减函数$ ext{floor}(L imes (α^i))$是关键设计,能够根据令牌的生成顺序动态调整层数,确保计算资源的高效利用。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

$D^3$在与全推理管道的比较中,平均实现了1.5倍的速度提升,同时在GSM8K和BBH基准测试中,性能损失小于1%,显示出其在保持生成质量的同时显著提高推理效率的能力。

🎯 应用场景

该研究具有广泛的应用潜力,尤其在需要高效推理的大语言模型场景中,如对话系统、文本生成和机器翻译等。通过提升推理效率,$D^3$能够降低计算成本,促进大规模语言模型的实际应用和普及。

📄 摘要(原文)

Due to the large number of parameters, the inference phase of Large Language Models (LLMs) is resource-intensive. Unlike traditional model compression, which needs retraining, recent dynamic computation methods show that not all components are required for inference, enabling a training-free pipeline. In this paper, we focus on the dynamic depth of LLM generation. A token-position aware layer skipping framework is proposed to save 1.5x times operations efficiently while maintaining performance. We first observed that tokens predicted later have lower perplexity and thus require less computation. Then, we propose a training-free algorithm called Position-Aware Depth Decay Decoding ($D^3$), which leverages a power-law decay function, $\left\lfloor L \times (α^i) \right\rfloor$, to determine the number of layers to retain when generating token $T_i$. Remarkably, without any retraining, the $D^3$ achieves success across a wide range of generation tasks for the first time. Experiments on large language models (\ie the Llama) with $7 \sim 70$ billion parameters show that $D^3$ can achieve an average 1.5x speedup compared with the full-inference pipeline while maintaining comparable performance with nearly no performance drop ($<1\%$) on the GSM8K and BBH benchmarks.