This repository contains the
qwen2.5-math-rlep model, which is a key checkpoint from the RLEP training process based on Qwen2.5-Math-7B, as presented in the paper
RLEP: Reinforcement Learning with Experience Replay for LLM Reasoning.
Reinforcement learning (RL) for large language models is an energy-intensive endeavor: training can be unstable, and the policy may gradually drift away from its pretrained weights. RLEP -- Reinforcement Learning with Experience rePlay -- is a two-phase framework that first collects verified trajectories and then replays them during subsequent training. At every update step, the policy is optimized on mini-batches that blend newly generated rollouts with these replayed successes. By replaying high-quality examples, RLEP steers the model away from fruitless exploration, focuses learning on promising reasoning paths, and delivers both faster convergence and stronger final performance.
Here’s a simple example of running inference with vLLM.
First, install vLLM (version ≥ 0.7.3):
After installation, you can load and run the model in your Python code like this:
1import os
2
3from transformers import AutoModelForCausalLM, AutoTokenizer
4from vllm import LLM, SamplingParams
5
6model_path = 'Kwai-Klear/qwen2.5-math-rlep'
7sampling_params = SamplingParams(temperature=1.0, top_p=1.0, max_tokens=1024 * 3, n=1)
8llm = LLM(
9 model=model_path,
10 enforce_eager=False,
11 tensor_parallel_size=1,
12 seed=0,
13)
14
15tokenizer = AutoTokenizer.from_pretrained(model_path)
16question = '''Find the sum of all integer bases $b>9$ for which $17_b$ is a divisor of $97_b.$'''
17
18prefix="Solve the following math problem step by step. The last line of your response should be of the form Answer: $Answer (without quotes) where $Answer is the answer to the problem.\n\n"
19post_fix = '\n\nRemember to put your answer on its own line after "Answer:".'
20question_with_instruct = prefix + question + post_fix # the model is trained with this instruct.
21messages = [{'content': question_with_instruct, 'role':'user'}]
22text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
23
24output =llm.generate([text], sampling_params)[0]
25answer = output.outputs[0].text
26
27print(question)
28print(answer)
29
To evaluete the model on benchmarks like AIME-2024, AIME-2025 and AMC-2023 etc. please refer to
our repo.
We evaluated the converged RLEP model at 320 training steps and the DAPO-nodyn-bs64 baseline at 400 steps.
If you find our paper or code helpful, we would appreciate it if you could cite our work:
1@misc{zhang2025rlepreinforcementlearningexperience,
2 title={RLEP: Reinforcement Learning with Experience Replay for LLM Reasoning},
3 author={Hongzhi Zhang and Jia Fu and Jingyuan Zhang and Kai Fu and Qi Wang and Fuzheng Zhang and Guorui Zhou},
4 year={2025},
5 eprint={2507.07451},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2507.07451},
9}
We conducted our experiments with the
VERL framework and the
Qwen2.5-7B-Math model, using the dataset and training scripts provided by
DAPO.
Many thanks to the open-sourced works and the broader community for making these resources available!