对比三款大模型推理缓存管理方案,找出不同场景下的最佳选择。
Comparative Characterization of KV Cache Management Strategies for LLM Inference
- 比较vLLM、InfiniGen、H2O三种缓存管理策略的内存与性能平衡机制。
- 在高并发、长上下文场景下,各方案延迟与吞吐差异显著,最优方案随参数变化。
- 为实际部署提供选型依据,适合系统优化与推理框架开发者参考。
大语言模型高效推理依赖于存储各层已计算键值向量的键值(KV)缓存,以减少自回归生成中的重复计算,将复杂度从二次降低至线性。然而,随着模型规模扩大、上下文长度增长以及并发请求竞争有限内存资源,KV缓存的增长带来了严峻的系统挑战。尽管近期出现了多种先进的KV缓存管理框架,但其在内存消耗与推理性能间的权衡尚未被充分理解,尤其是在不同请求规模和模型配置下的表现。本文对三种前沿框架——vLLM、InfiniGen和H2O进行了实证研究,它们分别采用张量卸载、标记淘汰启发式与推测调度等技术。我们评估了它们在请求速率、模型规模和稀疏性水平等关键参数下的延迟、吞吐量和内存使用情况。结果揭示了各框架在特定条件下的最优表现,明确了在内存与性能约束下选择与配置合适缓存策略的适配条件。
原文摘要 · Abstract (English)
Efficient inference with Large Language Models (LLMs) increasingly relies on Key-Value (KV) caches to store previously computed key and value vectors at each layer. These caches are essential to minimize redundant computation during autoregressive token generation, lowering computational complexity from quadratic to linear. However, the growth of KV caches has posed significant system-level challenges, particularly as model sizes increase, context lengths grow, and concurrent requests compete for limited memory resources. Even though several recent frameworks for KV cache management have emerged, their comparative trade-offs in memory consumption and inference performance have not been fully understood, especially under varying request sizes and model configurations. In this work, we conduct an empirical study of three state-of-the-art KV cache management frameworks: vLLM, InfiniGen, and H2O. These frameworks employ techniques such as tensor offloading, token eviction heuristics, and speculative scheduling to balance memory usage and performance. We evaluate their performance in terms of a range of metrics such as latency, throughput, and memory usage across a spectrum of key parameters including request rates, model sizes, and sparsity levels. Our results pinpoint the conditions for each framework to perform the best, revealing the most suitable selection and configuration of KV cache strategies under memory and performance constraints.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。