Nemotron 3.5 Lightning部署教程:英伟达开源30B模型vLLM推理指南

发布日期:2026-08-13 | 分类:AI工具教程


项目简介

Nemotron 3.5 Lightning是英伟达2026年8月11日开源的大语言模型,总参数量300亿(30B),推理时仅激活约30亿(3B)参数。采用Mamba-2与Transformer混合架构+稀疏MoE(6/128专家路由),1M上下文窗口。单H200吞吐约为Qwen3-30B的3.3倍,支持Reasoning ON/OFF和思考token预算。许可为NVIDIA Open Model License。

环境要求

第一步:安装vLLM推理框架

# 创建虚拟环境
python -m venv nemotron-env
source nemotron-env/bin/activate  # Linux
# nemotron-env\Scripts\activate   # Windows

# 安装vLLM
pip install vllm>=0.6.0

# 安装HuggingFace Hub
pip install -U huggingface_hub

第二步:下载模型权重

# 方式1:HuggingFace直接下载
huggingface-cli download nvidia/Nemotron-3.5-Lightning --local-dir ./nemotron-3.5

# 方式2:国内镜像加速
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download nvidia/Nemotron-3.5-Lightning --local-dir ./nemotron-3.5

# 方式3:通过build.nvidia.com在线调用(无需下载)
# API端点:https://integrate.api.nvidia.com/v1

第三步:启动vLLM推理服务

# 启动OpenAI兼容API服务
vllm serve ./nemotron-3.5 \
  --model nvidia/Nemotron-3.5-Lightning \
  --port 8000 \
  --max-model-len 1048576 \
  --tensor-parallel-size 1 \
  --trust-remote-code

# 服务启动后访问 http://localhost:8000/v1/models

第四步:调用API

from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="none")

response = client.chat.completions.create(
    model="nvidia/Nemotron-3.5-Lightning",
    messages=[
        {"role": "user", "content": "用Python写一个快速排序算法"}
    ],
    max_tokens=512
)

print(response.choices[0].message.content)

第五步:Reasoning控制(思考开关)

# Reasoning ON(默认,深度思考)
response = client.chat.completions.create(
    model="nvidia/Nemotron-3.5-Lightning",
    messages=[{"role": "user", "content": "证明根号2是无理数"}],
    extra_body={"reasoning": True, "thinking_budget": 2048}
)

# Reasoning OFF(快速响应)
response = client.chat.completions.create(
    model="nvidia/Nemotron-3.5-Lightning",
    messages=[{"role": "user", "content": "今天天气怎么样"}],
    extra_body={"reasoning": False}
)

关键参数说明

参数说明推荐值
max-model-len最大上下文长度1048576(1M)
tensor-parallel-size张量并行GPU数1(单卡)或2
thinking_budget思考token上限2048(平衡)
gpu-memory-utilizationGPU显存利用率0.9

适用场景

长链条推理、工具调用、多智能体协作、高频调用场景。英伟达正在开发万亿参数Nemotron 4。

相关阅读

📚 常见问题

Nemotron 3.5 Lightning部署是什么?

Nemotron 3.5 Lightning是英伟达2026年8月11日开源的大语言模型,总参数量300亿(30B),推理时仅激活约30亿(3B)参数。采用Mamba-2与Transformer混合架构+稀疏MoE(6/128专家路由),1M上下文窗口。单H200吞吐约为Qwen3-30B的3.3倍,支持Reasoni

如何上手Nemotron 3.5 Lightning部署?

Ollama本地部署大模型教程