跳转至

面向大规模 GPU 推理的 KV Cache 预测性多层内存管理

文章背景与核心概要

KV Cache(键值缓存)内存管理是当前大规模 GPU 推理服务中限制吞吐量和成本效率的主要瓶颈。现有的推理系统面临三大核心挑战:缺乏针对不同注意力架构(如 MLA)的统一内存分配机制、KV Cache 被严格限制在 GPU HBM 中而无法利用多层存储架构、以及被动的驱逐策略导致了大量的冗余计算。

本文提出了一种统一的、预测性的多层内存管理架构。该方案通过引入架构感知的大小调整引擎、六层存储层级(从 GPU HBM 到并行文件系统)以及基于贝叶斯预测的预取引擎,将单节点的有效 KV Cache 容量从 40 GB 扩展至超过 38 TB,同时确保了热点数据的首字延迟(TTFT)保持在毫秒级以内。


📌 执行摘要

KV Cache 内存管理是限制大规模 GPU 推理服务吞吐量和成本效率的主要瓶颈。当前的推理系统在三个主要方面存在复合效率低下问题: 1. 缺乏统一的容量规划: 所有注意力架构(特别是通用框架不支持的多头潜在注意力 / MLA)缺乏统一的 KV Cache 容量规划,导致高达 57 倍的内存过度配置。 2. 单层限制: KV Cache 被严格限制在 GPU HBM 中,忽略了丰富的存储层级,包括 CPU DRAM、CXL 连接内存、通过 GPUDirect Storage 访问的 NVMe、RDMA 网络以及并行文件系统。 3. 被动式驱逐: 传统的被动驱逐策略会丢弃可重用的状态,导致冗余的重新计算。

为了解决这些挑战,本文提出了一种统一的、预测性的多层内存管理架构,将有效 KV Cache 容量从 40 GB 扩展到每节点超过 38 TB,同时为热点条目保持亚毫秒级的首字延迟(TTFT)。

Key-value (KV) cache memory management is the primary bottleneck limiting throughput and cost-efficiency in large-scale GPU inference serving. Current inference systems struggle with three main compounding inefficiencies: 1. Lack of Unified Sizing: Absence of unified KV cache sizing across all attention architectures (notably Multi-head Latent Attention / MLA, which is unsupported in general-purpose frameworks, leading to up to 57× memory over-provisioning). 2. Single-Tier Confinement: KV cache is strictly confined to GPU HBM, ignoring rich storage hierarchies including CPU DRAM, CXL-attached memory, NVMe via GPUDirect Storage, RDMA fabric, and parallel filesystems. 3. Reactive Eviction: Traditional reactive eviction policies discard reusable states, resulting in redundant recomputations.

To solve these challenges, this paper presents a unified, predictive, and multi-tier memory management architecture that extends effective KV cache capacity from 40 GB to over 38 TB per node while maintaining sub-millisecond Time-to-First-Token (TTFT) for hot entries.


🛠️ 关键架构创新

1. 架构变体感知的大小调整引擎

  • 计算针对特定注意力类型定制的精确内存需求。
  • 在研究评估的 MLA 模型(如 DeepSeek-V3)中,批处理大小提升高达 7.4 倍
  • 为分组查询注意力(GQA)模型提供全集群范围的统一容量规划优势。

1. Architecture-Variant-Aware Sizing Engine

  • Computes exact memory requirements tailored to specific attention types.
  • Achieves batch size gains of up to 7.4× for MLA models (such as DeepSeek-V3) evaluated in the study.
  • Provides fleet-wide unified sizing benefits for Grouped-Query Attention (GQA) models.

2. 六层内存层级

将有效的 KV Cache 容量扩展到多样化的存储层级中: * GPU HBM(最快,超低延迟) * CPU DRAM * CXL 连接内存 * 通过 GPUDirect Storage 访问的 NVMe * RDMA 网络 * 并行文件系统(大容量层级) * 结果: 将容量从 40 GB 扩展到 每节点 >38 TB,同时保持热点条目的 TTFT 在毫秒以内。

2. Six-Tier Memory Hierarchy

Extends the effective KV cache capacity across a diverse storage hierarchy: * GPU HBM (Fastest, ultra-low latency) * CPU DRAM * CXL-Attached Memory * NVMe via GPUDirect Storage * RDMA Fabric * Parallel Filesystems (Deep capacity tier) * Result: Expands capacity from 40 GB to >38 TB per node while keeping TTFT under a millisecond for hot entries.

3. 预测性贝叶斯重用与预取引擎

  • 采用利用 Beta 共轭先验的贝叶斯重用预测器,涵盖 16 种(块类型,转换类型)对。
  • 驱动 EMA 评分的头粒度驱逐RoPE 感知预取
  • 使用 ShareGPT、LMSYS-Chat-1M 和智能体工作负载进行的组件级轨迹回放验证显示,缓存命中率高达 70–84%

3. Predictive Bayesian Reuse & Prefetching Engine

  • Employs a Bayesian reuse predictor utilizing Beta conjugate priors across 16 (block-type, transition-type) pairs.
  • Drives EMA-scored head-granular eviction and RoPE-aware prefetching.
  • Validated component-level trace replays (using ShareGPT, LMSYS-Chat-1M, and agentic workloads) demonstrate high cache hit rates of 70–84%.

📊 预期性能提升

结合已验证的组件行为与公开的硬件规格进行的分析预测表明: * TTFT 缩减: 快 1.4 倍至 2.1 倍。 * 吞吐量提升: 增加 1.7 倍至 2.9 倍。 * 成本降低: 相较于已发布的基准,服务成本降低 47%。 (注:集群规模的预测属于分析性质,不包含误差范围)。

Analytical projections combining validated component behaviors with published hardware specifications indicate: * TTFT Reductions: 1.4× to 2.1× faster. * Throughput Improvements: 1.7× to 2.9× increase. * Cost Reduction: 47% lower serving cost relative to published baselines.
(Note: Cluster-scale projections are analytical and carry no error bars).


📋 元数据与引用