说明文档
AceReason-Nemotron:通过强化学习提升数学和代码推理能力
<p align="center">
<img src="fig/main_fig.png" alt="main_fig" style="width: 600px; max-width: 100%;" />
🔥新闻
- 2025年6月16日:我们很高兴发布结合SFT与RL的新版本:AceReason-Nemotron-1.1-7B
- 论文:https://arxiv.org/pdf/2506.13284
- 模型:https://huggingface.co/nvidia/AceReason-Nemotron-1.1-7B
- 400万条SFT数据:https://huggingface.co/datasets/nvidia/AceReason-1.1-SFT
- 2025年6月11日:我们在 AceReason评估 分享了我们的评估工具包,包括:
- 运行推理和评分的脚本
- LiveCodeBench (avg@8):每月的模型预测文件和分数(2023/5-2025/5)
- AIME24/25 (avg@64):模型预测文件和分数
- 2025年6月2日:我们很高兴在 AceReason-Math 分享我们的数学RL训练数据集
我们很高兴推出 AceReason-Nemotron-14B,这是一个完全通过强化学习(RL)训练的数学和代码推理模型,以 DeepSeek-R1-Distilled-Qwen-14B 为起点。它取得了令人印象深刻的成绩:AIME 2024 上达到 78.6%(+8.9%),AIME 2025 上达到 67.4%(+17.4%),LiveCodeBench v5 上达到 61.1%(+8%),LiveCodeBench v6 上达到 54.9%(+7%),以及 Codeforces 2024 评级(+543)。我们通过大量的消融实验系统性地研究了RL训练过程,并提出了一种简单而有效的方法:首先在纯数学提示上进行RL训练,然后在纯代码提示上进行RL训练。值得注意的是,我们发现纯数学RL不仅显著提升了强蒸馏模型在数学基准测试上的表现,还提升了代码推理任务的表现。此外,扩展的纯代码RL进一步提高了代码基准测试的性能,同时对数学结果造成的退化极小。我们发现RL不仅激发了在预训练和监督微调(如蒸馏)期间获得的基础推理能力,还推动了模型推理能力的极限,使其能够解决以前无法解决的问题。
我们在技术报告中分享了我们的训练配方和训练日志。
结果
我们将模型与 Qwen2.5 和 Llama3.1 模型家族中具有竞争力的同等规模推理模型在 AIME 2024、AIME 2025、LiveCodeBench v5(2024/08/01 - 2025/02/01)和 LiveCodeBench v6(2025/02/01-2025/05/01)上进行了评估。更多评估结果可以在我们的技术报告中找到。
| 模型 | AIME 2024<br>(avg@64) | AIME 2025<br>(avg@64) | LCB v5<br>(avg@8) | LCB v6<br>(avg@8) |
|---|---|---|---|---|
| <small>QwQ-32B</small> | 79.5 | 65.8 | 63.4 | - |
| <small>DeepSeek-R1-671B</small> | 79.8 | 70.0 | 65.9 | - |
| <small>Llama-Nemotron-Ultra-253B</small> | 80.8 | 72.5 | 66.3 | - |
| <small>o3-mini (medium)</small> | 79.6 | 76.7 | 67.4 | - |
| <small>Light-R1-14B</small> | 74 | 60.2 | 57.9 | 51.5 |
| <small>DeepCoder-14B (32K推理)</small> | 71 | 56.1 | 57.9 | 50.4 |
| <small>OpenMath-Nemotron-14B</small> | 76.3 | 63.0 | - | - |
| <small>OpenCodeReasoning-Nemotron-14B</small> | - | - | 59.4 | 54.1 |
| <small>Llama-Nemotron-Super-49B-v1</small> | 67.5 | 60.0 | 45.5 | - |
| <small>DeepSeek-R1-Distilled-Qwen-14B</small> | 69.7 | 50.2 | 53.1 | 47.9 |
| <small>DeepSeek-R1-Distilled-Qwen-32B</small> | 72.6 | 54.9 | 57.2 | - |
| AceReason-Nemotron-7B 🤗 | 69.0 | 53.6 | 51.8 | 44.1 |
| AceReason-Nemotron-14B 🤗 | 78.6 | 67.4 | 61.1 | 54.9 |
如何使用
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = 'nvidia/AceReason-Nemotron-14B'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
prompt = "Jen enters a lottery by picking $4$ distinct numbers from $S=\{1,2,3,\cdots,9,10\}.$ $4$ numbers are randomly chosen from $S.$ She wins a prize if at least two of her numbers were $2$ of the randomly chosen numbers, and wins the grand prize if all four of her numbers were the randomly chosen numbers. The probability of her winning the grand prize given that she won a prize is $\tfrac{m}{n}$ where $m$ and $n$ are relatively prime positive integers. Find $m+n$."
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to("cuda")
generated_ids = model.generate(
**model_inputs,
max_new_tokens=32768,
temperature=0.6,
top_p=0.95
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
使用建议
- 不要包含系统提示;相反,将所有指令直接放在用户提示中。
- 我们建议对数学问题使用以下指令:请一步步推理,并将最终答案放在 \boxed{} 中。
- 我们建议对代码问题使用以下指令:
question = "" # 代码问题
starter_code = "" # 起始代码函数头
code_instruction_nostartercode = """编写Python代码来解决问题。请将解决方案代码按以下格式放置:
```python
# 你的解决方案代码
```"""
code_instruction_hasstartercode = """请将解决方案代码按以下格式放置:
```python
# 你的解决方案代码
```"""
if starter_code != "":
question += "\n\n" + "从提供的函数头开始解决问题。\n\n函数头:\n" + "```\n" + starter_code + "\n```"
question += "\n\n" + code_instruction_hasstartercode
else:
question += "\n\n" + code_instruction_nostartercode
final_prompt = "<|User|>" + question + "<|Assistant|>Hmm
"
- 我们用于评估的推理引擎是 vLLM==0.7.3,使用 top-p=0.95, temperature=0.6, max_tokens=32768。
评估工具包
请查看 https://huggingface.co/nvidia/AceReason-Nemotron-14B/blob/main/README_EVALUATION.md 中的评估代码、脚本和缓存的预测文件
联系方式
Yang Chen (yachen@nvidia.com), Zhuolin Yang (zhuoliny@nvidia.com), Zihan Liu (zihanl@nvidia.com), Chankyu Lee (chankyul@nvidia.com), Wei Ping (wping@nvidia.com)
许可证
您对本模型的使用受 NVIDIA开放模型许可证 管辖。
引用
@article{chen2025acereason,
title={AceReason-Nemotron: Advancing Math and Code Reasoning through Reinforcement Learning},
author={Chen, Yang and Yang, Zhuolin and Liu, Zihan and Lee, Chankyu and Xu, Peng and Shoeybi, Mohammad and Catanzaro, Bryan and Ping, Wei},
journal={arXiv preprint arXiv:2505.16400},
year={2025}
}
Prince-1/AceReason-Nemotron-14B-Onnx
作者 Prince-1
创建时间: 2025-06-22 18:12:54+00:00
更新时间: 2025-06-23 08:41:55+00:00
在 Hugging Face 上查看