面向华为CloudMatrix的低延迟推理的层优先前缀KV缓存加载
Layer-first Prefix KV Cache Loading for Low-latency Inference on Huawei CloudMatrix
AI总结:
该研究针对华为CloudMatrix架构,提出层优先KV缓存布局与细粒度AIV传输方法,将8-NPU实例服务Qwen3-32B时的P50预热TTFT降低11.4%,解决了批量传输导致的首令牌延迟瓶颈。
摘要:
KV缓存管理对于高效的大语言模型(LLM)服务至关重要,它能在自回归解码中实现计算量减少和请求级复用。然而,随着上下文长度和模型规模的增加,主机到设备的KV缓存传输已成为延迟关键瓶颈。传统系统采用令牌优先布局,针对横向扩展网络中的批量RDMA传输进行优化,要求所有层到达后才能开始推理,这大幅增加了首令牌时间(TTFT)。我们通过利用华为CloudMatrix384等纵向扩展架构中可用的高带宽统一总线(UnifiedBus, UB)互连来解决这一限制。我们提出两种关键方法:将KV缓存重新设计为层优先布局,以实现各层的独立获取;用细粒度AIV加载/存储操作替代批量SDMA传输,该操作对于小数据传输能提供显著更低的延迟。此设计支持早期层KV数据的高效预取,同时将后续层传输与计算重叠。在服务Qwen3-32B的8-NPU CloudMatrix实例上,使用6912令牌的前缀进行评估,与传统批量SDMA相比,我们的方法将P50预热首令牌时间(TTFT)降低了11.4%,证明了针对纵向扩展LLM服务架构协同设计缓存布局和传输机制的有效性。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。