vTensor:面向高效LLM服务的灵活虚拟张量管理
vTensor: Flexible Virtual Tensor Management for Efficient LLM Serving
AI总结:
针对LLM服务中KV缓存内存碎片化问题,提出基于GPU虚拟内存管理的vTensor张量结构,解耦计算与碎片整理,实现平均1.86倍加速并释放71.25%内存。
摘要:
大型语言模型(LLMs)被广泛应用于各个领域,每天处理数百万个请求。这种需求的激增在优化吞吐量和延迟的同时保持成本可控方面带来了重大挑战。键值(KV)缓存是保留先前计算的标准方法,使得LLM推理高度受限于内存。虽然批处理策略可以提升性能,但它们经常导致显著的内存碎片化。尽管像vLLM这样的前沿系统使用分页注意力机制来缓解KV缓存碎片化,但由于页面管理与计算内核的紧密耦合,它们仍然遭受低效的内存和计算操作。本研究引入了vTensor,一种基于GPU虚拟内存管理(VMM)的用于LLM推理的创新张量结构。vTensor通过将计算与内存碎片整理解耦并提供动态可扩展性来解决现有局限性。我们的框架采用CPU-GPU异构方法,确保高效、无碎片的内存管理,同时适应不同LLM架构的各种计算内核。实验结果表明,vTensor在不同模型上实现了平均1.86倍的加速,在多轮对话场景中最高可达2.42倍。此外,vTensor在内核评估中提供了平均2.12倍和3.15倍的加速,分别比SGLang Triton前缀预填充内核和vLLM分页注意力内核最高可达3.92倍和3.27倍。此外,与vLLM相比,它在NVIDIA A100 GPU上释放了约71.25%(57GB)的内存,从而支持更多内存密集型工作负载。
英文摘要:
Large Language Models (LLMs) are widely used across various domains, processing millions of daily requests. This surge in demand poses significant challenges in optimizing throughput and latency while keeping costs manageable. The Key-Value (KV) cache, a standard method for retaining previous computations, makes LLM inference highly bounded by memory. While batching strategies can enhance performance, they frequently lead to significant memory fragmentation. Even though cutting-edge systems like vLLM mitigate KV cache fragmentation using paged Attention mechanisms, they still suffer from inefficient memory and computational operations due to the tightly coupled page management and computation kernels. This study introduces the vTensor, an innovative tensor structure for LLM inference based on GPU virtual memory management (VMM). vTensor addresses existing limitations by decoupling computation from memory defragmentation and offering dynamic extensibility. Our framework employs a CPU-GPU heterogeneous approach, ensuring efficient, fragmentation-free memory management while accommodating various computation kernels across different LLM architectures. Experimental results indicate that vTensor achieves an average speedup of 1.86x across different models, with up to 2.42x in multi-turn chat scenarios. Additionally, vTensor provides average speedups of 2.12x and 3.15x in kernel evaluation, reaching up to 3.92x and 3.27x compared to SGLang Triton prefix-prefilling kernels and vLLM paged Attention kernel, respectively. Furthermore, it frees approximately 71.25% (57GB) of memory on the NVIDIA A100 GPU compared to vLLM, enabling more memory-intensive workloads.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。