模型精选

物理分区KV缓存格式实现CPU-GPU负载均衡

Physically Partitioned KVCache Format for CPU--GPU Load Balancing in MoE Inference

精选理由

DeepSeek和智谱AI团队的新方法,通过优化KV缓存布局,让CPU和GPU能更高效地分担负载,提升长文本处理速度。

为混合专家(MoE)模型的长上下文推理,提出了一种新的KV缓存格式。该格式在写入时固定每个字节的物理位置,支持CPU和GPU动态负载平衡,无需移动数据。在DeepSeek-V2-Lite、Qwen3-30B-A3B和Mixtral-8×7B等模型上测试,在32GB显存下支持百万级令牌的端到端推理,长上下文(≥8K)下在A100和V100上比基线快1.5-2.5倍。

原文 · arXiv: DeepSeek

Physically Partitioned KVCache Format for CPU--GPU Load Balancing in MoE Inference

Single-GPU long-context inference with Mixture-of-Experts (MoE) models requires spilling the key-value cache (KVCache) to CPU memory. The spilled KV serves two complementary purposes---transferring to the GPU for attention computation, or computing in-place on the CPU---which demand opposing physical states. The optimal split between them varies with workload, yet existing KVCache abstractions offer only storage semantics over a monolithic object of a single physical state, and cannot express dynamic load balancing. We propose InplaceKVCache, the first KVCache abstraction whose format fixes each byte's physical residency at write time, so that the CPU--GPU load balance can be adjusted without moving data after placement. It realizes this as a four-region layout along two dimensions---device affinity and access pattern---turning load balancing into pure scheduling. Built on this abstraction, WriteScope splits CPU--GPU shares along the sequence dimension, and a portable roofline performance model determines the optimal CPU share as sequence length evolves, with online feedback tracking CPU cost drift. On three MoE models (DeepSeek-V2-Lite, Qwen3-30B-A3B, Mixtral-8$\times$7B) with a 32~GB VRAM budget, WriteScope supports end-to-end inference at the 1M-token aggregate scale. In the long-context regime ($\ge$8K), it achieves geometric-mean speedups of $1.5\times$--$2.5\times$ on A100 and $1.4\times$--$1.7\times$ on V100 over four reproduced baselines, while vLLM, SGLang, and KTransformers fail even with a doubled KV budget. A DeepSeek-V4-Flash case study validates composition with native sparse attention.