mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2740] [CLOSED] Add a Nemotron-H MoE engine path (Nemotron 3.5 Super VL 120B-A12B) #4237
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4237
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2740
Author: @Rhonstin
Created: 10/16/2026
Status: ❌ Closed
Base:
main← Head:nemotron-h📝 Commits (1)
7162166Add a Nemotron-H MoE engine path (Nemotron 3.5 Super VL 120B-A12B)📊 Changes
22 files changed (+3894 additions, -18 deletions)
View changed files
📝
CMakeLists.txt(+21 -0)➕
docs/NEMOTRON_H.md(+148 -0)📝
include/strata/artifact/model_family.hpp(+10 -3)📝
include/strata/kernels/iq_kernels.hpp(+9 -0)➕
include/strata/nemotron_h/cpu_experts.hpp(+50 -0)➕
include/strata/nemotron_h/engine.hpp(+11 -0)📝
serve/server.py(+41 -7)📝
serve/test_family_name.py(+2 -1)➕
serve/test_nemotron_serve.py(+59 -0)📝
src/kernels/cuda/iq_kernels.cu(+104 -0)➕
src/nemotron_h/nh_cpu.cpp(+207 -0)➕
src/nemotron_h/nh_cpu_bench.cpp(+91 -0)➕
src/nemotron_h/nh_cpu_test.cpp(+118 -0)➕
src/nemotron_h/nh_engine.cu(+2134 -0)➕
src/nemotron_h/nh_kernels.cuh(+531 -0)➕
src/nemotron_h/nh_main.cpp(+5 -0)📝
src/program/generate.cpp(+14 -2)➕
tools/nemotron_h/nh_llama_dump.cpp(+168 -0)➕
tools/nemotron_h/parity.py(+135 -0)➕
tools/nemotron_h/parity_prompts.json(+7 -0)...and 2 more files
📄 Description
What this adds
An engine path for NVIDIA Nemotron 3.5 Super VL 120B-A12B (unsloth's GGUFs, architecture
nemotron_h_moe):src/nemotron_h, whichstrataswitches to from the file's architecture the same way it switches to Qwen3.6's path, plus a standalonestrata-nh. Text, images (GENI) and the GGUF's MTP block.blk.88) for drafts.--hybrid-rowsrows splits resident experts (GPU) and the rest (CPU, ggml-cpuvec_dot); bigger prompt chunks stream non-resident experts through a VRAM ring into per-expert FP16 GEMMs.cudaHostRegister, falls back tocudaHostAlloc, then to the mapped file), an expert profile (--expert-profile/--expert-profile-save), the adaptive tier, the PCIe share of misses (--pcie-frac) and next-layer prefetch (--prefetch) — both opt-in —, and turn checkpoints of the recurrent state (a regenerated / edited last answer reads only the rest of its prompt).native_expert_grouped_relu2/native_expert_layout_ungatediniq_kernels.cu— new, opt-in functions; the gated path is not touched.tekkenpre-tokenizer withignore_mergesintools/strata_tokenizer.py;serve/server.pyreadsprefrom the pack'stokenizer.json, keeps a stop marker only when it is one token (this vocabulary has no<|endoftext|>, whose pieces would have stopped every reply at<), writes<img> <image>×n </img>for this model's pictures, and knows the family name.PROJECTOR_TYPE_NEMOTRON_OMNI, upstream since PR #30520).tools/nemotron_h/nh_llama_dump.cpp(llama.cpp side,-cmoe, sublayer dumps) +parity.py;nh_cpu_test,nh_cpu_bench;serve/test_nemotron_serve.py.docs/NEMOTRON_H.md.What it leaves alone
Flash-Next's and Qwen3.6's engine paths and defaults. The reader's 64-entry array cap is not changed (this path takes the sublayer kinds from the tensors present). Qwen tokenization (
qwen35stays the defaultpre). The new CMake targets build only withSTRATA_NATIVE_EXPERTSand not on HIP.Tests
Measured on one PC: RTX 3090 24 GB, i7-7800X (6 cores, AVX-512), 95 GiB DDR4-2133,
UD-Q4_K_XL; llama.cpp 0.7.0 (620d2225c) as the reference.tools/nemotron_h/parity.py, teacher-forced): 5 chat prompts × 32 steps — first token matched 5/5; answers only (122 steps up to<|im_end|>): mean KL 0.00106, median 1.5e-5, top-1 0.992. Final build (arena + profile, 2 chat prompts + a 981-token one): answers-only KL 0.00124, top-1 0.984. With the PCIe share 0.6 + prefetch 16 (82% of routed entries on the GPU): KL 0.00279, top-1 0.979.--mtp 0there.nh_cpu_test, all 41 MoE layers, Q4_K/Q5_K/Q6_K/Q8_0 × Q5_0/IQ4_NL/Q8_0): worst relative error 1.2% (activation rounding).tokenizerson the model'stokenizer.json: 23 strings (chat markers, tool-call XML, Cyrillic, CJK, emoji, combining marks) identical; round trip 16/16.serve/server.py --engine strata): plain answer, thinking withreasoning_contentsplit, a tool call (get_weather {"city":"Kyiv"},finish_reason: tool_calls), an image (shapes, colours and text described correctly; 300 image tokens, 59 ms on the GPU encoder), streaming, a second turn reusing the first (45 cached tokens), a regenerated answer restoring its turn checkpoint (prompt 88 ms instead of 2011 ms, same text).serve.test_server314/314;serve.test_family_name,serve.test_nemotron_serve,serve.test_images,serve.test_vision_busy,serve.test_detok,serve.test_reasoning_tools,serve.test_parser_track63 OK (5 skipped);tools/test_setup_choices.pyOK.strata-nh --bench-pp 2048 --bench-tg 32): prompt 337–350 tok/s, decode 12.2–13.1 tok/s; through the server 246 tok/s prompt (2795 tokens), 11.2 tok/s decode. 2 MiB arena pages vs 4 KiB: decode 11.75 vs 9.16 tok/s at equal slots; profile on a held-out prompt: 13.48 vs 11.83 tok/s (VRAM share 34% vs 16%).strata,strata-nh,nh_cpu_test,nh_cpu_bench,strata-visionagainst llama.cpp 0.7.0).Not tested / not done
HIP and SYCL builds (
iq_kernels.cu's new functions follow the file's HIP conventions but were not compiled for HIP); other GPUs and CPUs; MMQ for the prompt's experts; video input; a setup entry. A server left running for several hours stopped once; the cause was not investigated yet.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.