library_name: transformers
license: other
license_name: nvidia-internal-scientific-research-and-development-model-license
license_link: >-
https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-internal-scientific-research-and-development-model-license/
pipeline_tag: text-generation
tags:
- nvidia
- pytorch
OpenCodeReasoning-7B
Model Overview
OpenCodeReasoning-7B is a large language model (LLM) which is a derivative of Qwen2.5-7B-Instruct (AKA the reference model). It is a reasoning model that is post trained for reasoning while code generation. The model supports a context length of 32K tokens.
This model is ready for commercial use.
License/Terms of Use
GOVERNING TERMS: Your use of this model is governed by the NVIDIA Internal Scientific Research and Development Model License.
Model Developer: NVIDIA
Model Dates: Trained between February 2025 and March 2025
Use Case:
This model is intended for developers and researchers building LLMs.
Release Date:
2025-04-21
References
Model Architecture
- Architecture Type: Dense decoder-only Transformer model
- Network Architecture: Qwen
**This model was developed based on Qwen2.5-7B-Instruct.
** This model has 7B of model parameters.
Intended use
OpenCodeReasoning-7B is a competitive code generation focused reasoning and chat model intended to be used in English.
Input
- Input Type: Text
- Input Format: String
- Input Parameters: One-Dimensional (1D)
- Other Properties Related to Input: Context length up to 32,768 tokens
Output
- Output Type: 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: Transformers
- Recommended Hardware Microarchitecture Compatibility:
- NVIDIA Hopper
- NVIDIA Ampere
- Preferred Operating System(s): Linux
Model Version
1.0 (4/21/2025)
Quick Start and Usage Recommendations:
We recommend setting temperature to 0.6
, and Top P to 0.95
for inference on LiveCodeBench.
Use It with Transformers
See the snippet below for usage with Hugging Face Transformers library. Please see the example below.
We recommend using the transformers package with version 4.48.3.
Example:
import torch
import transformers
model_id = "nvidia/OpenCodeReasoning-7B"
model_kwargs = {"torch_dtype": torch.bfloat16, "trust_remote_code": True, "device_map": "auto"}
tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
tokenizer.pad_token_id = tokenizer.eos_token_id
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
tokenizer=tokenizer,
max_new_tokens=32768,
temperature=0.6,
top_p=0.95,
**model_kwargs
)
print(pipeline([{"role": "user", "content": "Solve x*(sin(x)+2)=0"}]))
Training and Evaluation Datasets
Training Datasets
The training corpus for OpenCodeReasoning-7B is OpenCodeReasoning dataset, which is composed of competitive programming questions and DeepSeek-R1 generated responses.
Data Collection for Training Datasets:
- Hybrid: Automated, Human, Synthetic
Data Labeling for Training Datasets:
- Hybrid: Automated, Human, Synthetic
Evaluation Datasets
We used the datasets listed in the next section to evaluate Llama-3.1-Nemotron-Ultra-253B-v1.
Data Collection for Evaluation Datasets:
- Hybrid: Human/Synthetic
Data Labeling for Evaluation Datasets:
- Hybrid: Human/Synthetic/Automatic
Evaluation Results
LiveCodeBench
Easy | Medium | Hard | Avg. |
---|---|---|---|
95.4 | 64.0 | 18.0 | 51.3 |
User Prompt Template (without starter code):
"You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
Question: {prompt}
Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within delimiters as follows. Ensure that when the python program runs, it reads the inputs, runs the algorithm and writes output to STDOUT.
```python
# YOUR CODE HERE
```
User Prompt Template (with starter code):
You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
Question: {prompt}
You will use the following starter code to write the solution to the problem and enclose your code within delimiters.
```python
{starter_code}
```
CodeContests
Public | Private | Generated | All |
---|---|---|---|
46.7 | 29.6 | 32.3 | 18.1 |
Ethical Considerations:
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our 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.
For more detailed information on ethical considerations for this model, please see the Model Card++ Explainability, Bias, Safety & Security, and Privacy Subcards.
Please report security vulnerabilities or NVIDIA AI Concerns here.
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},
}