hmhm1229 commited on
Commit
07b9559
·
verified ·
1 Parent(s): ff4ea1a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +120 -1
README.md CHANGED
@@ -6,4 +6,123 @@ base_model:
6
  - Qwen/Qwen2.5-VL-7B-Instruct
7
  ---
8
 
9
- Arxiv: https://arxiv.org/abs/2505.22095
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  - Qwen/Qwen2.5-VL-7B-Instruct
7
  ---
8
 
9
+
10
+ <div align="center">
11
+
12
+ <h1> R1-Router: Learning to Route Queries across Knowledge Bases for Step-wise Retrieval-Augmented Reasoning </h1>
13
+
14
+
15
+ <h5 align="center">
16
+
17
+ <a href='https://arxiv.org/abs/2505.22095'><img src='https://img.shields.io/badge/Paper-Arxiv-red'></a>
18
+ <a href='https://huggingface.co/hmhm1229/R1-Router'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue'>
19
+ <a href='https://huggingface.co/hmhm1229/R1-Router-3B'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue'>
20
+
21
+ Chunyi Peng<sup>1,3</sup>,
22
+ Zhipeng Xu<sup>1</sup>,
23
+ Zhenghao Liu<sup>1</sup>,
24
+ Yishan Li<sup>3</sup>,
25
+ Yukun Yan<sup>2</sup>,
26
+ Zhiyuan Liu<sup>2</sup>,
27
+ Yu Gu<sup>1</sup>
28
+ Minghe Yu<sup>1</sup>
29
+ Ge Yu<sup>1</sup>
30
+ Maosong Sun<sup>2</sup>
31
+
32
+ <sup>1</sup>Northeastern University, <sup>2</sup>Tsinghua University, <sup>3</sup>ModleBest Inc.
33
+
34
+ <h5 align="center"> If you find this project useful, please give us a star🌟.
35
+ </h5>
36
+ </div>
37
+
38
+ ## News
39
+ 8.22 We upload [R1-Router-3B](https://huggingface.co/hmhm1229/R1-Router-3B).
40
+
41
+ ## Environment
42
+ For training, answer generation, and evaluation processes:
43
+ ```bash
44
+ conda create -n router python=3.11
45
+ conda activate router
46
+ pip install requirements_router.txt
47
+ ```
48
+ For retriever and corpus construction processes:
49
+ ```bash
50
+ conda create -n retriever python=3.11
51
+ conda activate retriever
52
+ pip install requirements_retriever.txt
53
+ ```
54
+
55
+ ## Corpora Construction
56
+ For the text corpus, you can download `enwiki-20241020` from [Huggingface](https://huggingface.co/datasets/hmhm1229/enwiki-20241020). Then preprocess, and index it with the following commands:
57
+ ```bash
58
+ 7z x enwiki-20241020-pages-articles-multistream.xml.zip.001
59
+ conda activate retriever
60
+ wikiextractor enwiki-20241020-pages-articles-multistream.xml.bz2 -o wiki_extracted
61
+ python wiki_preprocess.py
62
+ ```
63
+ For the image corpus, you can directly download [M-BEIR](https://huggingface.co/datasets/TIGER-Lab/M-BEIR). To embed and index it you can follow the [repository](https://github.com/TIGER-AI-Lab/UniIR)
64
+
65
+ For the table corpus, you can download, embed and index Open-WikiTable following the [repository](https://github.com/sean0042/Open_WikiTable), or you can download directly the one we have already preprocessed from [here](https://huggingface.co/hmhm1229/table-retriever).
66
+
67
+ ## Retrievers Preparation
68
+ For the Text-Image Retriever, you can directly download [UniIR](https://huggingface.co/TIGER-Lab/UniIR)
69
+
70
+ For the Table Retriever, you can train it with the help of [repository](https://github.com/sean0042/Open_WikiTable), or you can download it directly from [here](https://huggingface.co/hmhm1229/table-retriever).
71
+
72
+ ## Datasets
73
+ We have prepared all the text datasets in `./datasets`, for images you need to download them from:
74
+ - `InfoSeek:` InfoSeek images can be downloaded from [OVEN](https://github.com/open-vision-language/oven/tree/main/image_downloads)
75
+ - `Dyn-VQA:` Dynamic VQA images can be downloaded from [DynVQA_en.202412](https://github.com/Alibaba-NLP/OmniSearch/blob/main/dataset/DynVQA_en/DynVQA_en.202412.jsonl)
76
+ - `WebQA:` WebQA images can be downloaded from [Google Drive](https://drive.google.com/drive/folders/19ApkbD5w0I5sV1IeQ9EofJRyAjKnA7tb)
77
+
78
+ ## Training
79
+ If you do not want to train the model, you can download [R1-Router](https://huggingface.co/hmhm1229/R1-Router) and skip this section to [Evaluation](#evaluation)
80
+ ### Data Synthesis
81
+ If you want to use the ready-to-use synthetic data directly, you can skip this section to [Step-GRPO Training](#step-grpo-training)
82
+
83
+ First, we need to synthesis the data step by step:
84
+ ```bash
85
+ bash src/data_synthesis/data_synthesis.sh
86
+ ```
87
+ ### Step-GRPO Training
88
+ Our training framework is based on [EasyR1](https://github.com/hiyouga/EasyR1), only you need to do is to download it and replace some files with the files in `./Easy-R1`.
89
+ Then start training with the command:
90
+ ```bash
91
+ conda activate router
92
+ bash examples/run_qwen2_5_vl_7b_stepgrpo.sh
93
+ ```
94
+ ## Evaluation
95
+ We provide the evaluation pipeline for the R1-Router:
96
+ ```bash
97
+ bash evaluation.sh
98
+ ```
99
+ or, you can just evaluate the results we have provided by:
100
+ ```bash
101
+ conda activate router
102
+ cd src
103
+ python evaluate.py --dataset_name all --method "r1-router3"
104
+ ```
105
+
106
+ ## Acknowledgement
107
+ Our work is built on the following codebases, and we are deeply grateful for their contributions.
108
+ - [EasyR1](https://github.com/hiyouga/EasyR1)
109
+ - [UniIR](https://huggingface.co/TIGER-Lab/UniIR)
110
+ - [Open-WikiTable](https://github.com/sean0042/Open_WikiTable)
111
+ - [OmniSearch](https://github.com/Alibaba-NLP/OmniSearch)
112
+
113
+ ## Citation
114
+ We appreciate your citations if you find our paper related and useful to your research!
115
+ ```
116
+ @article{peng2025r1,
117
+ title={Learning to Route Queries across Knowledge Bases for Step-wise Retrieval-Augmented Reasoning},
118
+ author={Peng, Chunyi and Xu, Zhipeng and Liu, Zhenghao and Li, Yishan and Yan, Yukun and Wang, Shuo and Liu, Zhiyuan and Gu, Yu and Yu, Minghe and Yu, Ge and Sun, Maosong},
119
+ year={2025}
120
+ url={https://arxiv.org/abs/2505.22095},
121
+ }
122
+ ```
123
+
124
+ ## Contact Us
125
+ If you have questions, suggestions, and bug reports, please email us, we will try our best to help you.
126
+ ```
127
128
+ ```