SubGCache: Accelerating Graph-based RAG with Subgraph-level KV Cache

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Zhu, Qiuyu, Zhang, Liang, Xu, Qianxiong, Long, Cheng, Zhang, Jie
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866918025079291904
author Zhu, Qiuyu
Zhang, Liang
Xu, Qianxiong
Long, Cheng
Zhang, Jie
author_facet Zhu, Qiuyu
Zhang, Liang
Xu, Qianxiong
Long, Cheng
Zhang, Jie
contents Graph-based retrieval-augmented generation (RAG) enables large language models (LLMs) to incorporate structured knowledge via graph retrieval as contextual input, enhancing more accurate and context-aware reasoning. We observe that for different queries, it could retrieve similar subgraphs as prompts, and thus we propose SubGCache, which aims to reduce inference latency by reusing computation across queries with similar structural prompts (i.e., subgraphs). Specifically, SubGCache clusters queries based on subgraph embeddings, constructs a representative subgraph for each cluster, and pre-computes the key-value (KV) cache of the representative subgraph. For each query with its retrieved subgraph within a cluster, it reuses the pre-computed KV cache of the representative subgraph of the cluster without computing the KV tensors again for saving computation. Experiments on two new datasets across multiple LLM backbones and graph-based RAG frameworks demonstrate that SubGCache consistently reduces inference latency with comparable and even improved generation quality, achieving up to 6.68$\times$ reduction in time-to-first-token (TTFT).
format Preprint
id arxiv_https___arxiv_org_abs_2505_10951
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle SubGCache: Accelerating Graph-based RAG with Subgraph-level KV Cache
Zhu, Qiuyu
Zhang, Liang
Xu, Qianxiong
Long, Cheng
Zhang, Jie
Machine Learning
Graph-based retrieval-augmented generation (RAG) enables large language models (LLMs) to incorporate structured knowledge via graph retrieval as contextual input, enhancing more accurate and context-aware reasoning. We observe that for different queries, it could retrieve similar subgraphs as prompts, and thus we propose SubGCache, which aims to reduce inference latency by reusing computation across queries with similar structural prompts (i.e., subgraphs). Specifically, SubGCache clusters queries based on subgraph embeddings, constructs a representative subgraph for each cluster, and pre-computes the key-value (KV) cache of the representative subgraph. For each query with its retrieved subgraph within a cluster, it reuses the pre-computed KV cache of the representative subgraph of the cluster without computing the KV tensors again for saving computation. Experiments on two new datasets across multiple LLM backbones and graph-based RAG frameworks demonstrate that SubGCache consistently reduces inference latency with comparable and even improved generation quality, achieving up to 6.68$\times$ reduction in time-to-first-token (TTFT).
title SubGCache: Accelerating Graph-based RAG with Subgraph-level KV Cache
topic Machine Learning
url https://arxiv.org/abs/2505.10951