[论文解读] Hardware-Aware Parallel Prompt Decoding for Memory-Efficient Acceleration of LLM Inference
本文提出并行提示解码(Parallel Prompt Decoding, PPD),一种内存高效、硬件感知的方法,通过使用少量可训练提示标记在单次前向传播中并行生成多个输出标记,从而加速大语言模型(LLM)推理。PPD 仅引入 0.0002% 的额外可训练参数和 0.0004% 的运行时内存开销,即可实现最高 2.49× 的加速效果,同时支持与推测解码协同集成,进一步提升性能。
The auto-regressive decoding of Large Language Models (LLMs) results in significant overheads in their hardware performance. While recent research has investigated various speculative decoding techniques for multi-token generation, these efforts have primarily focused on improving processing speed such as throughput. Crucially, they often neglect other metrics essential for real-life deployments, such as memory consumption and training cost. To overcome these limitations, we propose a novel parallel prompt decoding that requires only $0.0002$% trainable parameters, enabling efficient training on a single A100-40GB GPU in just 16 hours. Inspired by the human natural language generation process, $PPD$ approximates outputs generated at future timesteps in parallel by using multiple prompt tokens. This approach partially recovers the missing conditional dependency information necessary for multi-token generation, resulting in up to a 28% higher acceptance rate for long-range predictions. Furthermore, we present a hardware-aware dynamic sparse tree technique that adaptively optimizes this decoding scheme to fully leverage the computational capacities on different GPUs. Through extensive experiments across LLMs ranging from MobileLlama to Vicuna-13B on a wide range of benchmarks, our approach demonstrates up to 2.49$ imes$ speedup and maintains a minimal runtime memory overhead of just $0.0004$%. More importantly, our parallel prompt decoding can serve as an orthogonal optimization for synergistic integration with existing speculative decoding, showing up to $1.22 imes$ further speed improvement. Our code is available at https://github.com/hmarkc/parallel-prompt-decoding.
研究动机与目标
- 解决大语言模型推理中推测解码带来的高内存与训练成本问题,尤其针对边缘和移动设备部署场景。
- 克服现有非自回归解码方法依赖条件独立性或占位符标记的局限,从而导致准确率低下的问题。
- 开发一种轻量化、与架构无关的解决方案,实现在不引入新模型或结构变更的前提下并行生成多标记。
- 在最小化训练成本和运行时内存开销的同时,最大化长程预测的接受率。
- 实现对解码过程的硬件感知优化,以适配多样化的 GPU 平台并最大化性能表现。
提出的方法
- 引入可训练提示标记,将其并行附加至输入序列,以实现在单次前向传播中同时生成多个输出标记。
- 采用带有定制化树注意力掩码的动态稀疏树机制,为每个提示标记生成多个候选延续,从而最小化计算与内存开销。
- 利用具有因果关联的提示标记部分恢复缺失的条件依赖信息,提升长程标记预测的准确性。
- 实现一种硬件感知的动态稀疏树,根据可用计算资源在推理过程中自适应地优化提示结构。
- 采用轻量级微调策略训练提示标记,仅需基础模型参数量的 0.0002%,可在单张 A100-40GB GPU 上于 16 小时内完成训练。
- 将 PPD 作为与现有推测解码正交的优化技术集成,提升加速效果的同时不增加模型复杂度。
实验结果
研究问题
- RQ1是否可通过轻量级、基于提示的方法,在不依赖独立草稿模型的前提下,实现高精度、并行的多标记生成?
- RQ2训练后的提示标记在多大程度上可恢复长程序列预测中的条件依赖信息?
- RQ3与静态或随机树结构相比,动态稀疏树结构在提升接受率及降低内存与计算开销方面表现如何?
- RQ4在 PPD 框架中,模型大小、提示标记数量与预测准确率之间的最优权衡是什么?
- RQ5PPD 是否可与推测解码有效结合,以极低附加成本实现进一步加速?
主要发现
- PPD 在 MobileLlama、Vicuna-7B 和 Vicuna-13B 等多个模型上实现了最高 2.49× 的 LLM 推理加速,且硬件开销极低。
- 该方法仅引入 0.0004% 的运行时内存开销,且仅需基础模型 0.0002% 的可训练参数,可在单张 A100-40GB GPU 上于 16 小时内完成训练。
- 与基线方法相比,PPD 在长程预测中的接受率最高提升 28%,尤其在远距离标记上表现显著(例如,在距离为 4 时,top-10 准确率提升 0.12)。
- 动态稀疏树技术始终优于静态和随机树结构,随着树规模增大,接受长度持续稳定增长。
- 与推测解码集成后,PPD 在 Vicuna-7B 上额外实现 1.22× 的加速,展现出强大的协同潜力。
- 内存效率显著优于 Medusa 和 Eagle,PPD 的内存开销仅为 Medusa 的 0.004% 和 Eagle 的 0.007%。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。