Retrieval-augmented generation (RAG) improves large language model (LLM) answer quality by grounding generation in external evidence, but processing retrieved contexts makes the prefill stage a dominant serving cost. RAG cache fusion reduces this cost by reusing precomputed key-value (KV) caches for retrieved chunks and selectively recomputing tokens under the current prompt. Existing selectors, however, face a dilemma between quality and efficiency: fast query-agnostic or final-layer query-to-context selectors can miss request-relevant evidence, whereas full-view query-aware selectors require broad context and layer visibility before recomputation and therefore stall the layer-wise cache-fusion pipeline. We present QCFuse, a compressed-view query-aware selector for RAG cache fusion. QCFuse uses chunk-anchor query probing to condition user-query states on compact per-chunk anchors and critical-layer profiling to identify recomputation tokens without all-layer inspection. We implement QCFuse in SGLang and evaluate it on four open-weight LLMs across six datasets. QCFuse reaches full-prefill-level quality. At matched quality, QCFuse achieves an average prefill-time speedup of 1.7x over full prefill and 1.5x over ProphetKV, the strongest quality-preserving baseline.
翻译:[translated abstract in Chinese]
检索增强生成(RAG)通过将生成过程锚定于外部证据来提升大语言模型(LLM)的回答质量,但处理检索到的上下文会导致预填充阶段成为主要的服务成本。RAG缓存融合技术通过复用已检索文本块的预计算键值(KV)缓存,并在当前提示词下选择性重计算部分token来降低此成本。然而,现有选择器面临质量与效率的两难困境:快速但查询无关或仅依赖最终层查询-上下文选择器可能遗漏与请求相关的证据,而全视图查询感知选择器在重计算前需获取广泛的上下文和层级可见性,从而阻碍了逐层缓存融合流水线。我们提出QCFuse,一种用于RAG缓存融合的压缩视图查询感知选择器。QCFuse采用分块锚点查询探测机制,将用户查询状态条件化于紧凑的逐块锚点上,并通过关键层剖析技术在不遍历所有层的情况下识别重计算token。我们在SGLang中实现QCFuse,并在六个数据集上对四个开源权重LLM进行评估。QCFuse达到全预填充级质量。在同等质量条件下,QCFuse相较于全预填充平均实现1.7倍的预填充加速比,相较于最强质量保持基线ProphetKV实现1.5倍加速比。