Repository navigation
Studio: support NVIDIA Nemotron 3.5 Bolt and Super GGUFs - #13899
Merged
Merged
Conversation
- offload layout: read nemotron_h / nemotron_h_moe per-layer head_count_kv and expert_used_count, charge KV only to attention layers and Mamba state to the recurrent ones (other archs unchanged) - context fit: leave the embedded NextN head out of the weights when MTP is not engaged; llama.cpp skips it without --spec-type draft-mtp (2987 MiB on Super) - compute width: use moe_latent_size for the routed expert term and read per-layer expert_used_count / expert_feed_forward_length as their max - drafter compute: floor DFlash/DSpark draft graphs at the measured 572 MiB
Recognise NVFP4 as a quant token so Super's NVFP4/ folder resolves to its weights, treat lilicorr-*.gguf as a drafter so Super's LiLiCorr/ file is not listed or loaded as a quant, and let Bolt's dspark-...-NVFP4.gguf pair with its weights on local loads. Add Nemotron 3.5 sampling defaults (temperature 1.0, top_p 0.95).
…rr drafter, mmproj)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The DFlash/DSpark floor was the whole measured draft + verify graph (572 MiB), but _MTP_DRAFT_COMPUTE_BYTES (224 MiB) is charged beside it, so Bolt with its LiLiCorr drafter was priced 224 MiB above llama.cpp. Floor at the excess over that reserve (349 MiB), which still covers the measured DSpark (572.5 MiB) and LiLiCorr (367.1 MiB) graphs.
danielhanchen
added a commit
that referenced
this pull request
Oct 15, 2026
…3909) With #13846 merged, main (d303bac) is still red in Backend CI and Repo tests, from three regressions that landed in the last few hours. Each is reproduced locally on main and fixed here. ## 1. `test_text_io_names_its_encoding[drafter.py]` (from #13806) ``` drafter.py:222: subprocess(text = True) without encoding ``` `core/training/drafter.py` runs the drafter capability probe in a child interpreter with `text = True` and no encoding, so the parent decodes the child's output with the locale codec (cp1252 on Windows, ASCII under a C locale). The guard is right and the code is what changes: the call now passes `encoding = "utf-8", errors = "replace"`, and the child gets `PYTHONIOENCODING=utf-8` so it writes what the parent reads. That matches how `core/training/worker.py` runs its own probes. The payload line is `json.dumps` output, so nothing parsed changes. ## 2. `test_backfill_splits_a_quant_suffix_the_way_the_backend_does` (from #13899) ``` AssertionError: MXFP ``` #13899 widened the GGUF known-quant pattern from `MXFP...` to `(?:MX|NV)FP...` so NVFP4 files get their own variant key. That change is right, and it was made consistently in all three places that must agree: `core/inference/llama_cpp.py` (`_GGUF_KNOWN_QUANT_RE`), `hub/utils/gguf.py` (`_GGUF_QUANT_RE`) and the frontend's `model-identity.ts` (`QUANT_TOKEN_SOURCE`). The test was checking that the literal substring `MXFP` appears in `llama_cpp.py`, which it no longer does. The test now checks the property it was standing in for: it reads the pattern string out of both Python modules with `ast` (adjacent literals joined as Python joins them) and the TypeScript constant, asserts all three are identical, and asserts the shared pattern still fully matches `MXFP4`, `NVFP4`, `IQ4_XS`, `TQ1_0`, `Q4_K_M`, `Q8_0`, `BF16`, `F16` and `F32`. That is stricter than before, since a pattern edited on one side only now fails, and it no longer breaks on a correct rewording. ## 3. `test_every_tracked_python_file_is_already_formatted` Formatter drift (pinned ruff 0.6.9 via `scripts/run_ruff_format.py`), output only, no logic change: | file | from | | --- | --- | | `studio/backend/core/inference/llama_cpp.py`, `offload_layout.py`, `tests/test_nemotron35_bolt_super.py`, `tests/test_nemotron35_planner.py` | #13899 | | `studio/backend/tests/test_muse_spark.py` | #13903 | | `tests/test_norm_fast_launch.py`, `unsloth/kernels/layernorm.py` | #13889 | | `tests/test_remote_code_class_and_expert_submodules.py`, `unsloth/models/_utils.py` | #13851 | | `tests/test_triton_fp_fusion.py` | #13846 | ## Verification - `tests/test_formatter_fixed_point.py` (ruff 0.6.9): fails on main, 16 passed here. - `tests/studio/test_model_picker_contracts.py` and `tests/test_runtime_text_encoding.py`: 210 passed. - `studio/backend/tests/test_text_io_encoding.py`, `test_nemotron35_bolt_super.py`, `test_drafter_training.py`: all pass except `test_capability_child_process_runs_for_real`, which fails identically on main without this change on this host (it runs the probe in a real child interpreter) and is not failing in CI. - Sabotage on the rewritten picker guard: dropping `NV` from the pattern in `hub/utils/gguf.py` only, or in `model-identity.ts` only, fails it; restored, it passes. - Sabotage for (1) is main itself: without the encoding, the guard fails as quoted above.
This was referenced Oct 16, 2026
danielhanchen
added a commit
to Etherll/unsloth
that referenced
this pull request
Oct 16, 2026
…nslothai#13957) Fixes unslothai#13926. ## Problem unslothai#13899 taught the quant regex `NVFP4`, so every file in the reporter's custom folder (`Qwen3.8-27B-NVFP4-MTP-HIGHEST.gguf`, `-LOW`, `-MEDIUM`, `-MID-HIGH`, `-MID-HIGH_enru`) now gets the key `NVFP4`. The lister keeps one file per key, so the picker shows a single `NVFP4` row that loads `-HIGHEST`, and the other four cannot be selected. Before unslothai#13899 each file was its own row. Differently named builds at standard quants in custom folders already collapsed the same way, for example `Llama-3-8B-Instruct-Q4_K_M.gguf` beside `Llama-3-8B-abliterated-Q4_K_M.gguf`. ## Fix Outside the HF cache, `list_local_gguf_variants` now keys files with `gguf_variant_keys_by_checkpoint`, which deletion already uses to tell builds that share a quant apart. - The first build keeps the bare quant key, so existing selections still open the same file. Each other build is keyed by its file stem, which the loader already accepts. - Each build is labelled with its file name, for example `NVFP4 · Qwen3.8-27B-NVFP4-MTP-HIGHEST`. - `/gguf-variants` now returns the chosen row's own key as `default_variant`, instead of deriving it again from the filename. Without this, a folder with a torn `a-Q4_K_M-00001-of-00002.gguf` and a whole `z-Q4_K_M.gguf` would default to `Q4_K_M`, the torn build. HF cache snapshots still list one build per quant (unslothai#13327), because their keys must match the remote listing and are stored in download manifests and pins. `gguf_variant_key` is unchanged. ## Verification Studio before and after the change, with a custom folder holding the issue's five filenames (copies of a small real GGUF): | | main | this PR | |---|---|---| | Picker, custom folder row | one `NVFP4` row | five `NVFP4 · <build>` rows, all "downloaded" | | Loading each listed key | only `-HIGHEST` reachable | each key started llama-server on its own file | The new tests fail on main and pass with the change. Five existing tests for HF snapshots now build their snapshot under an HF cache path instead of a plain temp directory; their assertions are unchanged. Across 108 GGUF-related backend test files, 8877 passed. One timing test unrelated to GGUF listing failed (`test_tunnel_safe_long_post.py`), and it passes when its file runs alone. ## Before / after A custom LM Studio-style folder holding five copies of a small GGUF under the issue's filenames (`Qwen3.8-27B-NVFP4-MTP-HIGHEST/LOW/MEDIUM/MID-HIGH/MID-HIGH_enru.gguf`), Studio built at the merge base and at this branch. The quant menu goes from one `NVFP4` row to five `NVFP4 · Qwen3.8-27B-NVFP4-MTP-<build>` rows (the menu truncates the build name; `/api/models/gguf-variants` returns the full labels). Loading each listed key started llama-server on that key's own file; before, only `-HIGHEST` was reachable.  --------- Co-authored-by: mahiatlinux <[email protected]> Co-authored-by: carlitogwapito <[email protected]> Co-authored-by: Daniel Han <[email protected]>
danielhanchen
added a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 25, 2026
…s NVFP4 (unslothai#14733) ## Problem unslothai#13899 made `NVFP4` a quant token (`(?:MX|NV)FP[0-9]+`) so the Nemotron 3.5 Super `NVFP4/` folder resolves to its weights. The token is matched anywhere in the name, so in community repos whose model name contains `-NVFP4-` it became the first quant token of every file and every file got the variant key `NVFP4`. The picker keeps one row per key, so all but one build became unselectable, and `...-NVFP4-Experts-Only-Q8_0.gguf` was keyed `NVFP4` instead of `Q8_0`. Rows in the HF picker (real Hub listings): | Repo | Files | Before unslothai#13899 | main | This PR | |---|---|---|---|---| | esatapedico/Qwen3.8-27B-NVFP4-MTP-GGUF | 9 | 9 | 1 | 9 | | michaelw9999/Qwen3.6-35B-A3B-NVFP4-MTP-GGUF | 2 | 2 | 1 | 2 | | llmfan46/Qwen3.6-35B-A3B-uncensored-heretic-NVFP4-Experts-Only-GGUF | 2 | 2 | 1 | 2 | | utautako/Qwen3.8-27B-NVFP4-MTP-Q8attn-GGUF | 2 | 2 | 1 | 2 | | CompiledThoughts/Qwen3.8-Flash-Next-NVFP4-Q8_0 | 1 | 1 (`Q8_0`) | 1 (`NVFP4`) | 1 (`Q8_0`) | ## Change `NVFP` now names the quant only where llama.cpp naming puts the type: last in the name, with only a bpw modifier, a shard suffix or the extension after it (`Model-NVFP4.gguf`, `NVFP4/Model-NVFP4-00001-of-00003.gguf`, `Model-UD-NVFP4.gguf`, `Model-NVFP4_MOE.gguf`, a stored `NVFP4` key). An `NVFP` followed by more name parts is part of the model name, so those files get exactly the keys they had before unslothai#13899 (the stem, or `Q8_0` where a later token names the quant). The rule is a lookahead on the `NVFP` alternative, applied to every copy of the quant regex so the picker, download plans, size listing, load resolution and the frontend label agree: `utils/gguf_names.py` (`GGUF_QUANT_RE`, the shared pattern that `hub/utils/gguf.py`, `core/inference/llama_cpp.py` and `utils/models/model_config.py` now import), `_extract_quant_label` in `utils/models/model_config.py`, `hub/services/models/gguf_variants.py`, and `model-identity.ts`. `MXFP` is unchanged: it was a token before unslothai#13899 and still matches anywhere, so keys stored for MXFP repos (`MXFP4`, `MXFP4_MOE`, `...-MXFP4-BF16`) keep resolving. ## Tests - New `tests/test_gguf_nvfp4_model_name_variants.py` (49 tests): row counts and keys for the five listings above, each key resolving to exactly its own file in `_resolve_variant_gguf_files` and in `build_gguf_variant_plans`, all regex mirrors agreeing, plus unsloth-style names (`NVFP4/` shards, `-NVFP4.gguf`, `-MXFP4_MOE`, `UD-MXFP4_MOE`, bpw suffix) and NVFP4-suffixed drafters. On main 29 fail (the 20 unsloth-style and drafter cases pass on both); on this branch all 49 pass. - New `frontend/tests/gguf-nvfp4-quant-label.test.ts` (2 tests): 1 fails on main, both pass here. `model-identity.test.ts` and `audio-loaded-quant-key.test.ts` pass. - Related backend GGUF suites (variant rows, bpw rows, split builds, delete keeps sibling builds, local resolution, dependency keys, resolve quant, Nemotron 3.5, MTP drafter, imatrix, routing, preflight, offline cache, LTX-2.5, cached routes, companions, cache switch): 1238 passed, 12 failed, 2 skipped on this branch. The 12 failures are the same test ids on main (8 in `test_mtp_drafter_companion.py` need the `gguf` package, 2 in `test_cached_gguf_routes.py`, 2 in `test_video_ltx25_gguf.py`) and are unrelated. - `test_a_custom_folder_lists_every_build_at_one_quant` (unslothai#13957) used these Qwen3.8 NVFP4-MTP names as its shared-quant fixture and pinned the first build to the `NVFP4` key. It now uses names that end in `-NVFP4`, so it still covers a custom folder splitting builds at one NVFP4 quant, and passes on main and here; the real Qwen3.8 names in a custom folder are covered by a new test that lists each build under its own name. ## Not covered - Two different model stems that both end in `-NVFP4` in one HF repo still share the `NVFP4` row, the same as two stems at `Q4_K_M` today: remote and HF cache listings keep one key per quant by design, and only custom folders split such builds. - A key saved on main for one of the affected repos (`NVFP4`) no longer names a file there. For a Hub repo it was already ambiguous, since it picked one build out of all of them. For a custom folder (unslothai#13957) it named the first build, so that saved selection has to be picked again. Keys saved before unslothai#13899 load as they did then. - The frontend `chat-adapter.ts` regex never learned `NVFP` and is untouched. ## Before / after Model Hub picker for `esatapedico/Qwen3.8-27B-NVFP4-MTP-GGUF`, merge base `c9fab474c` vs head `47e9858b9`, two isolated Studio installs. Before: one `NVFP4` row (16 GB) for the nine builds. After: nine rows, one per build, each at its own size (ORIG 34 GB down to VERY-LOW 16 GB). The variants API agrees: 1 row -> 9 rows.  --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Studio support for the NVIDIA Nemotron 3.5 Bolt and Super GGUFs: unsloth/NVIDIA-Nemotron-3.5-Bolt-74B-A9B-GGUF and unsloth/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-GGUF. Both are
nemotron_h_moe(hybrid Mamba2 + a few attention layers + latent MoE), supported in llama.cpp by ggml-org/llama.cpp#30520.Variant picker and drafters
NVFP4is a quant token. OnlyMXFP*was known, so Super'sNVFP4variant resolved toLiLiCorr/lilicorr-...-NVFP4.gguf, a 1.3 GB drafter, and loaded it as the main model. The quant regex now accepts(?:MX|NV)FP[0-9]+in all of its copies (backend andmodel-identity.ts).lilicorr-*.ggufis a drafter kind. Super's LiLiCorr drafter was listed as a selectable quant. Super uses its embedded MTP head, which measured faster, so LiLiCorr is now excluded from variant menus and quant lookups and is never launched. Added to_DRAFTER_KINDSin its three mirrors.dspark-<model>-NVFP4.gguf/dflash-<model>-NVFP4.ggufkept-nvfp4in the pairing stem, so a local folder load attached no drafter. Bolt ships its LiLiCorr drafter asdflash-NVIDIA-Nemotron-3.5-Bolt-74B-A9B-NVFP4.gguf(GGUF architecturedflash).With this, Auto mode launches:
--spec-type draft-mtp, no--model-draftdflash-...gguf)--model-draft dflash-... --spec-type draft-dflashSampling defaults
New
nemotron-3.5family ininference_defaults.json: temperature 1.0, top_p 0.95 (NVIDIA's recommendation for both models). It matches every id shape (repo,repo:quant, cache snapshot path, local.gguf) and sits beforenemotron, so older Nemotrons keep 1.0 / 1.0.Memory planner
Measured against llama-server allocations for Bolt IQ2_XXS and Super UD-IQ2_XXS, the default path was safe but mis-priced the fixed costs:
--spec-type draft-mtp, so Super got a much shorter auto context on tight cards. It is now excluded unless MTP is engaged (nemotron_h_moeonly, the arch measured).moe_latent_sizewhen present, and per-layerexpert_used_count/expert_feed_forward_lengtharrays are read as their max (Bolt stores them per layer; they were read as missing).draft-dflashat full context (measured 26.4 GiB peak, 0.917 acceptance).UNSLOTH_SMART_OFFLOAD=1): per-layerhead_count_kvraised aTypeError, and would otherwise have counted every layer as attention with no recurrent state. KV is now charged to the attention layers only and Mamba state to the recurrent ones, fornemotron_h/nemotron_h_moeonly. Bolt's layout now matches the measured resident size exactly.Every component now estimates at or above the measured allocation. Other architectures are unchanged; the new tests pin that for a hybrid with
full_attention_intervaland for a dense model.Tests
tests/test_nemotron35_bolt_super.pyandtests/test_nemotron35_planner.py: 39 tests, all pass. Onmain13 of the picker/sampling tests fail, as expected.mainand on this branch, all pre-existing (diffusion offload, training offload layers, one TTS test).Not covered
gguf==0.19.0cannot read theQ2_0type that Super UD-IQ1_M through UD-Q3_K_XL use. Only the opt-in smart-offload layout reads tensor types this way; the default path sizes from offsets and is unaffected.