We propose ReSearch, a novel framework that trains LLMs to Reason with Search via reinforcement learning without using any supervised data on reasoning steps. Our approach treats search operations as integral components of the reasoning chain, where when and how to perform searches is guided by text-based thinking, and search results subsequently influence further reasoning.
📰 News
[2025-03-26] 🎉 We release the paper, update the code and open-source the models.
📝 The paper is released on arXiv, more details and evaluation results can be found in our paper.
🛠️ The repository is updated with the new implementation, especially the rollout with search during RL training. This version of implementation is based on the latest release of verl.
[2025-03-03] ✅ We have released the preview version of ReSearch implementation.
📦 Installation
We recommend using conda to manage the environment. First create a conda environment and activate it.
Then install dependencies, and our modified verl and flashrag packages under src/ will be installed in the editable mode. Check out setup.py for details.
As described in the FlashRAG, due to the incompatibility when installing faiss using pip, we need to use the following conda command to install faiss-gpu.
As described in our paper, during model training and evaluation, search operation will be conducted in the rollout and inference process. In practice, we host a retriever service via FlashRAG and FastAPI. Hence, the search operation is standardized to be an API call. This serving can be used to decouple the search operation from the reinforcement learning process, making the training and evaluation more clear and flexible.
For starting the retriever serving, you need to first fill the scripts/serving/retriever_config.yaml with the correct path to the retrieval model, index, and corpus, and available GPU ids. Then, you can run the following command to start the retriever serving:
The started retriever serving will be used in the training and evaluation process in the following part.
Data Preparation
ReSearch is trained on the training set of MuSiQue, and evaluated on the dev set of HotpotQA, 2WikiMultiHopQA, MuSiQue and Bamboogle. For downloading the datasets, please refer to the data/download_dataset.sh script.
bash
1cd data
2bash download_dataset.sh
For preparing the training and validation data for following reinforcement learning, please run this script to parse the MuSiQue dataset to the parquet format.
bash
1cd data
2python prepare_musique.py
Training
Our training framework is based on verl, a powerful reinforcement learning framework for LLMs. We deeply customize the verl code to fit our needs, and the modified version of verl is under the src/verl directory. The example of training scripts are under scripts/train.
Single-node training
Here is an example of training Qwen2.5-7B-Instruct with 4 GPUs locally. Note that the training script below is just an example for single-node training, using small batch size for quick start, and do not assure the training performance.
For training base (pre-trained) models, please use --apply_chat False and --prompt_template_name re_search_template
For training instruction-tuned models, please use --apply_chat True and --prompt_template_name re_search_template_sys
Multi-node training
If you want to fully reproduce the results in our paper, please refer to the multi-node training script in scripts/train/train_multi_node.sh, as well as the implementation details in our paper.
Evaluation
We recommend using SGLang to serve the trained model. You can download our open-sourced models or trained your own models to conduct the evaluation. Here is an example of launching the model serving:
We use FlashRAG as the standard evaluation environment. Here is an example of evaluating the performance of ReSearch-Qwen-7B-Instruct on Bamboogle test set.
For base model, please use --apply_chat False and for instruction-tuned model, please use --apply_chat True, for loading correct prompt template when conducting evaluation for ReSearch model. For more details about the configuration, please refer to the scripts/evaluation/eval_config.yaml file.
🤝 Acknowledge
This training implementation is based on verl and the evaluation is based on FlashRAG. The serving of retriever is based on FastAPI. The model serving is based on SGLang. ReSearch models are trained based on Qwen2.5. We sincerely appreciate their contributions to the open-source community.
📚 Citation
If you find this work useful, please cite it as follows:
bibtex
1@misc{chen2025research
2 title={ReSearch: Learning to Reason with Search for LLMs via Reinforcement Learning},
3 author={Mingyang Chen and Tianpeng Li and Haoze Sun and Yijie Zhou and Chenzheng Zhu and Haofen Wang and Jeff Z. Pan and Wen Zhang and Huajun Chen and Fan Yang and Zenan Zhou and Weipeng Chen},
4 year={2025},
5 eprint={2503.19470},
6 archivePrefix={arXiv},
7 primaryClass={cs.AI},
8 url={https://arxiv.org/abs/2503.19470},
9}