Layer-first Prefix KV Cache Loading for Low-latency Inference on Huawei CloudMatrix
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
Related papers
xInfer: Elastic Parallelism and Load Balancing for Long-Tail Offline LLM Inference
Shared title terminologycs.DCAo Sun, Yinghao Chen, Shiju Wang et al.
PrefixChain: Compact Prefix Caching for Hybrid LLMs
Shared title terminologycs.DCGenglin Wang, Wangsong Yin, Liekang Zeng et al.
Norn: Context-Length-Aware Optimization of Weight and KV Cache Placement for Offloaded LLM Inference
Shared title terminologycs.DCNaoto Sugiura, Hiroki Matsutani
Toward an Adaptive Optimizer for Generative Inference with Large Language Models
Shared title terminologycs.DCRuben Mayer, Nikita Agrawal, Alisa Pogodaeva
MiniMesh: Breaking Interconnect, DVFS, and Routing Walls for Distributed LLM Inference on Commodity Apple Silicon Clusters
Shared title terminologycs.DCYinChing Zhao, YangKuang Ou, Kenny Gao et al.
WeaveLayer: A General-Purpose Inference Framework Designed to Be Built by Coding Agents
Shared title terminologycs.DCWeiliang Liu