arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2506.20187cs.OScs.CR
收藏

突破长上下文LLM推理的边界:在单个商用GPU上的自适应KV管理

Breaking the Boundaries of Long-Context LLM Inference: Adaptive KV Management on a Single Commodity GPU

He Sun, Li Li, Mingjun Xiao, Chengzhong Xu

AI总结:

本文提出LeoAM系统,通过自适应分层GPU-CPU-Disk KV管理、轻量级KV摘要及动态压缩与流水线技术,在单个商用GPU上实现高效长上下文LLM推理,平均加速3.46倍,大batch场景下最高达5.47倍。

摘要:

先进的大语言模型(LLMs)在广泛的复杂和长上下文自然语言任务中取得了令人印象深刻的表现。然而,由于键值(KV)缓存的内存需求不断增加,在具有隐私顾虑的商用GPU(个人电脑)上本地执行长上下文LLM推理仍然具有挑战性。现有系统通常识别重要token,并将其KV数据选择性地卸载到GPU和CPU内存中。由于商用GPU的内存有限,KV数据需要卸载到磁盘,但该过程受到token重要性评估开销和磁盘低带宽的瓶颈限制。在本文中,我们提出了LeoAM,这是首个面向单个商用GPU的高效重要性感知长上下文LLM推理系统,具有自适应分层GPU-CPU-Disk KV管理。我们的系统采用自适应KV管理策略,根据不同层注意力权重的偏斜分布将KV数据划分为可变大小的块,以减少计算和额外传输开销。此外,我们提出了一种轻量级KV摘要方法,通过在磁盘上存储和提取每个块的KV摘要而非完整KV数据,最小化传输延迟。LeoAM还利用动态压缩和流水线技术进一步加速推理。实验结果表明,LongInfer实现了平均3.46倍的推理延迟加速,同时保持了可比的LLM响应质量。在更大批量大小的场景中,它实现了高达5.47倍的加速。

英文摘要:

Advanced Large Language Models (LLMs) have achieved impressive performance across a wide range of complex and long-context natural language tasks. However, performing long-context LLM inference locally on a commodity GPU (a PC) with privacy concerns remains challenging due to the increasing memory demands of the key-value (KV) cache. Existing systems typically identify important tokens and selectively offload their KV data to GPU and CPU memory. The KV data needs to be offloaded to disk due to the limited memory on a commodity GPU, but the process is bottlenecked by token importance evaluation overhead and the disk's low bandwidth. In this paper, we present LeoAM, the first efficient importance-aware long-context LLM inference system for a single commodity GPU with adaptive hierarchical GPU-CPU-Disk KV management. Our system employs an adaptive KV management strategy that partitions KV data into variable-sized chunks based on the skewed distribution of attention weights across different layers to reduce computational and additional transmission overheads. Moreover, we propose a lightweight KV abstract method, which minimizes transmission latency by storing and extracting the KV abstract of each chunk on disk instead of the full KV data. LeoAM also leverages the dynamic compression and pipeline techniques to further accelerate inference. Experimental results demonstrate that LongInfer achieves an average inference latency speedup of 3.46x, while maintaining comparable LLM response quality. In scenarios with larger batch sizes, it achieves up to a 5.47x speedup.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑