说明文档
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不仅能够激发在预训练和监督微调(如蒸馏)期间获得的基础推理能力,还能突破模型推理能力的极限,使其能够解决以前无法解决的问题。
我们在技术报告中分享了我们的训练配方和训练日志。
结果
我们在 AIME 2024、AIME 2025、LiveCodeBench v5(2024/08/01 - 2025/02/01)和 LiveCodeBench v6(2025/02/01-2025/05/01)上将我们的模型与 Qwen2.5 和 Llama3.1 模型家族中相当规模的竞争性推理模型进行了评估。更多评估结果可以在我们的技术报告中找到。
| 模型 | 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 = """Write Python code to solve the problem. Please place the solution code in the following format:\n```python\n# Your solution code here\n```"""
code_instruction_hasstartercode = """Please place the solution code in the following format:\n```python\n# Your solution code here\n```"""
if starter_code != "":
question += "\n\n" + "Solve the problem starting with the provided function header.\n\nFunction header:\n" + "```\n" + starter_code + "\n```"
question += "\n\n" + code_instruction_hasstartercode
else:
question += "\n\n" + code_instruction_nostartercode
final_prompt = "<|User|>" + question + "<|Assistant|><think\n"
- 我们用于评估的推理引擎是 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}
}
onnx-community/AceReason-Nemotron-14B-Onnx
作者 onnx-community
创建时间: 2025-06-30 07:57:47+00:00
更新时间: 2025-06-30 08:03:26+00:00
在 Hugging Face 上查看