🚀 OpenCodeReasoning-Nemotron-14B 概述
OpenCodeReasoning-Nemotron-14B 是一款大型语言模型(LLM),它基于 Qwen2.5-14B-Instruct(即参考模型)衍生而来。这是一个经过推理后训练的代码生成推理模型,支持 32K 令牌的上下文长度。该模型可用于商业或非商业用途。

模型信息
属性 |
详情 |
基础模型 |
Qwen/Qwen2.5-14B-Instruct |
训练数据 |
nvidia/OpenCodeReasoning |
模型类型 |
文本生成 |
库名称 |
transformers |
许可证 |
apache-2.0 |
标签 |
nvidia、code |
🚀 快速开始
模型使用
要对编码问题进行推理,请使用以下代码:
import transformers
import torch
model_id = "nvidia/OpenCodeReasoning-Nemotron-14B"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
prompt = """You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
{user}
"""
messages = [
{
"role": "user",
"content": prompt.format(user="Write a program to calculate the sum of the first $N$ fibonacci numbers")},
]
outputs = pipeline(
messages,
max_new_tokens=32768,
)
print(outputs[0]["generated_text"][-1]['content'])
## ✨ 主要特性
- **推理能力**:专为代码生成推理进行后训练。
- **长上下文支持**:支持 32K 令牌的上下文长度。
- **广泛用途**:可用于商业和非商业用途。
## 📚 详细文档
### 评估结果
以下是在每个基准测试上进行 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** |
### 复现结果
- [模型](https://huggingface.co/collections/nvidia/opencodereasoning-2-68168f37cd7c6beb1e3f92e7)
- [数据集](https://huggingface.co/datasets/nvidia/OpenCodeReasoning)
- [论文](https://arxiv.org/abs/2504.01943)
### 模型架构
- **架构类型**:密集解码器仅 Transformer 模型
- **网络架构**:Qwen-14B-Instruct
该模型基于 Qwen2.5-14B-Instruct 开发,拥有 140 亿个模型参数。
### 输入信息
- **输入类型**:文本
- **输入格式**:字符串
- **输入参数**:一维(1D)
- **其他输入属性**:上下文长度最长可达 32,768 令牌
### 输出信息
- **输出类型**:文本
- **输出格式**:字符串
- **输出参数**:一维(1D)
- **其他输出属性**:上下文长度最长可达 32,768 令牌
### 软件集成
- **运行时引擎**: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-14B 的训练语料库是 [OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning) 数据集,由竞争性编程问题和 DeepSeek-R1 生成的响应组成。
- **数据收集方法**:混合(自动、人工、合成)
- **标注方法**:混合(自动、人工、合成)
- **属性**:来自 OpenCodeReasoning 的 736k 个样本
#### 评估数据集
使用下一节列出的数据集对 OpenCodeReasoning-Nemotron-14B 进行评估。
- **数据收集方法**:混合(自动、人工、合成)
- **标注方法**:混合(自动、人工、合成)
### 许可证/使用条款
本模型的使用受 [Apache 2.0](https://huggingface.co/nvidia/OpenCode-Nemotron-2-14B/blob/main/LICENSE) 许可协议的约束。
### 部署范围
全球
### 使用场景
该模型适用于构建大语言模型的开发者和研究人员。
### 发布日期
2025 年 4 月 25 日通过 [Huggingface](https://huggingface.co/nvidia/OpenCodeReasoning-Nemotron-7B/) 发布。
### 参考资料
[2504.01943] OpenCodeReasoning: Advancing Data Distillation for Competitive Coding
### 推理信息
- **引擎**:vLLM
- **测试硬件**:NVIDIA H100-80GB
### 伦理考量
NVIDIA 认为可信 AI 是一项共同责任,并已制定政策和实践,以支持广泛的 AI 应用开发。开发者在按照服务条款下载或使用该模型时,应与内部模型团队合作,确保该模型符合相关行业和用例的要求,并解决产品意外滥用的问题。请在此报告安全漏洞或 NVIDIA AI 相关问题。
## 📄 许可证
本项目采用 [Apache 2.0](https://huggingface.co/nvidia/OpenCode-Nemotron-2-14B/blob/main/LICENSE) 许可证。
## 📖 引用
如果您发现这些数据有用,请引用:
@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},
}