为知识图谱问答设计缓存机制,显著加速大模型推理
KGCache: Amortized Subgraph Retrieval for KG Reasoning with LLMs
- 在知识图谱问答中缓存常用实体邻域,减少重复查询
- 实测可提升检索速度1.91倍,全系统最高提速1.06倍
- 适合需要频繁访问知识图谱的问答系统开发者
大型语言模型在回答依赖知识的问题时,若结合知识图谱可提升可靠性。然而,Think-on-Graph和Reasoning-on-Graph等系统在处理不同问题时会反复查询相同的知识图谱邻域。本文研究此类重复检索现象,提出KGCache——一种针对一跳知识图谱邻域的内存缓存机制。该机制兼容迭代遍历(ToG)与单次规划(RoG)两种问答范式,置于KGQA引擎与知识图谱服务之间,使重复请求可直接从缓存获取,无需重新查询。在WebQSP和CWQ数据集上,使用LRU、LFU及基于轨迹的最优策略进行评估,结果显示两个数据集均存在显著的起始实体与遍历实体复用。进一步探索语义缓存,可在WebQSP上带来额外命中率提升,但对CWQ需进一步验证精度。实体缓存使知识图谱检索加速达1.91倍,语义上下文缓存实现最高1.06倍的系统级提速,每次命中最快可达3.73倍加速。
原文摘要 · Abstract (English)
Large language models can answer knowledge-intensive questions more reliably when they are grounded with knowledge graphs, but systems such as Think-on-Graph and Reasoning-on-Graph repeatedly query the same graph neighborhoods across different questions. In this work, we study this repeated retrieval in Knowledge Graph Question Answering~(KGQA) workloads and propose KGCache, an in-memory cache for one-hop knowledge graph neighborhoods. KGCache is designed to be compatible with both iterative traversal (ToG) and one shot planning (RoG) KGQA paradigms. KGCache is placed between the KGQA engine and the backend serving the KG, so repeated entity requests can be served from cache instead of issuing new KG queries. We evaluate KGCache on WebQSP and CWQ using LRU, LFU, and a trace-aware Oracle policy. Our analysis shows that both datasets contain substantial entity reuse among starting entities and entities reached during traversal. We also explore semantic caching for similar queries, which shows additional hit-rate gains on WebQSP and needs further accuracy testing on CWQ. Entity caching accelerates KG retrieval by up to $1.91\times$, while semantic-context caching achieves up to $1.06\times$ full-system speedup in the evaluated WebQSP configurations, with each hit being up to $3.73\times$ faster.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。