模型简介
模型特点
模型能力
使用案例
🚀 Llama-3.1-Nemotron-Nano-8B-v1
Llama-3.1-Nemotron-Nano-8B-v1是一个大语言模型,在推理能力和效率上取得了很好的平衡,适用于多种AI应用场景。
Unsloth Dynamic 2.0 实现了卓越的准确性,性能优于其他领先的量化方法。
🚀 快速开始
你可以通过预览API试用这个模型,使用此链接:Llama-3.1-Nemotron-Nano-8B-v1。
以下是使用Hugging Face Transformers库的代码片段示例,推理模式(开启/关闭)通过系统提示控制,请参考以下示例。我们的代码要求transformers包的版本为4.44.2
或更高。
基础用法
import torch
import transformers
model_id = "nvidia/Llama-3.1-Nemotron-Nano-8B-v1"
model_kwargs = {"torch_dtype": torch.bfloat16, "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
)
# 思考模式可以是 "on" 或 "off"
thinking = "on"
print(pipeline([{"role": "system", "content": f"detailed thinking {thinking}"}, {"role": "user", "content": "Solve x*(sin(x)+2)=0"}]))
高级用法
import torch
import transformers
model_id = "nvidia/Llama-3.1-Nemotron-Nano-8B-v1"
model_kwargs = {"torch_dtype": torch.bfloat16, "device_map": "auto"}
tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
tokenizer.pad_token_id = tokenizer.eos_token_id
# 思考模式可以是 "on" 或 "off"
thinking = "off"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
tokenizer=tokenizer,
max_new_tokens=32768,
do_sample=False,
**model_kwargs
)
print(pipeline([{"role": "system", "content": f"detailed thinking {thinking}"}, {"role": "user", "content": "Solve x*(sin(x)+2)=0"}, {"role":"assistant", "content":"<think>\n</think>"}]))
✨ 主要特性
- 推理能力强:经过多阶段的后训练过程,增强了推理和非推理能力,适用于推理、人机对话偏好和任务,如RAG和工具调用。
- 准确性与效率平衡:在模型准确性和效率之间取得了很好的平衡,基于Llama 3.1 8B Instruct创建,提高了模型准确性,可在单个RTX GPU上运行并本地使用。
- 长上下文支持:支持128K的上下文长度。
- 多语言支持:适用于英语和编码语言,也支持其他非英语语言,如德语、法语、意大利语、葡萄牙语、印地语、西班牙语和泰语。
📦 安装指南
文档未提及具体安装步骤,可参考快速开始部分使用Hugging Face Transformers库的示例,确保transformers包的版本为4.44.2
或更高。
📚 详细文档
模型概述
Llama-3.1-Nemotron-Nano-8B-v1是一个大语言模型(LLM),它是Meta Llama-3.1-8B-Instruct(又名参考模型)的衍生模型。它是一个推理模型,经过后训练以提升推理能力、满足人机对话偏好和处理各种任务,如RAG和工具调用。
该模型在模型准确性和效率之间取得了很好的平衡,基于Llama 3.1 8B Instruct创建,提高了模型准确性,可在单个RTX GPU上运行并本地使用,支持128K的上下文长度。
此模型经过多阶段的后训练过程,以增强其推理和非推理能力。这包括针对数学、代码、推理和工具调用的有监督微调阶段,以及使用REINFORCE(RLOO)和在线奖励感知偏好优化(RPO)算法进行的多个强化学习(RL)阶段,用于对话和指令跟随。最终的模型检查点是在合并最终的SFT和在线RPO检查点后获得的,并使用Qwen进行了改进。
该模型是Llama Nemotron系列的一部分,你可以在此处找到该系列的其他模型:Llama-3.3-Nemotron-Super-49B-v1。
该模型可用于商业用途。
许可证/使用条款
- 适用条款:你使用此模型受NVIDIA开放模型许可证的约束。
- 附加信息:Llama 3.1社区许可协议。基于Llama构建。
模型开发者:NVIDIA
模型训练时间:2024年8月至2025年3月
数据时效性:根据Meta Llama 3.1 8B,预训练数据的截止时间为2023年。
使用场景
适用于设计AI代理系统、聊天机器人、RAG系统和其他AI应用的开发者,也适用于典型的指令跟随任务。在模型准确性和计算效率之间取得平衡(模型可在单个RTX GPU上运行并本地使用)。
发布日期
2025年3月18日
参考资料
- [2505.00949] Llama-Nemotron: Efficient Reasoning Models
- [2502.00203] Reward-aware Preference Optimization: A Unified Mathematical Framework for Model Alignment
模型架构
属性 | 详情 |
---|---|
架构类型 | 密集解码器Transformer模型 |
网络架构 | Llama 3.1 8B Instruct |
预期用途
Llama-3.1-Nemotron-Nano-8B-v1是一个通用的推理和对话模型,适用于英语和编码语言,也支持其他非英语语言,如德语、法语、意大利语、葡萄牙语、印地语、西班牙语和泰语。
输入
属性 | 详情 |
---|---|
输入类型 | 文本 |
输入格式 | 字符串 |
输入参数 | 一维(1D) |
其他输入相关属性 | 上下文长度最大为131,072个标记 |
输出
属性 | 详情 |
---|---|
输出类型 | 文本 |
输出格式 | 字符串 |
输出参数 | 一维(1D) |
其他输出相关属性 | 上下文长度最大为131,072个标记 |
模型版本
1.0(2025年3月18日)
软件集成
属性 | 详情 |
---|---|
运行时引擎 | NeMo 24.12 |
推荐的硬件微架构兼容性 | NVIDIA Hopper、NVIDIA Ampere |
推理
属性 | 详情 |
---|---|
推理引擎 | Transformers |
测试硬件 | BF16:1x RTX 50系列GPU、1x RTX 40系列GPU、1x RTX 30系列GPU、1x H100 - 80GB GPU、1x A100 - 80GB GPU |
首选/支持的操作系统 | Linux |
训练数据集
后训练管道使用了多种训练数据,包括手动标注数据和合成数据。
用于多阶段后训练阶段以改进代码、数学和推理能力的数据是SFT和RL数据的集合,支持提高原始Llama指令模型的数学、代码、一般推理和指令跟随能力。
提示语来自公共开放语料库或合成生成。响应由多种模型合成生成,一些提示语包含推理开启和关闭模式的响应,以训练模型区分两种模式。
训练数据集的数据收集:混合方式:自动化、人工、合成
训练数据集的数据标注:不适用
评估数据集
我们使用以下数据集评估Llama-3.1-Nemotron-Nano-8B-v1。
评估数据集的数据收集:混合方式:人工/合成
评估数据集的数据标注:混合方式:人工/合成/自动
评估结果
这些结果包含“推理开启”和“推理关闭”两种模式。我们建议在“推理开启”模式下使用温度0.6
、top_p0.95
,在“推理关闭”模式下使用贪心解码。所有评估均使用32k序列长度进行。我们最多运行16次基准测试并取平均分数以提高准确性。
⚠️ 重要提示
适用时,将提供提示模板。完成基准测试时,请确保按照提供的提示解析正确的输出格式,以重现以下基准测试结果。
MT - Bench
推理模式 | 分数 |
---|---|
推理关闭 | 7.9 |
推理开启 | 8.1 |
MATH500
推理模式 | pass@1 |
---|---|
推理关闭 | 36.6% |
推理开启 | 95.4% |
用户提示模板:
"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}"
AIME25
推理模式 | pass@1 |
---|---|
推理关闭 | 0% |
推理开启 | 47.1% |
用户提示模板:
"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}"
GPQA - D
推理模式 | pass@1 |
---|---|
推理关闭 | 39.4% |
推理开启 | 54.1% |
用户提示模板:
"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{}"
IFEval Average
推理模式 | 严格:提示 | 严格:指令 |
---|---|---|
推理关闭 | 74.7% | 82.1% |
推理开启 | 71.9% | 79.3% |
BFCL v2 Live
推理模式 | 分数 |
---|---|
推理关闭 | 63.9% |
推理开启 | 63.6% |
用户提示模板:
<AVAILABLE_TOOLS>{functions}</AVAILABLE_TOOLS>
{user_prompt}
MBPP 0 - shot
推理模式 | pass@1 |
---|---|
推理关闭 | 66.1% |
推理开启 | 84.6% |
用户提示模板:
You are an exceptionally intelligent coding assistant that consistently delivers accurate and reliable responses to user instructions.
@@ Instruction
Here is the given problem and test examples:
{prompt}
Please use the python programming language to solve this problem.
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.
Please return all completed codes in one code block.
This code block should be in the following format:
```python
# Your codes here
### 伦理考虑
NVIDIA认为可信AI是一项共同责任,我们已经制定了政策和实践,以支持开发各种AI应用。当按照我们的服务条款下载或使用此模型时,开发者应与内部模型团队合作,确保该模型满足相关行业和用例的要求,并解决不可预见的产品滥用问题。
有关此模型伦理考虑的更多详细信息,请参阅模型卡片++的[可解释性](explainability.md)、[偏差](bias.md)、[安全与保障](safety.md)和[隐私](privacy.md)子卡片。
请[在此](https://www.nvidia.com/en-us/support/submit-security-vulnerability/)报告安全漏洞或NVIDIA AI相关问题。
### 引用
@misc{bercovich2025llamanemotronefficientreasoningmodels, title={Llama-Nemotron: Efficient Reasoning Models}, author={Akhiad Bercovich and Itay Levy and Izik Golan and Mohammad Dabbah and Ran El-Yaniv and Omri Puny and Ido Galil and Zach Moshe and Tomer Ronen and Najeeb Nabwani and Ido Shahaf and Oren Tropp and Ehud Karpas and Ran Zilberstein and Jiaqi Zeng and Soumye Singhal and Alexander Bukharin and Yian Zhang and Tugrul Konuk and Gerald Shen and Ameya Sunil Mahabaleshwarkar and Bilal Kartal and Yoshi Suhara and Olivier Delalleau and Zijia Chen and Zhilin Wang and David Mosallanezhad and Adi Renduchintala and Haifeng Qian and Dima Rekesh and Fei Jia and Somshubra Majumdar and Vahid Noroozi and Wasi Uddin Ahmad and Sean Narenthiran and Aleksander Ficek and Mehrzad Samadi and Jocelyn Huang and Siddhartha Jain and Igor Gitman and Ivan Moshkov and Wei Du and Shubham Toshniwal and George Armstrong and Branislav Kisacanin and Matvei Novikov and Daria Gitman and Evelina Bakhturina and Jane Polak Scowcroft and John Kamalu and Dan Su and Kezhi Kong and Markus Kliegl and Rabeeh Karimi and Ying Lin and Sanjeev Satheesh and Jupinder Parmar and Pritam Gundecha and Brandon Norick and Joseph Jennings and Shrimai Prabhumoye and Syeda Nahida Akter and Mostofa Patwary and Abhinav Khattar and Deepak Narayanan and Roger Waleffe and Jimmy Zhang and Bor-Yiing Su and Guyue Huang and Terry Kong and Parth Chadha and Sahil Jain and Christine Harvey and Elad Segal and Jining Huang and Sergey Kashirsky and Robert McQueen and Izzy Putterman and George Lam and Arun Venkatesan and Sherry Wu and Vinh Nguyen and Manoj Kilaru and Andrew Wang and Anna Warno and Abhilash Somasamudramath and Sandip Bhaskar and Maka Dong and Nave Assaf and Shahar Mor and Omer Ullman Argov and Scot Junkin and Oleksandr Romanenko and Pedro Larroy and Monika Katariya and Marco Rovinelli and Viji Balas and Nicholas Edelman and Anahita Bhiwandiwalla and Muthu Subramaniam and Smita Ithape and Karthik Ramamoorthy and Yuting Wu and Suguna Varshini Velury and Omri Almog and Joyjit Daw and Denys Fridman and Erick Galinkin and Michael Evans and Katherine Luna and Leon Derczynski and Nikki Pope and Eileen Long and Seth Schneider and Guillermo Siman and Tomasz Grzegorzek and Pablo Ribalta and Monika Katariya and Joey Conway and Trisha Saar and Ann Guan and Krzysztof Pawelec and Shyamala Prayaga and Oleksii Kuchaiev and Boris Ginsburg and Oluwatobi Olabiyi and Kari Briski and Jonathan Cohen and Bryan Catanzaro and Jonah Alben and Yonatan Geifman and Eric Chung and Chris Alexiuk}, year={2025}, eprint={2505.00949}, archivePrefix={arXiv}, primaryClass={cs.CL}, url={https://arxiv.org/abs/2505.00949}, }
## 🔧 技术细节
该模型经过多阶段的后训练过程,包括有监督微调阶段和强化学习阶段。有监督微调阶段针对数学、代码、推理和工具调用进行,强化学习阶段使用REINFORCE(RLOO)和在线奖励感知偏好优化(RPO)算法,用于对话和指令跟随。最终的模型检查点是在合并最终的SFT和在线RPO检查点后获得的,并使用Qwen进行了改进。
## 📄 许可证
本模型的使用受[NVIDIA开放模型许可证](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/)的约束,附加信息请参考[Llama 3.1社区许可协议](https://www.llama.com/llama3_1/license/)。



