用共享磁盘缓存降低RAG大模型推理延迟,提升多实例并发性能。
Shared Disk KV Cache Management for Efficient Multi-Instance Inference in RAG-Powered LLMs
- 通过磁盘共享KV缓存缓解长文本预填充计算压力。
- 单机双卡环境下吞吐提升15~71%,延迟降低12~65%。
- 适合高并发RAG服务场景,尤其适合资源受限部署。
当前大语言模型(LLMs)在输入上下文长度和模型规模持续增长的背景下,推理延迟日益加剧。特别是检索增强生成(RAG)技术通过引入外部知识显著增加输入标记数量,导致预填充阶段计算开销大幅上升,进而延长首次输出时间(TTFT)。为解决此问题,本文提出一种基于磁盘的键值(KV)缓存机制,以减轻预填充阶段的计算负担。我们设计了一种面向多实例RAG服务环境的磁盘共享KV缓存管理系统——Shared RAG-DCache。该系统结合最优资源配置,在给定资源约束下同时提升吞吐量与降低延迟。Shared RAG-DCache利用用户查询相关文档的局部性以及大模型推理服务中的队列延迟特性,主动为相关文档生成并存储磁盘级KV缓存,并在多个LLM实例间共享。在配备2块GPU和1个CPU的单机实验中,Shared RAG-DCache实现了15~71%的吞吐量提升,以及最高达12~65%的延迟降低,具体效果取决于资源配置。
原文摘要 · Abstract (English)
Recent large language models (LLMs) face increasing inference latency as input context length and model size continue to grow. In particular, the retrieval-augmented generation (RAG) technique, which enhances LLM responses by incorporating external knowledge, exacerbates this issue by significantly increasing the number of input tokens. This expansion in token length leads to a substantial rise in computational overhead, particularly during the prefill stage, resulting in prolonged time-to-first-token (TTFT). To address this issue, this paper proposes a method to reduce TTFT by leveraging a disk-based key-value (KV) cache to lessen the computational burden during the prefill stage. We also introduce a disk-based shared KV cache management system, called Shared RAG-DCache, for multi-instance LLM RAG service environments. This system, together with an optimal system configuration, improves both throughput and latency under given resource constraints. Shared RAG-DCache exploits the locality of documents related to user queries in RAG, as well as the queueing delay in LLM inference services. It proactively generates and stores disk KV caches for query-related documents and shares them across multiple LLM instances to enhance inference performance. In experiments on a single host equipped with 2 GPUs and 1 CPU, Shared RAG-DCache achieved a 15~71% increase in throughput and up to a 12~65% reduction in latency, depending on the resource configuration.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。