让大模型问答系统学会记忆历史查询,提升准确性和可靠性。
CacheRAG: A Semantic Caching System for Retrieval-Augmented Generation in Knowledge Graph Question Answering

- 用语义缓存机制让问答系统从零开始变成持续学习的智能体。
- 在多个数据集上准确率提升13.2%,真实性提高17.5%。
- 适合需要长期优化知识图谱问答的系统开发者使用。
大型语言模型(LLM)与检索增强生成(RAG)的结合显著推动了知识图谱问答(KGQA)的发展。然而,现有基于LLM的KGQA系统缺乏历史查询记忆,每次查询都像从头规划,导致模式幻觉和检索覆盖不足。本文提出CacheRAG,一种面向LLM的语义缓存架构,将无状态的规划器转变为持续学习的系统。核心设计包括:(1) 语义无关的用户接口:通过中间语义表示(ISR)实现两阶段自然语言解析,配合后端适配器,安全生成可执行查询;(2) 多样性优化缓存检索:采用分层索引(领域→方面)与最大边际相关性(MMR),提升缓存例题结构多样性,缓解推理同质化;(3) 有限启发式扩展:使用确定性的深度与广度子图操作,严格控制复杂度,显著提升召回率而不引发无限调用风险。在多个基准测试中,CacheRAG显著优于现有最优基线,如在CRAG数据集上准确率提升13.2%,真实性提升17.5%。
原文摘要 · Abstract (English)
The integration of Large Language Models (LLMs) with Retrieval-Augmented Generation (RAG) has significantly advanced Knowledge Graph Question Answering (KGQA). However, existing LLM-driven KGQA systems act as stateless planners, generating retrieval plans in isolation without exploiting historical query patterns: analogous to a database system that optimizes every query from scratch without a plan cache. This fundamental design flaw leads to schema hallucinations and limited retrieval coverage. We propose CacheRAG, a systematic cache-augmented architecture for LLM-based KGQA that transforms stateless planners into continual learners. Unlike traditional database plan caching (which optimizes for frequency), CacheRAG introduces three novel design principles tailored for LLM contexts: (1) Schema-agnostic user interface: A two-stage semantic parsing framework via Intermediate Semantic Representation (ISR) enables non-expert users to interact purely in natural language, while a Backend Adapter grounds the LLM with local schema context to compile executable physical queries safely. (2) Diversity-optimized cache retrieval: A two-layer hierarchical index (Domain $\rightarrow$ Aspect) coupled with Maximal Marginal Relevance (MMR) maximizes structural variety in cached examples, effectively mitigating reasoning homogeneity. (3) Bounded heuristic expansion: Deterministic depth and breadth subgraph operators with strict complexity guarantees significantly enhance retrieval recall without risking unbounded API execution. Extensive experiments on multiple benchmarks demonstrate that CacheRAG significantly outperforms state-of-the-art baselines (e.g., +13.2% accuracy and +17.5% truthfulness on the CRAG dataset).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。