Leveraging Approximate Caching for Faster Retrieval-Augmented Generation

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Bergman, Shai, Kermarrec, Anne-Marie, Petrescu, Diana, Pires, Rafael, Randl, Mathis, de Vos, Martijn, Zhang, Ji
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866917043741130752
author Bergman, Shai
Kermarrec, Anne-Marie
Petrescu, Diana
Pires, Rafael
Randl, Mathis
de Vos, Martijn
Zhang, Ji
author_facet Bergman, Shai
Kermarrec, Anne-Marie
Petrescu, Diana
Pires, Rafael
Randl, Mathis
de Vos, Martijn
Zhang, Ji
contents Retrieval-augmented generation (RAG) improves the reliability of large language model (LLM) answers by integrating external knowledge. However, RAG increases the end-to-end inference time since looking for relevant documents from large vector databases is computationally expensive. To address this, we introduce Proximity, an approximate key-value cache that optimizes the RAG workflow by leveraging similarities in user queries. Instead of treating each query independently, Proximity reuses previously retrieved documents when similar queries appear, substantially reducing the reliance on expensive vector database lookups. To efficiently scale, Proximity employs a locality-sensitive hashing (LSH) scheme that enables fast cache lookups while preserving retrieval accuracy. We evaluate Proximity using the MMLU and MedRAG question-answering benchmarks. Our experiments demonstrate that Proximity with our LSH scheme and a realistically-skewed MedRAG workload reduces database calls by 77.2% while maintaining database recall and test accuracy. We experiment with different similarity tolerances and cache capacities, and show that the time spent within the Proximity cache remains low and constant (4.8 microseconds) even as the cache grows substantially in size. Our results demonstrate that approximate caching is a practical and effective strategy for optimizing RAG-based systems.
format Preprint
id arxiv_https___arxiv_org_abs_2503_05530
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Leveraging Approximate Caching for Faster Retrieval-Augmented Generation
Bergman, Shai
Kermarrec, Anne-Marie
Petrescu, Diana
Pires, Rafael
Randl, Mathis
de Vos, Martijn
Zhang, Ji
Databases
Machine Learning
Performance
Retrieval-augmented generation (RAG) improves the reliability of large language model (LLM) answers by integrating external knowledge. However, RAG increases the end-to-end inference time since looking for relevant documents from large vector databases is computationally expensive. To address this, we introduce Proximity, an approximate key-value cache that optimizes the RAG workflow by leveraging similarities in user queries. Instead of treating each query independently, Proximity reuses previously retrieved documents when similar queries appear, substantially reducing the reliance on expensive vector database lookups. To efficiently scale, Proximity employs a locality-sensitive hashing (LSH) scheme that enables fast cache lookups while preserving retrieval accuracy. We evaluate Proximity using the MMLU and MedRAG question-answering benchmarks. Our experiments demonstrate that Proximity with our LSH scheme and a realistically-skewed MedRAG workload reduces database calls by 77.2% while maintaining database recall and test accuracy. We experiment with different similarity tolerances and cache capacities, and show that the time spent within the Proximity cache remains low and constant (4.8 microseconds) even as the cache grows substantially in size. Our results demonstrate that approximate caching is a practical and effective strategy for optimizing RAG-based systems.
title Leveraging Approximate Caching for Faster Retrieval-Augmented Generation
topic Databases
Machine Learning
Performance
url https://arxiv.org/abs/2503.05530