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.txt
Set up the mock api server for CRAG, according to the instructions here: https://github.com/ysunbp/CacheRAG-code/tree/main/mockapi
Download data folder, results folder, and utils/CRAG_raw folder from https://drive.google.com/drive/folders/1jNsSfddvmtVhH2edLH8PVdPYhy7qIjTh?usp=sharing
Please follow the these steps to perform KBQA on CRAG
$ cd scripts
$ python crag-cacherag-deepseek-exp.py
$ python crag-cacherag-deepseek-eval.py
Please 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