đ OpenCodeReasoning-Nemotron-32B
OpenCodeReasoning-Nemotron-32B is a large language model derived from Qwen2.5-32B-Instruct, post - trained for code generation reasoning with a 32K token context length, suitable for commercial and non - commercial use.
đ Quick Start
To run inference on coding problems, you can use the following code:
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'])
## ⨠Features
- **Derivative Model**: OpenCodeReasoning-Nemotron-32B is a derivative of Qwen2.5-32B-Instruct, designed for code generation reasoning.
- **Long Context Support**: It supports a context length of 32K tokens.
- **Commercial Use**: The model is ready for both commercial and non - commercial use.
## đĻ Installation
The document doesn't provide specific installation steps, so this section is skipped.
## đģ Usage Examples
### Basic Usage
```python
# The code for basic inference on coding problems
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'])
## đ Documentation
### Model Overview
OpenCodeReasoning-Nemotron-32B is a large language model (LLM) that is a derivative of Qwen2.5-32B-Instruct. It is a reasoning model post - trained for code generation. The model supports a context length of 32K tokens and is available for commercial and non - commercial use.
### Evaluation Results
The following table shows the average of **64 evaluations** on each benchmark from [OpenCodeReasoning](https://arxiv.org/abs/2504.01943):
| Model | LiveCodeBench Avg. | CodeContest All |
|------------------------|--------------------|-----------------|
| DeepSeek-R1 | 65.6 | 26.2 |
| QwQ-32B | 61.3 | 20.2 |
| **Distilled 7B+ Models** | | |
| 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** |
| **Distilled 14B+ Models**| | |
| R1-Distill-Qwen-14B | 51.3 | 17.6 |
| **OCR-Qwen-14B** | **57.7** | **22.6** |
| **OCR-Qwen-14B-Instruct**| **59.4** | **23.6** |
| **Distilled 32B+ Models**| | |
| 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** |
### Reproducing Results
- **Models**: [https://huggingface.co/collections/nvidia/opencodereasoning-2-68168f37cd7c6beb1e3f92e7](https://huggingface.co/collections/nvidia/opencodereasoning-2-68168f37cd7c6beb1e3f92e7)
- **Dataset**: [https://huggingface.co/datasets/nvidia/OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning)
- **Paper**: [https://arxiv.org/abs/2504.01943](https://arxiv.org/abs/2504.01943)
### Additional Information
#### Model Architecture
| Property | Details |
|----------|---------|
| Architecture Type | Dense decoder - only Transformer model |
| Network Architecture | Qwen-32B-Instruct |
| Model Parameters | 32B |
#### Input
| Property | Details |
|----------|---------|
| Input Type(s) | Text |
| Input Format(s) | String |
| Input Parameters | One - Dimensional (1D) |
| Other Properties Related to Input | Context length up to 32,768 tokens |
#### Output
| Property | Details |
|----------|---------|
| Output Type(s) | Text |
| Output Format | String |
| Output Parameters | One - Dimensional (1D) |
| Other Properties Related to Output | Context length up to 32,768 tokens |
#### Software Integration
- **Runtime Engine**: NeMo 2.3.0
- **Recommended Hardware Microarchitecture Compatibility**: NVIDIA Ampere, NVIDIA Hopper
- **Preferred/Supported Operating System(s)**: Linux
#### Model Version(s)
- 1.0 (4/25/2025)
- OpenCodeReasoning-Nemotron-7B
- OpenCodeReasoning-Nemotron-14B
- OpenCodeReasoning-Nemotron-32B
- OpenCodeReasoning-Nemotron-32B-IOI
### Training and Evaluation Datasets
#### Training Dataset
The training corpus for OpenCodeReasoning-Nemotron-32B is the [OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning) dataset, which consists of competitive programming questions and DeepSeek-R1 generated responses.
- **Data Collection Method**: Hybrid: Automated, Human, Synthetic
- **Labeling Method**: Hybrid: Automated, Human, Synthetic
- **Properties**: 736k samples from OpenCodeReasoning (https://huggingface.co/datasets/nvidia/OpenCodeReasoning)
#### Evaluation Dataset
The datasets listed in the relevant section are used to evaluate OpenCodeReasoning-Nemotron-32B.
- **Data Collection Method**: Hybrid: Automated, Human, Synthetic
- **Labeling Method**: Hybrid: Automated, Human, Synthetic
### License/Terms of Use
Use of this model is governed by [Apache 2.0](https://huggingface.co/nvidia/OpenCode-Nemotron-2-7B/blob/main/LICENSE).
### Deployment Geography
Global
### Use Case
This model is intended for developers and researchers building LLMs.
### Release Date
Huggingface [04/25/2025] via [https://huggingface.co/nvidia/OpenCodeReasoning-Nemotron-32B/](https://huggingface.co/nvidia/OpenCodeReasoning-Nemotron-32B/)
### Reference(s)
[2504.01943] OpenCodeReasoning: Advancing Data Distillation for Competitive Coding
### Inference
| Property | Details |
|----------|---------|
| Engine | vLLM |
| Test Hardware | NVIDIA H100 - 80GB |
### Ethical Considerations
NVIDIA believes Trustworthy AI is a shared responsibility and has established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with the terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse. Please report security vulnerabilities or NVIDIA AI Concerns as appropriate.
## đ§ Technical Details
The model is developed based on Qwen2.5-32B-Instruct and is post - trained for code generation reasoning. It leverages NVIDIA's hardware (e.g., GPU cores) and software frameworks (e.g., CUDA libraries) to achieve faster training and inference times compared to CPU - only solutions.
## đ License
This model is licensed under [Apache 2.0](https://huggingface.co/nvidia/OpenCode-Nemotron-2-7B/blob/main/LICENSE).
## Citation
If you find the data useful, please cite:
@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},
}