arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.21500cs.DCcs.LG
收藏

当KV缓存比GPU更慢:为上下文并行预填充扩展远程KV层

When the KV Cache Is Slower Than the GPU: Scaling Remote KV Tiers for Context-Parallel Prefill

Multiverse Computing

Muhammad Ibrahim

AI总结:

该研究针对长上下文LLM服务中远程KV层过慢导致的性能问题,提出分片MLA KV存储、划分远程层等四项优化,使预填充吞吐量提升34%,相关变更已提交至LMCache上游。

摘要:

在长上下文大语言模型(LLM)服务中,跨请求复用注意力KV缓存是降低预填充成本的标准方法,生产系统越来越多地为每个引擎的缓存配备由所有引擎共享的远程层。我们在8台B300节点上运行预填充上下文并行(PCP8)的GLM-5.3模型(一种采用多头潜在注意力(MLA)的FP8混合专家模型)的拆分部署中研究了该远程层。启用远程层(带Valkey存储的LMCache)后,首次生成令牌的中位时间保持不变,但16k令牌的第99百分位时间从3.96秒升至17.3秒。在隔离引擎上重放生产请求流时,我们发现远程命中耗时0.88秒,而重新计算提示仅需0.31秒,且同步加载会使命中密集流的队列不稳定:第99百分位时间达83.32秒,GPU利用率仅为7%。一个两项成本模型解释了这一现象:仅当远程层提供的带宽超过B*=sR(本模型和GPU的B*为2.53 GB/s)时,命中才划算;且每次命中存在固定引擎成本(T0≈0.33秒),这意味着对于长度小于约17k令牌的提示,无论带宽如何,命中都无法胜过重新计算。基于该模型,我们开展了四项工作:(i)在PCP秩间分片MLA KV存储,证明现有跨秩最小查找可返回最长缓存前缀,并设计不会导致集体操作不同步的加载协议;(ii)按秩划分远程层,每个秩对应一个服务器实例且无需协调,使GET带宽提升6.3倍至10.76 GB/s;(iii)为分片存储添加异步加载;(iv)修复导致无界停顿的三个客户端错误。在命中密集流中,98.5%的提示令牌由远程层提供服务,第99百分位时间从83.32秒降至0.67秒。分片存储使预填充吞吐量提升14%,结合上游内核修复后提升34%。所有变更均已提交至LMCache上游。

英文摘要:

Reusing the attention KV cache across requests is a standard way to cut prefill cost in long-context LLM serving, and production systems increasingly back the per-engine cache with a remote tier shared by every engine. We study such a tier in a disaggregated deployment of GLM-5.3, an FP8 mixture-of-experts model with multi-head latent attention (MLA), on 8xB300 nodes running prefill context parallelism (PCP8). Enabling the remote tier (LMCache with a Valkey store) left median time-to-first-token unchanged but raised the 16k-token p99 from 3.96 s to 17.3 s. Replaying a production request stream on an isolated engine, we find that a remote hit took 0.88 s against 0.31 s to recompute the prompt, and that synchronous loading turned a hit-heavy stream into an unstable queue: p99 83.32 s with the GPUs 7% busy. A two-term cost model explains both: a hit pays off only if the tier delivers more than B* = sR (2.53 GB/s for this model and GPU), and a fixed per-hit engine cost (T0 ~ 0.33 s) means that hits on prompts shorter than about 17k tokens cannot beat recompute at any bandwidth. Guided by the model, we (i) shard the MLA KV store across PCP ranks, with a proof that the existing minimum-over-ranks lookup returns the longest cached prefix and a load protocol that can never desynchronize collectives; (ii) partition the remote tier by rank, one server instance per rank with no coordination, which raises GET bandwidth 6.3x to 10.76 GB/s; (iii) add asynchronous loading to the sharded store; and (iv) fix three client bugs that caused unbounded stalls. On the hit-heavy stream, with 98.5% of prompt tokens served from the remote tier, p99 falls from 83.32 s to 0.67 s. The sharded store raises prefill throughput by 14%, and by 34% together with an upstream kernel fix. All changes are submitted upstream to LMCache.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑