让手机等小内存设备也能用快速推理的论文。
SpecMemo: Speculative Decoding is in Your Pocket
- 设计细粒度内存控制机制,动态平衡候选词内存开销与加速效果。
- 在单张显卡上降低65%生成内存,保持96%的推理吞吐率。
- 支持多卡分布式大模型推理,实现8倍吞吐提升,适合移动和边缘部署。
近期的推测式解码技术在多种大语言模型任务中展现了显著加速效果。然而,在内存受限设备(如移动端GPU)上部署该技术仍面临挑战。本文提出一种面向设备的推理引擎SpecMemo,通过理论建模推测解码的内存占用,确定最低内存预算,在保持加速的同时精细控制内存分配。SpecMemo在单张Nvidia Titan RTX上将生成内存减少65%,同时在MT-Bench上维持96%的原始吞吐率。针对多台受限GPU,我们基于已有架构构建了分布式推理框架,实现对Llama-2-70B-Chat模型的拆分推理,并引入新型批处理推测解码。在八张AMD MI250 GPU上,相比传统分布式批处理解码,速度提升2倍;当批量大小为10时,推理吞吐量提升8倍。本工作推动了资源受限环境下的大模型应用普及,为低成本、高性能的现实场景部署提供路径。
原文摘要 · Abstract (English)
Recent advancements in speculative decoding have demonstrated considerable speedup across a wide array of large language model (LLM) tasks. Speculative decoding inherently relies on sacrificing extra memory allocations to generate several candidate tokens, of which acceptance rate drives the speedup. However, deploying speculative decoding on memory-constrained devices, such as mobile GPUs, remains as a significant challenge in real-world scenarios. In this work, we present a device-aware inference engine named SpecMemo that can smartly control memory allocations at finer levels to enable multi-turn chatbots with speculative decoding on such limited memory devices. Our methodology stems from theoretically modeling memory footprint of speculative decoding to determine a lower bound on the required memory budget while retaining speedup. SpecMemo empirically acquires a careful balance between minimizing redundant memory allocations for rejected candidate tokens and maintaining competitive performance gains from speculation. Notably, with SpecMemo's memory management, we maintain 96% of overall throughput from speculative decoding on MT-Bench, with reduced generation-memory by 65% on single Nvidia Titan RTX. Given multiple constrained GPUs, we build on top of previous speculative decoding architectures to facilitate big-model inference by distributing Llama-2-70B-Chat model, on which we provide novel batched speculative decoding to increase usability of multiple small server GPUs. This novel framework demonstrates 2x speedup over distributed and batched vanilla decoding with the base model on eight AMD MI250 GPUs. Moreover, inference throughput increases remarkably 8x with batch size 10. Our work contributes to democratized LLM applications in resource-constrained environments, providing a pathway for faster and cheaper deployment of real-world LLM applications with robust performance.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。