Skip to content

Instantly share code, notes, and snippets.

@felix021
Last active August 12, 2026 06:44
Show Gist options
  • Select an option

  • Save felix021/ca808d078264356926a6f5aeddc03dfa to your computer and use it in GitHub Desktop.

Select an option

Save felix021/ca808d078264356926a6f5aeddc03dfa to your computer and use it in GitHub Desktop.
RTX 5060 Ti 16GB 部署 Nemotron-3.5-Lightning-30B-A3B 实践笔记(Q4_K_M + llama.cpp master,含与 Qwen3.6 对比)

RTX 5060 Ti 16GB 部署 Nemotron-3.5-Lightning-30B-A3B 实践笔记(Q4_K_M + llama.cpp,含与 Qwen3.6 对比)

TL;DR — 能达到什么效果

  • 单卡 RTX 5060 Ti 16GB + 32GB RAM,用 llama.cpp 混合 GPU/CPU offload 跑起 NVIDIA Nemotron-3.5-Lightning-30B-A3B(Q4_K_M, 22.5GB)
  • 速度(llama-bench 标准方法 pp8192/tg128):prefill ~1466 tok/s, decode ~58 tok/s
  • 编码(LiveCodeBench v6,30 题):pass@1 0.333
  • 100K context 可行(moe 26 + q4_0 KV,VRAM 14.6GB)——Mamba2 架构 KV 增长慢
  • 对比 Qwen3.6-35B-A3B IQ4_XS:Nemotron prefill 慢 18%、decode 慢 5%,编码 pass@1 0.333 vs 0.433。同为 3B 激活 MoE,差距不大
  • 前提:模型 2026-08-11 刚发,llama.cpp 必须升级到 master(b9441 不认架构)

文件来源

  • GGUF:ggml-org/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-GGUF,最小 Q4_K_M 22.5GB(官方无 IQ 小量化版)
  • 国内加速:hf-mirror.com 直连约 10 MiB/s(别走 proxy,只有 1.4 MiB/s)
  • 为什么不用 NVFP4:官方 NVFP4 是原始格式(非 GGUF),要 SGLang/vLLM;但消费级 Blackwell(sm_120)上 flashinfer prebuilt 缺、MLA prefill 有已知 bug,跑不通。llama.cpp 又只认 GGUF,所以用 Q4_K_M

部署

1. 升级 llama.cpp 到 master(关键,b9441 不行)

b9441 加载报 wrong number of tensors; expected 417, got 408——差的 9 个是 MTP(多 token 预测)head,b9441 不认。必须升级 master:

cd vendor/llama.cpp
git fetch origin master --depth=1
git checkout --detach FETCH_HEAD
# 关键:用 CUDA 12.8 的 nvcc(PATH 里可能是旧 12.0,编 sm_120a 会报 unsupported)
cmake -S . -B build-cuda-main -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.8/bin/nvcc \
  -DGGML_CUDA=ON -DGGML_CUDA_ARCHS=120 -DGGML_NATIVE=ON -DLLAMA_CURL=ON
cmake --build build-cuda-main --target llama-server llama-bench -j 6

master 会把 MTP head 当 unused tensor 忽略(日志 warning:blk.52.nextn.* ... ignoring),主模型正常加载。

2. 下载 GGUF

aria2c -x16 -s16 --all-proxy="" \
  -d models -o NVIDIA-Nemotron-3.5-Lightning-30B-A3B-Q4_K_M.gguf \
  "https://hf-mirror.com/ggml-org/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-GGUF/resolve/main/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-Q4_K_M.gguf"

3. 启动(最优配置,实测调出)

build-cuda-main/bin/llama-server \
  -m models/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-Q4_K_M.gguf \
  --host 0.0.0.0 --port 18080 -fa on -ngl 99 --n-cpu-moe 22 -ub 1536 \
  -c 16384 -t 6 --cache-type-k q4_0 --cache-type-v q4_0 \
  --parallel 1 --jinja --reasoning off

几个参数的坑(都踩过):

  • --n-cpu-moe 22层数,不是专家数("前 22 层的 MoE 放 CPU")。扫描 20/21/22/24/26 后 22 最优。moe 20 OOM,21 边界 decode 不稳(±11)。
  • -ub 1536:比 1152 prefill 快 22%(1466 vs 1196 tok/s)。
  • 默认 mmap(不加 --no-mmap):和 no-mmap 同速,但省 RAM 不易 OOM。22.5GB 模型别用 no-mmap。
  • --reasoning off:LCB 代码生成上 off 最优(见下"reasoning"段)。

性能数据(RTX 5060 Ti, master, moe 22 ub 1536)

llama-bench pp8192 / tg128:

prefill decode VRAM
Nemotron moe22 ub1536 1466 tok/s 58 tok/s ~14 GB

LiveCodeBench v6(30 题, reasoning off):pass@1 0.333 (10/30),avg 15.7 s/题。

几个调优发现

  • --n-cpu-moe 是层数,扫描 20-26:22 最优(prefill 1466/decode 58),21 边界不稳,20 OOM。
  • ub 1536 > 1152:prefill +22%,decode 持平。
  • mmap ≈ no-mmap:速度相同(pp 1438 vs 1466),mmap 省 RAM。Nemotron 用默认 mmap。
  • reasoning off vs on:LCB 上 off 最优(pass@1 0.333)。on 时 thinking 占 token——严格 max_tokens(2048) 下 pass@1 反降到 0.1(thinking 挤掉 code);放开 max_tokens(8192) 后恢复到 0.3,还略超 off 的 0.2,但慢 7.7×(130 s/题、6500 tokens)。代码生成 off 性价比高,复杂数学/多步推理任务 thinking 才值。
  • 100K context-c 102400 --n-cpu-moe 26 --cache-type-k q4_0 可行,VRAM 14.6 GB,prefill 1321/decode 53。Nemotron 只有 6 个 GQA attention 层 + 23 个 Mamba2(SSM state 固定,不随 ctx 增长),100K 的 KV 只比 16K 多 360 MB。100K 需退 moe 26——不是 KV 大,是 server 的 compute buffer(1.6GB) 把 moe 22 挤出(moe 22 server 连 16K 都 OOM,只能 8K)。
  • q4_0 KV 在 16K/100K + master 都稳定——早期报告"必崩"是旧版本误判。

和 Qwen3.6-35B-A3B 对比

同机、llama-bench 标准方法(pp8192/tg128)+ LiveCodeBench 30 题:

Qwen3.6 IQ4_XS Nemotron Q4_K_M
模型体积 18 GB 22.5 GB
moe / ub 14 / 1536 22 / 1536
prefill 1736 tok/s 1466 tok/s
decode 62 tok/s 58 tok/s
LCB pass@1 (30题) 0.433 0.333
100K ctx 能(moe 14,VRAM 余量大) 能(moe 26,VRAM 14.6GB)

Qwen prefill 快 18%、decode 快 5%、编码 pass@1 高。差距比想象小——Nemotron 作为 8/11 刚发的新模型,速度其实接近。

两个方法论提醒

  • 别用 bench_speed.py 这种小 prompt(~1.8K) + HTTP 的方法对比,会测出 Qwen 1096 / Nemotron 833(夸大差距到 30%)。llama-bench pp8192 直接测才准。
  • Qwen 的 "1900 prefill" 是 moe 12 的极端值,prod 配置(moe 14)实际 1736。

结论 / 建议

  • 单卡 16GB 跑 30B MoE 新模型,llama.cpp master + --n-cpu-moe层数!)+ -ub 1536 + 默认 mmap 是最优路径
  • Nemotron 速度接近 Qwen(慢 ~15%),100K 长上下文是亮点(Mamba2 架构 KV 增长慢,16GB 卡能开 100K)
  • 生产服务暂时选 Qwen(成熟 + 快 + 编码强);Nemotron 适合尝鲜 / 长上下文场景
  • NVFP4 在消费 Blackwell 还不实用,等 flashinfer / sm_120 生态成熟

参考链接

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment