Skip to content

Layer-first Prefix KV Cache Loading for Low-latency Inference on Huawei CloudMatrix

Ruozhuo Gan, Yuedong Xu

cs.DC

Abstract

KV cache management is critical for efficient LLM serving, enabling computational reduction and request-level reuse in autoregressive decoding. However, as context lengths and model sizes increase, host-to-device KV cache transfer has emerged as a latency-critical bottleneck. Conventional systems adopt token-first layout optimized for bulk RDMA transfers in scale-out networks, requiring all layers to arrive before inference can begin, substantially increasing time-to-first-token (TTFT). We address this limitation by exploiting the high-bandwidth UnifiedBus (UB) interconnects available in scale-up architectures like Huawei CloudMatrix384. We propose two key methods: redesigning KV cache into a layer-first layout to enable independent fetching of each layer, and replacing bulk SDMA transfers with fine-grained AIV load/store operations, which provide significantly lower latency for small transfers. This design enables efficient prefetching of early-layer KV data while overlapping subsequent layer transfers with computation. Evaluated on an 8-NPU CloudMatrix instance serving Qwen3-32B with a 6,912-token prefix, our approach reduces P50 warm-start TTFT by 11.4\% compared to conventional bulk SDMA, demonstrating the effectiveness of co-designing cache layouts and transfer mechanisms for scale-up LLM serving architectures.

Create a lesson

Metadata

Categories
cs.DC, cs.NI
Comments
8 pages