模型概述
模型特點
模型能力
使用案例
🚀 Llama-3.1-Nemotron-Nano-8B-v1
Llama-3.1-Nemotron-Nano-8B-v1 是一款大型語言模型,它基於 Meta Llama-3.1-8B-Instruct 衍生而來。該模型在推理、滿足人類聊天偏好以及處理如 RAG 和工具調用等任務方面表現出色,在模型準確性和效率之間取得了良好的平衡。
🚀 快速開始
你可以通過預覽 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
)
# Thinking can be "on" or "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
# Thinking can be "on" or "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>"}]))
🔧 使用建議
- 推理模式(開啟/關閉)通過系統提示控制,系統提示必須按以下示例設置,所有指令應包含在用戶提示中。
- 對於推理開啟模式,建議將溫度設置為
0.6
,Top P 設置為0.95
。 - 對於推理關閉模式,建議使用貪心解碼。
- 我們為每個需要特定模板的基準測試提供了用於評估的提示列表。
- 在推理開啟模式下,如果不需要推理,模型會包含
<think></think>
,這是預期行為。
✨ 主要特性
- 高效推理:經過多階段的後訓練過程,增強了推理和非推理能力,在推理任務中表現出色。
- 多語言支持:支持英語和多種編碼語言,同時也支持德語、法語、意大利語、葡萄牙語、印地語、西班牙語和泰語等非英語語言。
- 高性價比:模型可以在單個 RTX GPU 上運行,適合本地使用,在模型準確性和計算效率之間取得了良好的平衡。
- 長上下文支持:支持長達 128K 的上下文長度。
📚 詳細文檔
模型概述
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
- BF16:
- 首選/支持的操作系統:Linux
訓練數據集
後訓練管道使用了多種訓練數據,包括手動標註數據和合成數據。
用於代碼、數學和推理改進的多階段後訓練階段的數據是 SFT 和 RL 數據的集合,支持提升原始 Llama 指令模型的數學、代碼、通用推理和指令跟隨能力。
提示來源可以是公共開放語料庫或合成生成。響應由多種模型合成生成,一些提示包含推理開啟和關閉模式的響應,用於訓練模型區分兩種模式。
- 訓練數據集的數據收集:混合方式:自動化、人工、合成
- 訓練數據集的數據標註:不適用
評估數據集
我們使用以下數據集對 Llama-3.1-Nemotron-Nano-8B-v1 進行評估。
- 評估數據集的數據收集:混合方式:人工/合成
- 評估數據集的數據標註:混合方式:人工/合成/自動
評估結果
這些結果包含“推理開啟”和“推理關閉”兩種模式。我們建議在“推理開啟”模式下使用溫度=0.6
,top_p=0.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 平均
推理模式 | 嚴格:提示 | 嚴格:指令 |
---|---|---|
推理關閉 | 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}, }
## 📄 許可證
本模型的使用受 [NVIDIA 開放模型許可證](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/) 約束。附加信息請參考 [Llama 3.1 社區許可協議](https://www.llama.com/llama3_1/license/)。



