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).
翻译:大语言模型与检索增强生成的融合显著推进了知识图谱问答技术的发展。然而,现有基于LLM的KGQA系统作为无状态规划器运行——孤立生成检索计划而未利用历史查询模式,类比于未设置计划缓存的数据库系统对所有查询进行从头优化。这一根本性设计缺陷导致模式幻觉与检索覆盖不足。本文提出CacheRAG,一种面向基于LLM的KGQA的系统性缓存增强架构,将无状态规划器转化为持续学习架构。与传统数据库计划缓存(以频率优化为目标)不同,CacheRAG针对大语言模型场景提出三项全新设计原则:(1)模式无关用户界面:通过中间语义表示实现两阶段语义解析框架,使非专业用户能够完全以自然语言交互,同时后端适配器利用本地模式上下文引导LLM安全编译可执行物理查询。(2)多样性优化的缓存检索:采用双层层次索引(领域→方面)结合最大边际相关性,最大化缓存示例的结构多样性,有效缓解推理同质化问题。(3)有界启发式扩展:具有严格复杂度保证的确定性深度与广度子图算子,在不引入无界API执行风险的前提下显著提升检索召回率。在多个基准测试上的广泛实验表明,CacheRAG显著优于现有最优基线(在CRAG数据集上准确率提升13.2%,真实性提升17.5%)。