FairKV:平衡单头KV缓存以实现快速多GPU推理
FairKV: Balancing Per-Head KV Cache for Fast Multi-GPU Inference
AI总结:
针对非均衡逐头KV缓存压缩在多GPU推理中引发的负载不均问题,提出FairKV方法,通过Fair-Copying技术复制少量内存密集型注意力头均衡负载,相比标准张量并行推理吞吐量提升1.66倍。
摘要:
Transformer模型中的KV缓存技术旨在减少冗余计算,但代价是内存使用量大幅增加,这使得KV缓存压缩成为一个重要且热门的研究课题。近年来,最先进的KV缓存压缩方法采用了非均衡的逐头分配算法,可动态调整每个注意力头的KV缓存预算,在单GPU场景下取得了优异性能。然而我们观察到,在部署多GPU推理时,这种非均衡压缩会导致严重的负载不均衡,部分GPU负载过高,而其他GPU则未被充分利用。本文提出FairKV方法,旨在在采用非均衡KV缓存压缩的系统中,确保各注意力头之间的内存使用公平。FairKV的核心技术是Fair-Copying,该技术利用数据并行性,将一小部分内存密集型注意力头复制到多个GPU上,以缓解负载不均衡。我们在LLaMA 70b和Mistral 24b等主流模型上进行的实验表明,与标准张量并行推理相比,FairKV将吞吐量提升了1.66倍。我们的代码将在论文录用后开源。
英文摘要:
KV cache techniques in Transformer models aim to reduce redundant computations at the expense of substantially increased memory usage, making KV cache compression an important and popular research topic. Recently, state-of-the-art KV cache compression methods implement imbalanced, per-head allocation algorithms that dynamically adjust the KV cache budget for each attention head, achieving excellent performance in single-GPU scenarios. However, we observe that such imbalanced compression leads to significant load imbalance when deploying multi-GPU inference, as some GPUs become overburdened while others remain underutilized. In this paper, we propose FairKV, a method designed to ensure fair memory usage among attention heads in systems employing imbalanced KV cache compression. The core technique of FairKV is Fair-Copying, which replicates a small subset of memory-intensive attention heads across GPUs using data parallelism to mitigate load imbalance. Our experiments on popular models, including LLaMA 70b and Mistral 24b model, demonstrate that FairKV increases throughput by 1.66x compared to standard tensor parallelism inference. Our code will be released as open source upon acceptance.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。