基础模型:
- Qwen/Qwen2.5-7B-Instruct
数据集:
- nvidia/OpenCodeReasoning
语言:
- 英文
库名称: transformers
许可证: apache-2.0
标签:
- nvidia
- 代码
管道标签: 文本生成
OpenCodeReasoning-Nemotron-7B 概述
描述:
OpenCodeReasoning-Nemotron-7B 是一个大型语言模型 (LLM),是 Qwen2.5-7B-Instruct(又称参考模型)的衍生版本。它是一个针对代码生成进行推理训练后的推理模型,支持 32K 个 tokens 的上下文长度。
该模型可用于商业/非商业用途。

以下结果是每个基准测试 64 次评估 的平均值。
模型 |
LiveCodeBench 平均分 |
CodeContest 全部 |
DeepSeek-R1 |
65.6 |
26.2 |
QwQ-32B |
61.3 |
20.2 |
|
|
|
蒸馏 7B+ 模型 |
|
|
|
|
|
Bespoke-Stratos-7B |
14.7 |
2.0 |
OpenThinker-7B |
25.5 |
5.0 |
R1-Distill-Qwen-7B |
38.0 |
11.1 |
OlympicCoder-7B |
40.9 |
10.6 |
OCR-Qwen-7B |
48.5 |
16.3 |
OCR-Qwen-7B-Instruct |
51.3 |
18.1 |
|
|
|
蒸馏 14B+ 模型 |
|
|
|
|
|
R1-Distill-Qwen-14B |
51.3 |
17.6 |
OCR-Qwen-14B |
57.7 |
22.6 |
OCR-Qwen-14B-Instruct |
59.4 |
23.6 |
|
|
|
蒸馏 32B+ 模型 |
|
|
|
|
|
Bespoke-Stratos-32B |
30.1 |
6.3 |
OpenThinker-32B |
54.1 |
16.4 |
R1-Distill-Qwen-32B |
58.1 |
18.3 |
OlympicCoder-32B |
57.4 |
18.0 |
OCR-Qwen-32B |
61.8 |
24.6 |
OCR-Qwen-32B-Instruct |
61.7 |
24.4 |
复现我们的结果
如何使用这些模型?
运行代码问题的推理:
import transformers
import torch
model_id = "nvidia/OpenCodeReasoning-Nemotron-7B"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
prompt = """你是一个乐于助人且无害的助手。在回答以下指令之前,你应该逐步思考。
请仅使用 Python 编程语言。
你必须使用 ```python 格式仅包含最终的解决方案代码块,格式如下:
```python
# 你的代码在这里
```
{用户输入}
"""
messages = [
{
"role": "user",
"content": prompt.format(user="编写一个程序计算前 $N$ 个斐波那契数的和")},
]
outputs = pipeline(
messages,
max_new_tokens=32768,
)
print(outputs[0]["generated_text"][-1]['content'])
引用
如果你发现这些数据有用,请引用:
@article{ahmad2025opencodereasoning,
title={OpenCodeReasoning: Advancing Data Distillation for Competitive Coding},
author={Wasi Uddin Ahmad, Sean Narenthiran, Somshubra Majumdar, Aleksander Ficek, Siddhartha Jain, Jocelyn Huang, Vahid Noroozi, Boris Ginsburg},
year={2025},
eprint={2504.01943},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2504.01943},
}
附加信息
模型架构:
架构类型: 密集仅解码器 Transformer 模型
网络架构: Qwen-7B-Instruct
该模型基于 Qwen2.5-7B-Instruct 开发,拥有 7B 模型参数。
OpenCodeReasoning-Nemotron-7B 基于 Qwen2.5-7B-Instruct 开发,拥有 7B 模型参数。
输入:
输入类型: 文本
输入格式: 字符串
输入参数: 一维 (1D)
其他输入相关属性: 上下文长度可达 32,768 tokens
输出:
输出类型: 文本
输出格式: 字符串
输出参数: 一维 (1D)
其他输出相关属性: 上下文长度可达 32,768 tokens
我们的 AI 模型设计并/或优化为在 NVIDIA GPU 加速系统上运行。通过利用 NVIDIA 的硬件(如 GPU 核心)和软件框架(如 CUDA 库),该模型相比仅使用 CPU 的解决方案实现了更快的训练和推理时间。
软件集成:
- 运行时引擎: NeMo 2.3.0
- 推荐的硬件微架构兼容性:
NVIDIA Ampere
NVIDIA Hopper
- 首选/支持的操作系统: Linux
模型版本:
1.0 (2025/4/25)
OpenCodeReasoning-Nemotron-7B
OpenCodeReasoning-Nemotron-14B
OpenCodeReasoning-Nemotron-32B
OpenCodeReasoning-Nemotron-32B-IOI
训练和评估数据集:
训练数据集:
OpenCodeReasoning-Nemotron-7B 的训练语料库是 OpenCodeReasoning 数据集,该数据集由竞赛编程问题和 DeepSeek-R1 生成的回答组成。
数据收集方法: 混合:自动化、人工、合成
标注方法: 混合:自动化、人工、合成
属性: 来自 OpenCodeReasoning 的 736k 样本 (https://huggingface.co/datasets/nvidia/OpenCodeReasoning)
评估数据集:
我们使用下一节列出的数据集来评估 OpenCodeReasoning-Nemotron-7B。
数据收集方法: 混合:自动化、人工、合成
标注方法: 混合:自动化、人工、合成