This is the repository for the CacheRAG: A Novel Approach to Enhance KG-based RAG Through Caching Mechanisms.
$ git clone [link to repo]
$ cd CacheRAG-code
$ pip install -r requirements.txt If you are using Anaconda, you can create a virtual environment and install all the packages:
$ conda create --name CacheRAG python=3.9
$ conda activate CacheRAG
$ pip install -r requirements.txtSet up the mock api server for CRAG, according to the instructions here: https://github.com/ysunbp/CacheRAG-code/tree/main/mockapi
Unzip CacheRAG-20260705T031737Z-3-001.zip to get the data folder, results folder, and utils/CRAG_raw
Please follow the these steps to perform KBQA on CRAG
$ cd scripts
$ python crag-cacherag-deepseek-exp.py
$ python crag-cacherag-deepseek-eval.pyPlease set up the Wikisp model first in the sparql-based folder and then follow the following instructions.
$ cd sparql-based
$ python auto-gen-sparql.py
$ python -m torch.distributed.run --nproc_per_node 1 CacheRAG-QALD.py