RAGCache:面向检索增强生成的高效知识缓存
RAGCache: Efficient Knowledge Caching for Retrieval-Augmented Generation
AI总结:
针对RAG因知识注入长序列导致的高计算与内存开销,提出多级动态缓存系统RAGCache,通过知识树组织中间状态并设计感知LLM推理与RAG检索的替换策略及重叠机制,使首字时间最多降低4倍、吞吐量最多提升2.1倍。
摘要:
检索增强生成(RAG)通过整合大语言模型(LLM)和外部知识库的优势,在各类自然语言处理任务中展现出显著的性能提升。然而,RAG引入了长序列生成,导致高昂的计算和内存开销。我们提出了RAGCache,一种专为RAG量身定制的新型多级动态缓存系统。我们的分析对现有RAG系统进行了基准测试,指出了性能瓶颈(即知识注入导致的长序列)和优化机会(即缓存知识的中间状态)。基于这些洞察,我们设计了RAGCache,它将检索知识的中间状态组织在知识树中,并将其缓存在GPU和主机内存层级中。RAGCache提出了一种感知LLM推理特性和RAG检索模式的替换策略。它还动态重叠检索和推理步骤,以最小化端到端延迟。我们实现了RAGCache,并在最先进的LLM推理系统vLLM和最先进的向量数据库Faiss上进行了评估。实验结果表明,与集成Faiss的vLLM相比,RAGCache将首字时间(TTFT)最多减少4倍,并将吞吐量最多提升2.1倍。
英文摘要:
Retrieval-Augmented Generation (RAG) has shown significant improvements in various natural language processing tasks by integrating the strengths of large language models (LLMs) and external knowledge databases. However, RAG introduces long sequence generation and leads to high computation and memory costs. We propose RAGCache, a novel multilevel dynamic caching system tailored for RAG. Our analysis benchmarks current RAG systems, pinpointing the performance bottleneck (i.e., long sequence due to knowledge injection) and optimization opportunities (i.e., caching knowledge's intermediate states). Based on these insights, we design RAGCache, which organizes the intermediate states of retrieved knowledge in a knowledge tree and caches them in the GPU and host memory hierarchy. RAGCache proposes a replacement policy that is aware of LLM inference characteristics and RAG retrieval patterns. It also dynamically overlaps the retrieval and inference steps to minimize the end-to-end latency. We implement RAGCache and evaluate it on vLLM, a state-of-the-art LLM inference system and Faiss, a state-of-the-art vector database. The experimental results show that RAGCache reduces the time to first token (TTFT) by up to 4x and improves the throughput by up to 2.1x compared to vLLM integrated with Faiss.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。