模型简介
模型特点
模型能力
使用案例
🚀 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相关问题。



