Skip to content

Latest commit

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

FRAG pipeline

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.

Overview of FRAG.

Step 0: Data preprocessing

Get test_name.jsonl using PPR algorithm.

Refer to data preprocessing for details.

Step 1: Get reasoning paths

pythongetPaths.py

This 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.

Step 2: Reasoning using paths and LLM

pythonReason.py

Step 3: FRAG

Download the Reasoning-aware model from here, and run

pythonFRAG.py

Step 4: FRAG_F

set stop_tokens = ["\n"], and run

pythongetHopPred.py

After getting the hop prediction for FRAG-Simple and FRAG-Complex, run

pythonFRAG_F.py

for 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"
}

About

The codes are associated with the following paper: FRAG: A Flexible Modular Framework for Retrieval-Augmented Generation based on Knowledge Graphs (ACL’2025)

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages