YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Qwen2.5-Math-7B-RL2R
GitHub repository: https://github.com/mzhaoshuai/RL2R/tree/reasoning
Paper: Reinforcement Learning with Reference-Based Rewards for Language Model Reasoning and Alignment
This model is Qwen2.5-Math-7B fine-tuned with R1-Zero-style reinforcement learning using RL2R (Reinforcement Learning with Reference-Based Rewards). Instead of relying solely on binary answer verification, RL2R additionally rewards semantic similarity to reference solutions, providing dense feedback on problems where rule-based verification yields no learning signal.
Results
Accuracy (%) under greedy decoding (temperature 0, top-p 1), a maximum generation length of 3072 tokens, raw problem prompts without a chat template, and math-verify answer extraction. n denotes the number of test problems.
| Model | AIME 2024 (n=30) | AMC (n=83) | MATH500 (n=500) | Minerva (n=272) | OlympiadBench (n=675) | Avg. |
|---|---|---|---|---|---|---|
| Qwen2.5-Math-7B (base) | 16.7 | 38.6 | 50.6 | 9.9 | 16.6 | 26.5 |
| + RL2R (this model) | 43.3 | 60.2 | 80.6 | 30.5 | 44.4 | 51.8 |
Per-benchmark outputs are provided in eval_results/.
Training Details
- Base model: Qwen/Qwen2.5-Math-7B
- Training data: 8,523 math problems at MATH difficulty levels 3–5 (a subset of the
math_12ksplit of Understanding R1-Zero-Like Training); this split omits step-by-step solutions, so one reference solution per problem is synthesized withgpt-5.4and retained only when its final answer matches the ground-truth answer under the training-time equivalence grader - Policy optimization: Dr. GRPO, 1 inner epoch per rollout batch, dual clip 3.0, no KL penalty
- Reward:
R = 1.0 · R_rule + 0.3 · Sim_ans + 0.3 · Sim_stepR_rule: binary correctness verification withmath-verifySim_ans/Sim_step: answer-level and step-level IDF-weighted BERTScore (recall) against the reference solution, computed with facebook/bart-large-mnli; IDF statistics are estimated over the 8,523 training problems and their reference solutions- rewards normalized with
Z_norm = 1.6
- Hyperparameters: 12 prompt epochs, learning rate 1e-6 (constant), global prompt batch size 128, 8 rollouts per prompt, rollout temperature 1.0, prompt length 1024, maximum generation length 3072, context length 4096, bf16
- Checkpoint selection: best checkpoint (step 690) by average accuracy on the evaluation suite
- Framework: trained with the oat-based framework in our repository (transformers 4.57.3, vLLM rollouts)
Usage
The model is trained and evaluated with raw problem text as the prompt, without any chat template. Feed the problem directly and generate; the final answer appears in \boxed{}.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "mzhaoshuai/Qwen2.5-Math-7B-RL2R"
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_id)
problem = "Let $a$ and $b$ be positive real numbers such that $a + b = 1.$ Find the minimum value of $\\frac{1}{a} + \\frac{1}{b}.$"
inputs = tokenizer(problem, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=3072, do_sample=False)
response = tokenizer.decode(output[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
Citation
@article{zhao2025rl2r,
title = {Reinforcement Learning with Reference-Based Rewards for Language Model Reasoning and Alignment},
author = {Zhao, Shuai and Xu, Yunqiu and Zhu, Linchao and Chen, Ling and Yang, Yi},
journal = {arXiv preprint arXiv:2504.09895},
year = {2025}
}
- Downloads last month
- 23