Views
No views yet



{question} + "\n\nWrite Python code to solve the problem. Present the code in \n```python\nYour code\n```\nat the end."{question} + "\n\nPresent the answer in LaTex format: \\boxed{Your answer}"1import os
2from tqdm import tqdm
3import torch
4from transformers import AutoTokenizer
5from vllm import LLM, SamplingParams
6os.environ["NCCL_IGNORE_DISABLED_P2P"] = "1"
7os.environ["TOKENIZERS_PARALLELISM"] = "true"
8
9def generate(question_list,model_path):
10 llm = LLM(
11 model=model_path,
12 trust_remote_code=True,
13 tensor_parallel_size=torch.cuda.device_count(),
14 gpu_memory_utilization=0.90,
15 )
16 sampling_params = SamplingParams(max_tokens=8192,
17 temperature=0.0,
18 n=1)
19 outputs = llm.generate(question_list, sampling_params, use_tqdm=True)
20 completions = [[output.text for output in output_item.outputs] for output_item in outputs]
21 return completions
22
23def make_conv_hf(question, tokenizer):
24 # for math problem
25 content = question + "\n\nPresent the answer in LaTex format: \\boxed{Your answer}"
26 # for code problem
27 # content = question + "\n\nWrite Python code to solve the problem. Present the code in \n```python\nYour code\n```\nat the end."
28 msg = [
29 {"role": "user", "content": content}
30 ]
31 chat = tokenizer.apply_chat_template(msg, tokenize=False, add_generation_prompt=True)
32 return chat
33
34def run():
35 model_path = "PRIME-RL/Eurus-2-7B-PRIME"
36 all_problems = [
37 "which number is larger? 9.11 or 9.9?"
38 ]
39 tokenizer = AutoTokenizer.from_pretrained(model_path)
40 completions = generate([make_conv_hf(problem_data, tokenizer) for problem_data in all_problems],model_path)
41 print(completions)
42 # [['[ASSESS]\n\n# The problem asks us to compare two decimal numbers, 9.11 and 9.9, to determine which one is larger.\n# We need to compare the whole parts and the decimal parts of the numbers.\n\nNext action: [ADVANCE]\n\n# Compare the whole parts of the numbers: both 9.11 and 9.9 have the same whole part, which is 9.\n# Compare the decimal parts of the numbers: 0.11 (from 9.11) is less than 0.9 (from 9.9).\n\nNext action: [ADVANCE]\n\n# Since the whole parts are the same and the decimal part of 9.9 is greater than the decimal part of 9.11, we can conclude that 9.9 is larger than 9.11.\n\nNext action: [OUTPUT]\n\nThe final answer is $\\boxed{9.9}$.\n\n']]
43if __name__ == "__main__":
44 run()| Eurus-2-7B-PRIME | Eurus-2-7B-SFT | Qwen-2.5-Math-7B-Instruct | Llama-3.1-70B-Instruct | GPT-4o | |
|---|---|---|---|---|---|
| AIME 2024 | 26.7 (+23.3) | 3.3 | 13.3 | 16.7 | 9.3 |
| MATH-500 | 79.2 (+14.1) | 65.1 | 79.8 | 64.6 | 76.4 |
| AMC | 57.8 (+27.7) | 30.1 | 50.6 | 30.1 | 45.8 |
| Minerva Math | 38.6 (+5.9) | 32.7 | 34.6 | 35.3 | 36.8 |
| OlympiadBench | 42.1 (+12.3) | 29.8 | 40.7 | 31.9 | 43.3 |
| Avg. | 48.9 (+ 16.7) | 32.2 | 43.8 | 36.4 | 43.3 |
| Eurus-2-7B-PRIME | Qwen2.5-Math-7B-Instruct | |
|---|---|---|
| Base Model | Qwen2.5-Math-7B | Qwen2.5-Math-7B |
| SFT Data | 230K (open-source) | 2.5M (open-source and in-house) |
| RM Data | 0 | 618K (in-house) |
| RM | Eurus-2-7B-SFT | Qwen2.5-Math-RM (72B) |
| RL Data | 150K queries \(\times\)4 samples | 66K queries \(\times\) 32 samples |
1@article{cui2025process,
2 title={Process reinforcement through implicit rewards},
3 author={Cui, Ganqu and Yuan, Lifan and Wang, Zefan and Wang, Hanbin and Li, Wendi and He, Bingxiang and Fan, Yuchen and Yu, Tianyu and Xu, Qixin and Chen, Weize and others},
4 journal={arXiv preprint arXiv:2502.01456},
5 year={2025}
6}1@article{yuan2024implicitprm,
2 title={Free Process Rewards without Process Labels},
3 author={Lifan Yuan and Wendi Li and Huayu Chen and Ganqu Cui and Ning Ding and Kaiyan Zhang and Bowen Zhou and Zhiyuan Liu and Hao Peng},
4 journal={arXiv preprint arXiv:2412.01981},
5 year={2024}
6}