The codes are associated with the following paper:
FRAG: A Flexible Modular Framework for Retrieval-Augmented Generation based on Knowledge Graphs [PDF]
Zengyi Gao, Yukun Cao, Hairu Wang, Ao Ke, Yuan Feng, Xike Xie, S Kevin Zhou
Annual Meeting of the Association for Computational Linguistics (ACL), 2025.
Get test_name.jsonl using PPR algorithm.
Refer to data preprocessing for details.
python getPaths.pyThis script will generate reasoning paths for each query. The paths are generated usingRecordPipeline(PreRetrievalModuleBGE(64), RetrievalModuleBFS(2), PostRetrievalModuleBGE(32)) for simple query, RecordPipeline(PreRetrievalModuleBGE(64), RetrievalModuleDij(4), PostRetrievalModuleBGE(32)) for complex query.
python Reason.pyDownload the Reasoning-aware model from here, and run
python FRAG.pyset stop_tokens = ["\n"], and run
python getHopPred.pyAfter getting the hop prediction for FRAG-Simple and FRAG-Complex, run
python FRAG_F.pyfor final FRAG_F prediction.
Cite our paper: If you find this work is helpful to your research, please consider citing our paper:
@inproceedings{gao-FRAG-2025,
title = "FRAG: A Flexible Modular Framework for Retrieval-Augmented Generation based on Knowledge Graphs",
author = "Zengyi Gao, Yukun Cao, Hairu Wang, Ao Ke, Yuan Feng, Xike Xie, S Kevin Zhou",
booktitle = "Findings of the Association for Computational Linguistics: ACL 2025",
year = "2025",
publisher = "Association for Computational Linguistics"
}