🚀 OpenCodeReasoning-Nemotron-32B 概述
OpenCodeReasoning-Nemotron-32B 是一個大語言模型(LLM),它基於 Qwen2.5 - 32B - Instruct(即參考模型)衍生而來。這是一個經過推理後訓練的代碼生成推理模型,支持 32K 令牌的上下文長度。該模型可用於商業或非商業用途。

✨ 主要特性
- 基於 Qwen2.5 - 32B - Instruct 模型進行衍生和優化。
- 專為代碼生成推理進行後訓練。
- 支持 32K 令牌的上下文長度。
- 可用於商業和非商業用途。
📦 安裝指南
文檔未提供具體安裝步驟,故跳過此章節。
💻 使用示例
基礎用法
要對編碼問題進行推理,請使用以下代碼:
import transformers
import torch
model_id = "nvidia/OpenCodeReasoning-Nemotron-32B"
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'])
## 📚 詳細文檔
### 來自 [OpenCodeReasoning](https://arxiv.org/abs/2504.01943) 的結果
以下結果是每個基準測試進行 **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 - 32B - Instruct |
| 輸入類型 | 文本 |
| 輸入格式 | 字符串 |
| 輸入參數 | 一維(1D) |
| 輸入相關其他屬性 | 上下文長度可達 32,768 個令牌 |
| 輸出類型 | 文本 |
| 輸出格式 | 字符串 |
| 輸出參數 | 一維(1D) |
| 輸出相關其他屬性 | 上下文長度可達 32,768 個令牌 |
| 運行時引擎 | NeMo 2.3.0 |
| 推薦硬件微架構兼容性 | NVIDIA Ampere、NVIDIA Hopper |
| 首選/支持的操作系統 | Linux |
| 模型版本 | 1.0 (4/25/2025),包含 OpenCodeReasoning - Nemotron - 7B、OpenCodeReasoning - Nemotron - 14B、OpenCodeReasoning - Nemotron - 32B、OpenCodeReasoning - Nemotron - 32B - IOI |
| 推理引擎 | vLLM |
| 測試硬件 | NVIDIA H100 - 80GB |
### 訓練和評估數據集
#### 訓練數據集
OpenCodeReasoning - Nemotron - 32B 的訓練語料庫是 [OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning) 數據集,它由競賽編程問題和 DeepSeek - R1 生成的響應組成。
- 數據收集方法:混合方式(自動化、人工、合成)
- 標註方法:混合方式(自動化、人工、合成)
- 屬性:來自 OpenCodeReasoning 的 736k 個樣本(https://huggingface.co/datasets/nvidia/OpenCodeReasoning)
#### 評估數據集
使用下一節列出的數據集對 OpenCodeReasoning - Nemotron - 32B 進行評估。
- 數據收集方法:混合方式(自動化、人工、合成)
- 標註方法:混合方式(自動化、人工、合成)
### 許可證/使用條款
本模型的使用受 [Apache 2.0](https://huggingface.co/nvidia/OpenCode - Nemotron - 2 - 7B/blob/main/LICENSE) 條款約束。
### 部署地域
全球
### 使用場景
該模型適用於構建大語言模型的開發者和研究人員。
### 發佈日期
2025 年 4 月 25 日通過 Huggingface(https://huggingface.co/nvidia/OpenCodeReasoning - Nemotron - 32B/)發佈
### 參考資料
[2504.01943] OpenCodeReasoning: Advancing Data Distillation for Competitive Coding
### 倫理考量
NVIDIA 認為可信 AI 是一項共同責任,已制定相關政策和實踐,以支持廣泛的 AI 應用開發。開發者在按照服務條款下載或使用此模型時,應與內部模型團隊合作,確保該模型符合相關行業和使用場景的要求,並解決意外的產品濫用問題。請在此報告安全漏洞或 NVIDIA AI 相關問題。
### 引用
如果您覺得這些數據有用,請引用:
@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},
}