--- base_model: - meta-llama/Llama-3.2-3B-Instruct language: - en metrics: - accuracy pipeline_tag: text-generation library_name: transformers license: llama3.2 ---
# ReZero: Enhancing LLM search ability by trying one-more-time ![rezero.png](https://cdn-uploads.huggingface.co/production/uploads/640ea534474aa6f89559ad5e/Sk0tHRmR9K2C30zcz-Z64.png) ReZero trains a small language model to develop effective search behaviors instead of memorizing static data. It interacts with multiple synthetic search engines, each with unique retrieval mechanisms, to refine queries and persist in searching until it finds exact answers. The project focuses on reinforcement learning, preventing overfitting, and optimizing for efficiency in real-world search applications.
## Quick Demo ๐Ÿš€ ![demo.gif](https://cdn-uploads.huggingface.co/production/uploads/640ea534474aa6f89559ad5e/2Ts24TjH_u_AQ-W8jlJDd.gif) Run the interactive web interface to see ReZero in action: ```bash python app.py ``` This will launch a Gradio interface where you can interact with the model and test different search behaviors. ## Setup ๐Ÿ› ๏ธ ```bash # Clone the repository git clone https://github.com/menloresearch/ReZero cd ReZero # Create virtual environment python -m venv .venv # Activate the environment source .venv/bin/activate # Install dependencies pip install --upgrade pip pip install -e . # Set up environment variables (required for websearch demo) cp .env.example .env # Edit .env and add your Tavily API key if you want to use the websearch demo ``` ## Data and Training ๐Ÿง  All necessary training data is included in the `data/` folder. To train: ```bash python train_grpo.py ``` If you want to regenerate the data, please run: ```bash python scripts/generate_data.py ``` ## Models ๐Ÿค– You can find our models on Hugging Face ๐Ÿค—! We're committed to open-source and easy access for the research community. | Model | Backbone | Size | Link | GGUF | |-------|----------|------|------|------| | ReZero-v0.1 | Llama-3.2-3B | 3B | [๐Ÿค— Menlo/ReZero-v0.1-llama-3.2-3b-it-grpo-250404](https://huggingface.co/Menlo/ReZero-v0.1-llama-3.2-3b-it-grpo-250404) | [๐Ÿค— GGUF](https://huggingface.co/Menlo/ReZero-v0.1-llama-3.2-3b-it-grpo-250404-gguf) | ## Experiments ๐Ÿงช | Run ID | Model Config | Dataset | Steps | Hardware | TensorBoard | Description | |--------|--------------|---------|-------|----------|-------------|-------------| | exp-01 | [Llama-3.2-3b-instruct](https://huggingface.co/janhq/250404-llama-3.2-3b-instruct-grpo-01) | Apollo Mission Report | 300 | ~2 hours on 1xH200 | [๐Ÿ“Š](https://huggingface.co/janhq/250404-llama-3.2-3b-instruct-grpo-01/tensorboard) | Added reward_search_strategy and reward_search_quality. Reward weights: [4.0, 2.0, 1.0, 1.0, 1.0, 1.0]. Loss crashed after step 400. Best accuracy: 31.25% at step 400. Max agent turns: 10. | | exp-02 | [Llama-3.2-3b-instruct](https://huggingface.co/janhq/250404-llama-3.2-3b-instruct-grpo-02) | Apollo Mission Report | 1000 | ~7 hours on 1xH200 | [๐Ÿ“Š](https://huggingface.co/janhq/250404-llama-3.2-3b-instruct-grpo-02/tensorboard) | Improved reward_retry logic to only reward search when answers found. Increased max agent turns to 20. Reward weights: [4.0, 2.0, 1.0, 1.0, 1.0, 1.0]. Best accuracy: 46.88% at step 250. Higher early reward_correctness (~0.6 vs 0.4-0.5). Loss stable but reward crashed after step 350. | | exp-03 | [Llama-3.2-3b-instruct](https://huggingface.co/janhq/250409-llama-3.2-3b-instruct-grpo-01-no-retry) | Apollo Mission Report | 1000 | ~7 hours on 1xH200 | [๐Ÿ“Š](https://huggingface.co/janhq/250409-llama-3.2-3b-instruct-grpo-01-no-retry/tensorboard) | Same as exp-02 but without the retry reward function. | ## References ๐Ÿ“– arxiv.org/abs/2504.11001 ## Acknowledgements ๐Ÿค - This project is kickstarted from the source code of [AutoDidact](https://github.com/dCaples/AutoDidact)