QA-GraphRAG: Query-Adaptive Plug-and-Play Retrieval Integration for Graph-based Retrieval-Augmented Generation
This repository contains the implementation of QA-GraphRAG based on RAPTOR in the paper "QA-GraphRAG: Query-Adaptive Plug-and-Play Retrieval Integration for Graph-based Retrieval-Augmented Generation".
-
To install the requirements:
pip install -r requirements.txt
-
Please follow the official instruction here to install PyTorch;
-
Download "hotpot_train.json" from here, and put it under the "inputs" directory.
To run QA-GraphRAG (based on RAPTOR) on GraphRAG-Bench:
-
build tree for GraphRAG-Bench, the tree built will be under the root directory:
python build_tree.py python merge_tree.py
-
generate training data for router and train the MLP-based router:
python gen_train_hotpot.py python train_mlp.py
-
run evaluation on GraphRAG-Bench, results will be in sample_output.json:
bash run_eval.sh