Instructions to use Kwai-Klear/qwen2.5-math-rlep with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kwai-Klear/qwen2.5-math-rlep with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kwai-Klear/qwen2.5-math-rlep") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Kwai-Klear/qwen2.5-math-rlep") model = AutoModelForCausalLM.from_pretrained("Kwai-Klear/qwen2.5-math-rlep") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Kwai-Klear/qwen2.5-math-rlep with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kwai-Klear/qwen2.5-math-rlep" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kwai-Klear/qwen2.5-math-rlep", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Kwai-Klear/qwen2.5-math-rlep
- SGLang
How to use Kwai-Klear/qwen2.5-math-rlep with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Kwai-Klear/qwen2.5-math-rlep" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kwai-Klear/qwen2.5-math-rlep", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Kwai-Klear/qwen2.5-math-rlep" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kwai-Klear/qwen2.5-math-rlep", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Kwai-Klear/qwen2.5-math-rlep with Docker Model Runner:
docker model run hf.co/Kwai-Klear/qwen2.5-math-rlep
RLEP: Reinforcement Learning with Experience Replay for LLM Reasoning
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.
[Paper] [Code] [Checkpoints] [Dataset]
✨ Key Highlights
- Rapid early gains: On AIME-2024 RLEP hits the baseline’s peak accuracy by step 135 (the baseline needs 380). On AIME-2025 it surpasses the baseline’s best score after only 50 steps.
- Higher final performance: RLEP ultimately lifts the peak accuracy from 38.2% → 39.9% (AIME-2024), 19.8% → 22.3% (AIME-2025), and 77.0% → 82.2% on AMC-2023 benchmark.
🚀 Quick Start (Inference)
Here’s a simple example of running inference with vLLM. First, install vLLM (version ≥ 0.7.3):
pip3 install vllm
After installation, you can load and run the model in your Python code like this:
import os
from transformers import AutoModelForCausalLM, AutoTokenizer
from vllm import LLM, SamplingParams
model_path = 'Kwai-Klear/qwen2.5-math-rlep'
sampling_params = SamplingParams(temperature=1.0, top_p=1.0, max_tokens=1024 * 3, n=1)
llm = LLM(
model=model_path,
enforce_eager=False,
tensor_parallel_size=1,
seed=0,
)
tokenizer = AutoTokenizer.from_pretrained(model_path)
question = '''Find the sum of all integer bases $b>9$ for which $17_b$ is a divisor of $97_b.$'''
prefix="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"
post_fix = '\n\nRemember to put your answer on its own line after "Answer:".'
question_with_instruct = prefix + question + post_fix # the model is trained with this instruct.
messages = [{'content': question_with_instruct, 'role':'user'}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
output =llm.generate([text], sampling_params)[0]
answer = output.outputs[0].text
print(question)
print(answer)
To evaluete the model on benchmarks like AIME-2024, AIME-2025 and AMC-2023 etc. please refer to our repo.
Evaluation Results
We evaluated the converged RLEP model at 320 training steps and the DAPO-nodyn-bs64 baseline at 400 steps.
| AIME-2024 | AIME-2025 | AMC-2023 | |
|---|---|---|---|
| DAPO | 32.6 | 18.9 | 77.5 |
| DAPO-nodyn-bs64 | 37.4 | 19.4 | 77.3 |
| RLEP | 38.5 | 21.3 | 83.0 |
Citation
If you find our paper or code helpful, we would appreciate it if you could cite our work:
@misc{zhang2025rlepreinforcementlearningexperience,
title={RLEP: Reinforcement Learning with Experience Replay for LLM Reasoning},
author={Hongzhi Zhang and Jia Fu and Jingyuan Zhang and Kai Fu and Qi Wang and Fuzheng Zhang and Guorui Zhou},
year={2025},
eprint={2507.07451},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2507.07451},
}
Acknowledgement
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!
- Downloads last month
- 22