模型概述
模型特點
模型能力
使用案例
🚀 OpenCodeReasoning-Nemotron-32B-IOI GGUF模型
OpenCodeReasoning-Nemotron-32B-IOI是一個基於Qwen2.5-32B-Instruct的大語言模型,專為代碼生成推理而進行了後訓練。它支持32K的上下文長度,可用於商業和非商業用途。
🚀 快速開始
運行IOI基準編碼問題推理
import transformers
import torch
model_id = "nvidia/OpenCodeReasoning-Nemotron-32B-IOI"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
prompt = """You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use c++ programming language only.
You must use ```cpp for just the final solution code block with the following format:
```cpp
// Your code here
{user} """
messages = [ { "role": "user", "content": prompt.format(user="Write a program to calculate the sum of the first $N$ fibonacci numbers")}, ]
outputs = pipeline( messages, max_new_tokens=32768, ) print(outputs[0]["generated_text"][-1]['content'])
### 運行Python程序編碼問題推理
```python
import transformers
import torch
model_id = "nvidia/OpenCodeReasoning-Nemotron-32B"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
prompt = """You are a helpful and harmless assistant. You should think step-by-step before responding to the instruction below.
Please use python programming language only.
You must use ```python for just the final solution code block with the following format:
```python
# Your code here
{user} """
messages = [ { "role": "user", "content": prompt.format(user="Write a program to calculate the sum of the first $N$ fibonacci numbers")}, ]
outputs = pipeline( messages, max_new_tokens=32768, ) print(outputs[0]["generated_text"][-1]['content'])
## ✨ 主要特性
- **超低比特量化**:引入了針對超低比特模型(1 - 2比特)的精度自適應量化方法,在Llama - 3 - 8B上經基準測試驗證有顯著改進。
- **多模型格式支持**:提供BF16、F16、多種量化模型格式,可根據硬件能力和內存限制選擇。
- **代碼生成推理**:專為代碼生成推理進行後訓練,支持32K上下文長度。
## 📦 安裝指南
文檔未提及具體安裝步驟,故跳過此章節。
## 💻 使用示例
### 基礎用法
上述“快速開始”部分的代碼示例展示瞭如何使用該模型進行IOI基準編碼問題和Python程序編碼問題的推理。
## 📚 詳細文檔
### 模型生成細節
該模型使用[llama.cpp](https://github.com/ggerganov/llama.cpp)在提交版本[`92ecdcc0`](https://github.com/ggerganov/llama.cpp/commit/92ecdcc06a4c405a415bcaa0cb772bc560aa23b1)時生成。
### 超低比特量化(1 - 2比特)與IQ - DynamicGate
- **基準測試背景**:所有測試均在**Llama - 3 - 8B - Instruct**上進行,使用標準困惑度評估管道、2048令牌上下文窗口和相同的提示集。
- **方法**:
- **動態精度分配**:前/後25%的層採用IQ4_XS(選定層),中間50%採用IQ2_XXS/IQ3_S以提高效率。
- **關鍵組件保護**:嵌入層/輸出層使用Q5_K,與標準1 - 2比特量化相比,可減少38%的誤差傳播。
- **量化性能比較(Llama - 3 - 8B)**
| 量化方式 | 標準PPL | DynamicGate PPL | ∆PPL | 標準大小 | DG大小 | ∆大小 | 標準速度 | DG速度 |
|--------------|--------------|------------------|---------|----------|---------|--------|-----------|----------|
| IQ2_XXS | 11.30 | 9.84 | -12.9% | 2.5G | 2.6G | +0.1G | 234s | 246s |
| IQ2_XS | 11.72 | 11.63 | -0.8% | 2.7G | 2.8G | +0.1G | 242s | 246s |
| IQ2_S | 14.31 | 9.02 | -36.9% | 2.7G | 2.9G | +0.2G | 238s | 244s |
| IQ1_M | 27.46 | 15.41 | -43.9% | 2.2G | 2.5G | +0.3G | 206s | 212s |
| IQ1_S | 53.07 | 32.00 | -39.7% | 2.1G | 2.4G | +0.3G | 184s | 209s |
### 選擇合適的模型格式
| 模型格式 | 精度 | 內存使用 | 設備要求 | 最佳用例 |
|--------------|------------|---------------|----------------------|---------------|
| **BF16** | 最高 | 高 | 支持BF16的GPU/CPU | 減少內存的高速推理 |
| **F16** | 高 | 高 | 支持FP16的設備 | 當BF16不可用時的GPU推理 |
| **Q4_K** | 中低 | 低 | CPU或低VRAM設備 | 內存受限環境的最佳選擇 |
| **Q6_K** | 中 | 中等 | 內存較多的CPU | 量化模型中精度較好的選擇 |
| **Q8_0** | 高 | 中等 | 有足夠VRAM的CPU或GPU | 量化模型中精度最高的選擇 |
| **IQ3_XS** | 非常低 | 非常低 | 超低內存設備 | 極致內存效率和低精度 |
| **Q4_0** | 低 | 低 | ARM或低內存設備 | llama.cpp可針對ARM設備優化 |
### 包含的文件及詳情
- `OpenCodeReasoning-Nemotron-32B-IOI-bf16.gguf`:模型權重保存為BF16格式,適用於需要重新量化模型的情況,設備需支持BF16加速。
- `OpenCodeReasoning-Nemotron-32B-IOI-f16.gguf`:模型權重保存為F16格式,適用於支持FP16的設備,尤其是BF16不可用時。
- `OpenCodeReasoning-Nemotron-32B-IOI-bf16-q8_0.gguf`:輸出和嵌入層保持為BF16,其他層量化為Q8_0,適用於支持BF16且需要量化版本的設備。
- `OpenCodeReasoning-Nemotron-32B-IOI-f16-q8_0.gguf`:輸出和嵌入層保持為F16,其他層量化為Q8_0。
- `OpenCodeReasoning-Nemotron-32B-IOI-q4_k.gguf`:輸出和嵌入層量化為Q8_0,其他層量化為Q4_K,適用於內存有限的CPU推理。
- `OpenCodeReasoning-Nemotron-32B-IOI-q4_k_s.gguf`:最小的Q4_K變體,以犧牲精度為代價使用更少的內存,適用於極低內存設置。
- `OpenCodeReasoning-Nemotron-32B-IOI-q6_k.gguf`:輸出和嵌入層量化為Q8_0,其他層量化為Q6_K。
- `OpenCodeReasoning-Nemotron-32B-IOI-q8_0.gguf`:完全Q8量化的模型,精度更高,但需要更多內存。
- `OpenCodeReasoning-Nemotron-32B-IOI-iq3_xs.gguf`:IQ3_XS量化,針對極致內存效率進行優化,適用於超低內存設備。
- `OpenCodeReasoning-Nemotron-32B-IOI-iq3_m.gguf`:IQ3_M量化,提供中等塊大小以提高精度,適用於低內存設備。
- `OpenCodeReasoning-Nemotron-32B-IOI-q4_0.gguf`:純Q4_0量化,針對ARM設備優化,適用於低內存環境,若需要更高精度可選擇IQ4_NL。
### 測試模型
如果覺得這些模型有用,請點擊“點贊”!同時,幫助測試AI網絡監控助手,進行量子就緒安全檢查:[免費網絡監控](https://readyforquantum.com/dashboard/?assistant=open&utm_source=huggingface&utm_medium=referral&utm_campaign=huggingface_repo_readme)
#### 測試方法
選擇一種AI助手類型:
- `TurboLLM` (GPT - 4o - mini)
- `HugLLM` (Huggingface開源)
- `TestLLM` (僅實驗性CPU)
#### 測試內容
正在測試小型開源模型在AI網絡監控方面的極限,具體包括:
- 針對即時網絡服務的函數調用
- 模型在處理以下任務時的最小規模:
- 自動化Nmap掃描
- 量子就緒檢查
- 網絡監控任務
#### 測試模型詳情
- **TestLLM**:當前實驗模型(llama.cpp在2個CPU線程上運行)
- 零配置設置
- 30秒加載時間(推理慢但無API成本)
- 尋求幫助!如果對邊緣設備AI感興趣,歡迎合作!
#### 其他助手
- **TurboLLM**:使用gpt - 4o - mini進行以下操作:
- 創建自定義cmd處理器,在免費網絡監控代理上運行.net代碼
- 即時網絡診斷和監控
- 安全審計
- 滲透測試(Nmap/Metasploit)
- **HugLLM**:最新的開源模型,在Hugging Face推理API上運行
#### 示例測試命令
1. `"Give me info on my websites SSL certificate"`
2. `"Check if my server is using quantum safe encyption for communication"`
3. `"Run a comprehensive security audit on my server"`
4. '"Create a cmd processor to .. (what ever you want)" Note you need to install a Free Network Monitor Agent to run the .net code from. This is a very flexible and powerful feature. Use with caution!
## 🔧 技術細節
### 模型架構
- 架構類型:密集解碼器Transformer模型
- 網絡架構:Qwen - 32B - Instruct
- 該模型基於Qwen2.5 - 32B - Instruct開發,有32B模型參數。
### 輸入輸出
- **輸入**:
- 輸入類型:文本
- 輸入格式:字符串
- 輸入參數:一維(1D)
- 其他輸入相關屬性:上下文長度可達32,768個令牌
- **輸出**:
- 輸出類型:文本
- 輸出格式:字符串
- 輸出參數:一維(1D)
- 其他輸出相關屬性:上下文長度可達32,768個令牌
### 軟件集成
- 運行時引擎:NeMo 2.3.0
- 推薦硬件微架構兼容性:NVIDIA Ampere、NVIDIA Hopper
- 首選/支持的操作系統:Linux
### 模型版本
1.0 (4/25/2025)
- OpenCodeReasoning-Nemotron-7B
- OpenCodeReasoning-Nemotron-14B
- OpenCodeReasoning-Nemotron-32B
- OpenCodeReasoning-Nemotron-32B-IOI
### 訓練和評估數據集
- **訓練數據集**:OpenCodeReasoning-Nemotron-32B的訓練語料庫是[OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning)數據集,由競賽編程問題和DeepSeek - R1生成的響應組成。數據收集方法和標註方法均為混合方式(自動化、人工、合成),包含來自OpenCodeReasoning的736k個樣本。
- **評估數據集**:使用後續部分列出的數據集評估OpenCodeReasoning-Nemotron-32B,數據收集方法和標註方法同樣為混合方式(自動化、人工、合成)。
### 推理
- 推理引擎:vLLM
- 測試硬件:NVIDIA H100 - 80GB
## 📄 許可證
本模型的使用受[Apache 2.0](https://huggingface.co/nvidia/OpenCode-Nemotron-2-7B/blob/main/LICENSE)許可證約束。
## 引用
如果發現這些數據有用,請引用:
@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}, }
## 額外信息
### 部署地理範圍
全球
### 使用場景
本模型適用於構建大語言模型的開發者和研究人員。
### 發佈日期
2025年4月25日通過Huggingface發佈:https://huggingface.co/nvidia/OpenCodeReasoning-Nemotron-32B/
### 參考資料
[2504.01943] OpenCodeReasoning: Advancing Data Distillation for Competitive Coding
### 倫理考量
NVIDIA認為可信AI是共同的責任,並已制定政策和實踐,以支持廣泛的AI應用開發。開發者在按照服務條款下載或使用模型時,應與內部模型團隊合作,確保該模型滿足相關行業和用例的要求,並解決不可預見的產品濫用問題。請在此報告安全漏洞或NVIDIA AI相關問題。



