Developing a prompt caching technique with retrieval-augmented generation for efficient LLM inference
Abstract
Retrieval-Augmented Generation (RAG) improves the factual correctness of Large Language Models (LLMs) by using external sources of information. However, when adding fetched documents to user requests, the system creates large prompts resulting in increased latency in the prefill stage, ultimately harming the user experience. To resolve this issue, this report presents a single system which consolidates RAG with a modular Prompt Caching technology. Unlike traditional Key Value (KV) caching which concentrates on decoding, our strategy incorporates attention reuse with the prompt the processing phase. We view retrieved text portions as modular and, with the use of a Prompt Markup Language (PML) schema, attempt to patch pre-calculated attention states to new queries in order to avoid repetitive processing for documents that are frequently accessed. We used this architecture with the Falcon-7B model and a BM25 retrieval system to evaluate it on the LongBench benchmark. We used the Prompt Cache + RAG system and M. Y. demonstrated that longitudinal processing with Falcon-7B and BM25 yielded a greater temporal efficiency on the LongBench benchmark. Our experiments indicate that the Prompt Cache + RAG system greatly reduces Time-To-First-Token (TTFT) (12 to 66 times) for both CPUs and GPUs when compared to the traditional RAG system. Most importantly, the generation quality remains the same resulting in a statistical equivalence in accuracy (F1 and ROUGE)on cached and non-cached…
Read the paper
Related studies
- Knowledge Management Perspective of Generative Artificial Intelligence
- Navigating Generative Artificial Intelligence Promises and Perils for Knowledge and Creative Work
- Characterizing the evolving research on enterprise content management
- Large language models and multimodal foundation models for precision oncology
- From Generative AI to Extended Reality: Multidisciplinary Perspectives on the Challenges, Opportunities, and Future of Educational Computing
- Generative Artificial Intelligence: A New Engine for Advancing Environmental Science and Engineering
Go deeper in Evidence Hub
Evidence Hub adds a study data sheet (design, sample size, evidence level, key numbers), an AI summary and a chat grounded in the paper's text.