suhara commited on
Commit
e069968
·
verified ·
1 Parent(s): 485e5fa

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +331 -6
README.md CHANGED
@@ -1,6 +1,331 @@
1
- ---
2
- license: other
3
- license_name: nvidia-open-model-license
4
- license_link: >-
5
- https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/
6
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: other
4
+ license_name: nvidia-open-model-license
5
+ license_link: >-
6
+ https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/
7
+
8
+ pipeline_tag: text-generation
9
+ language:
10
+ - en
11
+ tags:
12
+ - nvidia
13
+ - llama-3
14
+ - pytorch
15
+ ---
16
+
17
+ # Llama-3.1-Nemotron-Nano-8B-v1
18
+
19
+
20
+ ## Model Overview
21
+
22
+ Llama-3.1-Nemotron-Nano-8B-v1 is a large language model (LLM) which is a derivative of [Meta Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) (AKA the reference model). It is a reasoning model that is post trained for reasoning, human chat preferences, and tasks, such as RAG and tool calling.
23
+
24
+ Llama-3.1-Nemotron-Nano-8B-v1 is a model which offers a great tradeoff between model accuracy and efficiency. It is created from Llama 3.1 8B Instruct and offers improvements in model accuracy. The model fits on a single RTX GPU and can be used locally. The model supports a context length of 128K.
25
+
26
+ This model underwent a multi-phase post-training process to enhance both its reasoning and non-reasoning capabilities. This includes a supervised fine-tuning stage for Math, Code, Reasoning, and Tool Calling as well as multiple reinforcement learning (RL) stages using REINFORCE (RLOO) and Online Reward-aware Preference Optimization (RPO) algorithms for both chat and instruction-following. The final model checkpoint is obtained after merging the final SFT and Online RPO checkpoints. Improved using Qwen.
27
+
28
+ This model is part of the Llama Nemotron Collection. You can find the other model(s) in this family here:
29
+ [Llama-3.3-Nemotron-Super-49B-v1](https://huggingface.co/nvidia/Llama-3.3-Nemotron-Super-49B-v1)
30
+
31
+ This model is ready for commercial use.
32
+
33
+ ## License/Terms of Use
34
+
35
+ GOVERNING TERMS: Your use of this model is governed by the NVIDIA Open Model License. Additional Information: Llama 3.1 Community License Agreement. Built with Llama.
36
+
37
+ **Model Developer:** NVIDIA
38
+
39
+ **Model Dates:** Trained between August 2024 and March 2025
40
+
41
+ **Data Freshness:** The pretraining data has a cutoff of 2023 per Meta Llama 3.1 8B
42
+
43
+
44
+ ## Use Case:
45
+
46
+ Developers designing AI Agent systems, chatbots, RAG systems, and other AI-powered applications. Also suitable for typical instruction-following tasks. Balance of model accuracy and compute efficiency (the model fits on a single RTX GPU and can be used locally).
47
+
48
+ ## Release Date: <br>
49
+ 3/18/2025 <br>
50
+
51
+ ## References
52
+
53
+ - [\[2502.00203\] Reward-aware Preference Optimization: A Unified Mathematical Framework for Model Alignment](https://arxiv.org/abs/2502.00203)
54
+
55
+
56
+ ## Model Architecture
57
+
58
+ **Architecture Type:** Dense decoder-only Transformer model
59
+
60
+ **Network Architecture:** Llama 3.1 8B Instruct
61
+
62
+ ## Intended use
63
+
64
+ Llama-3.1-Nemotron-Nano-8B-v1 is a general purpose reasoning and chat model intended to be used in English and coding languages. Other non-English languages (German, French, Italian, Portuguese, Hindi, Spanish, and Thai) are also supported.
65
+
66
+ #Input:
67
+ - **Input Type:** Text
68
+ - **Input Format:** String
69
+ - **Input Parameters:** One-Dimensional (1D)
70
+ - **Other Properties Related to Input:** Context length up to 131,072 tokens
71
+
72
+ ##Output:
73
+ - **Output Type:** Text
74
+ - **Output Format:** String
75
+ - **Output Parameters:** One-Dimensional (1D)
76
+ - **Other Properties Related to Output:** Context length up to 131,072 tokens
77
+
78
+ ## Model Version:
79
+ 1.0 (3/18/2025)
80
+
81
+ ## Software Integration
82
+ - **Runtime Engine:** [NeMo 24.12] <br>
83
+ - **Recommended Hardware Microarchitecture Compatibility:**
84
+ - NVIDIA Hopper
85
+ - NVIDIA Ampere
86
+
87
+ ## Quick Start and Usage Recommendations:
88
+
89
+ 1. Reasoning mode (ON/OFF) is controlled via the system prompt, which must be set as shown in the example below. All instructions should be contained within the user prompt
90
+ 2. We recommend setting temperature to `0.6`, and Top P to `0.95` for Reasoning ON mode
91
+ 3. We recommend using greedy decoding for Reasoning OFF mode
92
+ 4. We have provided a list of prompts to use for evaluation for each benchmark where a specific template is required
93
+
94
+ You can try this model out through the preview API, using this link: [Llama-3.1-Nemotron-Nano-8B-v1](https://build.nvidia.com/nvidia/llama-3_1-nemotron-nano-8b-v1).
95
+
96
+ See the snippet below for usage with Hugging Face Transformers library. Reasoning mode (ON/OFF) is controlled via system prompt. Please see the example below.
97
+ Our code requires the transformers package version to be 4.44.2 or higher.
98
+
99
+
100
+ Example of “Reasoning On:”
101
+ ```python
102
+ import torch
103
+ import transformers
104
+
105
+ model_id = "nvidia/Llama-3.1-Nemotron-Nano-8B-v1"
106
+ model_kwargs = {"torch_dtype": torch.bfloat16, "device_map": "auto"}
107
+ tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
108
+ tokenizer.pad_token_id = tokenizer.eos_token_id
109
+
110
+ pipeline = transformers.pipeline(
111
+ "text-generation",
112
+ model=model_id,
113
+ tokenizer=tokenizer,
114
+ max_new_tokens=32768,
115
+ temperature=0.6,
116
+ top_p=0.95,
117
+ **model_kwargs
118
+ )
119
+
120
+ # Thinking can be "on" or "off"
121
+ thinking = "on"
122
+
123
+ print(pipeline([{"role": "system", "content": f"detailed thinking {thinking}"}, {"role": "user", "content": "Solve x*(sin(x)+2)=0"}]))
124
+ ```
125
+
126
+
127
+ Example of “Reasoning Off:”
128
+
129
+ ```python
130
+ import torch
131
+ import transformers
132
+
133
+ model_id = "nvidia/Llama-3.1-Nemotron-Nano-8B-v1"
134
+ model_kwargs = {"torch_dtype": torch.bfloat16, "device_map": "auto"}
135
+ tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
136
+ tokenizer.pad_token_id = tokenizer.eos_token_id
137
+
138
+ pipeline = transformers.pipeline(
139
+ "text-generation",
140
+ model=model_id,
141
+ tokenizer=tokenizer,
142
+ max_new_tokens=32768,
143
+ do_sample=False,
144
+ **model_kwargs
145
+ )
146
+
147
+ # Thinking can be "on" or "off"
148
+ thinking = "off"
149
+
150
+ print(pipeline([{"role": "system", "content": f"detailed thinking {thinking}"}, {"role": "user", "content": "Solve x*(sin(x)+2)=0"}]))
151
+ ```
152
+
153
+ For some prompts, even though thinking is disabled, the model emergently prefers to think before responding. But if desired, the users can prevent it by pre-filling the assistant response.
154
+
155
+ ```python
156
+ import torch
157
+ import transformers
158
+
159
+ model_id = "nvidia/Llama-3.1-Nemotron-Nano-8B-v1"
160
+ model_kwargs = {"torch_dtype": torch.bfloat16, "device_map": "auto"}
161
+ tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
162
+ tokenizer.pad_token_id = tokenizer.eos_token_id
163
+
164
+ # Thinking can be "on" or "off"
165
+ thinking = "off"
166
+
167
+ pipeline = transformers.pipeline(
168
+ "text-generation",
169
+ model=model_id,
170
+ tokenizer=tokenizer,
171
+ max_new_tokens=32768,
172
+ do_sample=False,
173
+ **model_kwargs
174
+ )
175
+
176
+ print(pipeline([{"role": "system", "content": f"detailed thinking {thinking}"}, {"role": "user", "content": "Solve x*(sin(x)+2)=0"}, {"role":"assistant", "content":"<think>\n</think>"}]))
177
+ ```
178
+
179
+ ## Inference:
180
+ **Engine:**
181
+ Transformers
182
+ **Test Hardware:**
183
+
184
+ - BF16:
185
+ - 1x RTX 50 Series GPUs
186
+ - 1x RTX 40 Series GPUs
187
+ - 1x RTX 30 Series GPUs
188
+ - 1x H100-80GB GPU
189
+ - 1x A100-80GB GPU
190
+
191
+
192
+ **Preferred/Supported] Operating System(s):** Linux <br>
193
+
194
+ ## Training Datasets
195
+
196
+ A large variety of training data was used for the post-training pipeline, including manually annotated data and synthetic data.
197
+
198
+ The data for the multi-stage post-training phases for improvements in Code, Math, and Reasoning is a compilation of SFT and RL data that supports improvements of math, code, general reasoning, and instruction following capabilities of the original Llama instruct model.
199
+
200
+ Prompts have been sourced from either public and open corpus or synthetically generated. Responses were synthetically generated by a variety of models, with some prompts containing responses for both Reasoning On and Off modes, to train the model to distinguish between two modes.
201
+
202
+ **Data Collection for Training Datasets:** <br>
203
+ * Hybrid: Automated, Human, Synthetic <br>
204
+
205
+ **Data Labeling for Training Datasets:** <br>
206
+ * N/A <br>
207
+
208
+ ## Evaluation Datasets
209
+
210
+ We used the datasets listed below to evaluate Llama-3.1-Nemotron-Nano-8B-v1.
211
+
212
+ Data Collection for Evaluation Datasets:
213
+ Hybrid: Human/Synthetic
214
+
215
+ Data Labeling for Evaluation Datasets:
216
+ Hybrid: Human/Synthetic/Automatic
217
+
218
+ ## Evaluation Results
219
+
220
+ These results contain both “Reasoning On”, and “Reasoning Off”. We recommend using temperature=`0.6`, top_p=`0.95` for “Reasoning On” mode, and greedy decoding for “Reasoning Off” mode. All evaluations are done with 32k sequence length. We run the benchmarks up to 16 times and average the scores to be more accurate.
221
+
222
+ > NOTE: Where applicable, a Prompt Template will be provided. While completing benchmarks, please ensure that you are parsing for the correct output format as per the provided prompt in order to reproduce the benchmarks seen below.
223
+
224
+ ### MT-Bench
225
+
226
+ | Reasoning Mode | Score |
227
+ |--------------|------------|
228
+ | Reasoning Off | 7.9 |
229
+ | Reasoning On | 8.1 |
230
+
231
+
232
+ ### MATH500
233
+
234
+ | Reasoning Mode | pass@1 |
235
+ |--------------|------------|
236
+ | Reasoning Off | 36.6% |
237
+ | Reasoning On | 95.4% |
238
+
239
+ User Prompt Template:
240
+
241
+ ```
242
+ "Below is a math question. I want you to reason through the steps and then give a final answer. Your final answer should be in \boxed{}.\nQuestion: {question}"
243
+ ```
244
+
245
+
246
+ ### AIME25
247
+
248
+ | Reasoning Mode | pass@1 |
249
+ |--------------|------------|
250
+ | Reasoning Off | 36.6% |
251
+ | Reasoning On | 47.1% |
252
+
253
+ User Prompt Template:
254
+
255
+ ```
256
+ "Below is a math question. I want you to reason through the steps and then give a final answer. Your final answer should be in \boxed{}.\nQuestion: {question}"
257
+ ```
258
+
259
+
260
+ ### GPQA-D
261
+
262
+ | Reasoning Mode | pass@1 |
263
+ |--------------|------------|
264
+ | Reasoning Off | 39.4% |
265
+ | Reasoning On | 54.1% |
266
+
267
+ User Prompt Template:
268
+
269
+
270
+ ```
271
+ "What is the correct answer to this question: {question}\nChoices:\nA. {option_A}\nB. {option_B}\nC. {option_C}\nD. {option_D}\nLet's think step by step, and put the final answer (should be a single letter A, B, C, or D) into a \boxed{}"
272
+ ```
273
+
274
+
275
+ ### IFEval Average
276
+
277
+ | Reasoning Mode | Strict:Prompt | Strict:Instruction |
278
+ |--------------|------------|------------|
279
+ | Reasoning Off | 74.7% | 82.1% |
280
+ | Reasoning On | 71.9% | 79.3% |
281
+
282
+ ### BFCL v2 Live
283
+
284
+ | Reasoning Mode | Score |
285
+ |--------------|------------|
286
+ | Reasoning Off | 63.9% |
287
+ | Reasoning On | 63.6% |
288
+
289
+ User Prompt Template:
290
+
291
+
292
+ ```
293
+ <AVAILABLE_TOOLS>{functions}</AVAILABLE_TOOLS>
294
+
295
+ {user_prompt}
296
+ ```
297
+
298
+
299
+ ### MBPP 0-shot
300
+
301
+ | Reasoning Mode | pass@1 |
302
+ |--------------|------------|
303
+ | Reasoning Off | 66.1% |
304
+ | Reasoning On | 84.6% |
305
+
306
+ User Prompt Template:
307
+
308
+
309
+ ````
310
+ You are an exceptionally intelligent coding assistant that consistently delivers accurate and reliable responses to user instructions.
311
+
312
+ @@ Instruction
313
+ Here is the given problem and test examples:
314
+ {prompt}
315
+ Please use the python programming language to solve this problem.
316
+ Please make sure that your code includes the functions from the test samples and that the input and output formats of these functions match the test samples.
317
+ Please return all completed codes in one code block.
318
+ This code block should be in the following format:
319
+ ```python
320
+ # Your codes here
321
+ ```
322
+ ````
323
+
324
+
325
+ ## Ethical Considerations:
326
+
327
+ 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.
328
+
329
+ For more detailed information on ethical considerations for this model, please see [the Model Card++](https://build.nvidia.com/nvidia/llama-3_1-nemotron-nano-8b-v1/modelcard) Explainability, Bias, Safety & Security, and Privacy Subcards.
330
+
331
+ Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).