File size: 6,432 Bytes
5f7ffb4
 
 
f9f5111
5f7ffb4
f9f5111
5f7ffb4
 
 
 
 
 
f9f5111
5f7ffb4
 
 
e1f0cca
 
f9f5111
 
5f7ffb4
 
 
 
f9f5111
5f7ffb4
 
 
f9f5111
5f7ffb4
 
f9f5111
 
5f7ffb4
 
 
f9f5111
5f7ffb4
 
 
f9f5111
5f7ffb4
 
f9f5111
 
5f7ffb4
34b4180
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
 
 
 
 
5f7ffb4
f9f5111
 
 
 
 
5f7ffb4
f9f5111
 
 
 
 
 
5f7ffb4
f9f5111
 
5f7ffb4
f9f5111
5f7ffb4
6230bad
5f7ffb4
f9f5111
 
5f7ffb4
f9f5111
 
5f7ffb4
f9f5111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f7ffb4
 
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
 
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
c7c6eab
f9f5111
 
5f7ffb4
f9f5111
5f7ffb4
f9f5111
 
5f7ffb4
f9f5111
5f7ffb4
f9f5111
 
 
 
 
5f7ffb4
f9f5111
5f7ffb4
f9f5111
 
5f7ffb4
f9f5111
5f7ffb4
f9f5111
 
 
 
 
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
f9f5111
5f7ffb4
 
c7c6eab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
---
library_name: transformers
license: other
license_name: nvidia-open-model-license
license_link: >-
  https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/
pipeline_tag: text-generation
tags:
  - nvidia
  - pytorch
---

# OpenCodeReasoning-Distill-Qwen-7B-Instruct

## Model Overview 

OpenCodeReasoning-Distill-Qwen-7B-Instruct is a large language model (LLM) which is a derivative of [Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/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 Open Model License.](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/) Additional Information: [Llama 3.1 Community License Agreement](https://www.llama.com/llama3\_1/license/). Built with Qwen.

**Model Developer:** NVIDIA

**Model Dates:** Trained between February 2025 and March 2025


### Use Case:
Developers designing AI-powered code generation applications. Also suitable for typical instruction-following tasks. 

## Release Date: 

2025-04-21

## References

- [\[2504.01943\] OpenCodeReasoning: Advancing Data Distillation for Competitive Coding](https://arxiv.org/abs/2504.01943)

## Model Architecture
- Architecture Type: Dense decoder-only Transformer model
- Network Architecture: Qwen

**This model was developed based on Qwen2.5-7B-Instruct. <br>
** This model has 7B of model parameters. <br>

## Intended use

OpenCodeReasoning-Distill-Qwen-7B-Instruct 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](https://huggingface.co/docs/transformers/main/en/index) library. Please see the example below.

We recommend using the *transformers* package with version 4.48.3.   
Example:

```py
import torch
import transformers

model_id = "nvidia/OpenCodeReasoning-Distill-Qwen-7B-Instruct"
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

This model is trained using [OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning) dataset.

**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 (20240801-20250201)

| Models | Pass@1 |
|:--------------|:------------|
| R1-Distill-Qwen-7B | 37.6 |
| OpenCodeReasoning-Distill-Qwen-7B-Instruct | 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}
```
````

## 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](./EXPLAINABILITY.md), [Bias](./BIAS.md), [Safety & Security](./SAFETY_and_SECURITY.md), and [Privacy](./PRIVACY.md) Subcards.

Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).


## 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}, 
}