TurboRAG:通过为分块文本预计算 KV 缓存来加速检索增强生成
TurboRAG: Accelerating Retrieval-Augmented Generation with Precomputed KV Caches for Chunked Text
AI总结:
TurboRAG 通过离线预计算并存储文档的 KV 缓存,在推理时直接检索复用,消除了在线计算开销,在不修改模型的前提下将首个 token 延迟最高降低 9.4 倍且保持性能。
摘要:
当前的检索增强生成(RAG)系统会拼接并处理大量检索到的文档块以进行预填充,这需要大量的计算,从而导致首个 token 延迟(TTFT)显著增加。为了减少计算开销和 TTFT,我们提出了 TurboRAG,这是一种新颖的 RAG 系统。它重新设计了当前 RAG 系统的推理范式:首先离线预计算并存储文档的键值(KV)缓存,然后在预填充时直接检索已保存的 KV 缓存。因此,在推理过程中消除了 KV 缓存的在线计算。此外,我们提供了关于掩码矩阵和位置嵌入机制的若干见解,并对预训练语言模型进行了微调以保持 TurboRAG 的模型精度。我们的方法适用于大多数现有的大语言模型及其应用,无需对模型和推理系统进行任何修改。在一系列 RAG 基准上的实验结果表明,与传统 RAG 系统相比,TurboRAG 将 TTFT 降低了多达 9.4 倍(平均 8.6 倍),同时保持了与标准 RAG 系统相当的性能。
英文摘要:
Current Retrieval-Augmented Generation (RAG) systems concatenate and process numerous retrieved document chunks for prefill which requires a large volume of computation, therefore leading to significant latency in time-to-first-token (TTFT). To reduce the computation overhead as well as TTFT, we introduce TurboRAG, a novel RAG system that redesigns the inference paradigm of the current RAG system by first pre-computing and storing the key-value (KV) caches of documents offline, and then directly retrieving the saved KV cache for prefill. Hence, online computation of KV caches is eliminated during inference. In addition, we provide a number of insights into the mask matrix and positional embedding mechanisms, plus fine-tune a pretrained language model to maintain model accuracy of TurboRAG. Our approach is applicable to most existing large language models and their applications without any requirement in modification of models and inference systems. Experimental results across a suite of RAG benchmarks demonstrate that TurboRAG reduces TTFT by up to 9.4x compared to the conventional RAG systems (on an average of 8.6x), but reserving comparable performance to the standard RAG systems.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。