Skip to content

nemotron_h_moe: Nemotron-3.5-Lightning loads and serves (no latent, a next-token block, hidden 2688) - #646

Merged
midagedev merged 4 commits into
mainfrom
lightning
Oct 22, 2026
Merged

midagedev merged 4 commits into
mainfrom
lightning

Conversation

@midagedev

Copy link
Copy Markdown
Owner

Refs #108.

What. NVIDIA-Nemotron-3.5-Lightning-30B-A3B (nemotron_h_moe, unsloth GGUF) now loads and serves on the nemotron seat. Before, the reader refused it, and the card load then refused hidden 2688 at Q8Act::with_k.

  • Reader: moe_latent_size is optional; the experts act on the hidden row when it is absent. The next-token block (blk.52) goes through the common nextn_layers. It is carried, not loaded.
  • Card body: it loads the trunk only. Each site's activation form comes from its weight type (SiteTy::reads). Lightning's Q8_0 dense sites read 32-value blocks at width 2688. A q8_1 (256-value) form is asked only of a layer whose launches read it. A width that no form takes is refused by name, with the site and the width.
  • The 128-expert, top-6 sigmoid router that Raon-1 and Lightning share moves from arch/raon1/ffn.rs to crate::route_body (check-arch: arch dirs do not use each other). Its entry names are unchanged.
  • Routed stacks (Q5_0/Q5_1 up, Q5_1/Q8_0 down) run on the host tier: --plan gives host_experts=2944 (22150840320 B). The card leg for these types is a separate track.

Evidence:

  • Mac: just mac-check 73 shapes, 0 red. just mac-test 1672 passed. After the rebase and the router move: mac-check (75 shapes, 0 red), mac-test, check-arch, check-model-tax, check-unsafe and check-comments are all rc 0.
  • Box: gate-gpu-nemotron-h-moe-e2e (fixture), gate-gpu-nemotron-h-moe-serve (fixture), gate-gpu-nemotron-e2e and gate-gpu-nemotron-serve (Nano 4B, real file), gate-nemotron-h-moe-meta, gate-nemotron-h-moe-host, gate-gpu-raon1-attn, gate-gpu-raon1-e2e, gate-gpu-raon1-dflash: all rc 0.
  • Served Lightning UD-Q4_K_XL with --place unset: the card-side load took 4.8 s. The English and Korean /v1/chat/completions both returned 200. The reasoning text is on topic; the Korean prompt is read correctly.

Not yet: just canon-check for the router move, the Bolt real-tier clauses of gate-gpu-nemotron-h-moe-e2e/-serve (after today's release batch), the landing batch, and a docs row with measured numbers.

Written by an AI round (minimax-m3.1-flash) and reviewed by the maintainer's lead session.

🤖 Generated with Claude Code

@github-actions github-actions Bot added gpu The card engine: crates/gpu*, crates/app model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card labels Oct 22, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MUST_FIX: the shared top_k is the largest over layers while each router keeps its own count, and the removed "key absent" gates have no dated PIN.

Must fix

1. Layer top-k and MoeShape.top_k can differ (kind A)

moe.rs:236 checks x.top_k == route.n_used() per layer. But MoeShape.top_k, the scratch sizes and every n_slots come from hp.top_k_max() (body.rs:348). The reader does not require equal top-k across layers (hparams.rs:256).
Input: a file with one 128-expert/top-6 layer and one 240-expert/top-9 layer. Both layers pass load. The 128-expert layer has ids and weights of 6 entries, but moe_layer runs gemv_sel and weighted_sum with 9 slots. The kernels read 3 entries past those buffers. The old constant TOP_K made this impossible.
Cost: a one-line check at load keeps the old global invariant.
Fix, in MoeLayer::load:

        if x.top_k != route.n_used() || route.n_used() != hp.top_k_max() || !hp.weights_norm {

2. Removed "key absent" refusals have no dated PIN (kind B)

hparams.rs:202 turns a missing expert_gating_func from a refusal into a default. The test case expert_gating_func is removed from the absent-key list, and a_missing_moe_latent_size_is_named (FAIL-first) is replaced (spec.rs:729). The old comment said "Required … refused, not defaulted". Contract: a removed gate or case needs a dated reason and evidence that the old rule was wrong.
Fix: add above the sigmoid_gating call, with the real facts filled in:

        // PIN(2026-10-22): `expert_gating_func` may be absent. Evidence: <the Lightning file's key list>.

The default is recorded in defaults; the PIN and the evidence are what is missing.

Non-blocking

⚠ No gate runs the new decode paths: moe.rs:447 (no latent, Shared::Site), the placed front copy, and the prefill Shared::Site arm. The listed gates use fixtures with a latent and IQ2_XXS shared experts. Mutant: moe_layer reads s.lat instead of t.buf.xn when latent_down is None. No listed assertion turns red. Direction: a hw_ fixture with no latent and a Q8_0 shared expert.

⚠ Duplicate refusal: body.rs:326 repeats the 256 check that Q8Act::alloc (tensor.rs:762) already makes. It only adds the layer index to the message. Dropping the block leaves fewer elements.

⚠ Coverage claims more than the body runs: coverage.rs:215 widens the shared-expert rule to ff % 32 for every shared type. An IQ2_XXS shared expert with ff not a multiple of 256 (3712 is one) is reported as runnable, then refused at load.

⚠ coverage.rs:1593 NEMOTRON_ROUTERS copies the (experts, top_k) rows that models::shape::ROUTERS and router.rs COUNTS already own. A new router width needs three edits.

Checked

  • Duplicates: 14 new items checked, hits above. Dryer: 0 pairs; crates/gpu is not searched, so I grepped by hand.
  • Complexity: moe_layer 27→41, MoeLayer::load 15→22, shadow 17→23, front 9→15: branches added to existing functions.
  • Silent failure: 6 sites followed. Only the gating default is a finding (2).
  • Tests: forms_of mutant n_card > 0 → >= 0 turns the first assert red.
  • Gates: pins moved, none dated (2). Escape catalog: none matched.

Notes

  • Router move: just canon-check is not run, and the ptx-scan result is not in the PR body.
  • No nvidia-smi line and no commit hashes in the PR body, so the box gate runs are not evidence per CONTRIBUTING.md. The "4.8 s card load" has no conditions.

Card check: needs-gpu. This pull request changes crates/gpu/src/arch/nemotron_h_moe/body.rs, crates/gpu/src/arch/nemotron_h_moe/moe.rs, crates/gpu/src/arch/nemotron_h_moe/placed.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the last review:

  • Earlier must-fix 1 fixed: moe.rs:239 rejects a router whose kept count differs from the pass's top-k.
  • Earlier must-fix 2 fixed: hparams.rs:186 and line 206 supply dated reasons for both absent-key changes.
  • Earlier decode-coverage concern remains open below. The carried duplicate refusal is reclassified as kind B.
  • Earlier shared-width coverage concern withdrawn: gguf::strict_tensors rejects an IQ2_XXS down tensor with an unaligned first dimension before coverage runs.
  • Earlier router-table concern withdrawn: NEMOTRON_ROUTERS selects this program's supported instances; ROUTERS also contains instances this body cannot run.

Verdict: MUST_FIX: the carried q8_1 width refusal duplicates an existing owner and has a mechanical deletion fix.

Must fix

1. Remove the duplicate q8_1 width refusal (kind B)

body.rs:323 repeats the exact predicate in tensor.rs:762. The following acts.add_q8_1 calls Q8Act::with_k or with_slots, which both call that allocation owner. Removing the copy leaves invalid widths refused and removes a second owner of the same bound.

Replace the loop at body.rs:317 with:

        for layer in &layers {
            if let Layer::Moe(m) = layer {
                for (k, cols) in m.forms(&hp) {
                    acts.add_q8_1(stream, k, cols)?;
                }
            }
        }

Non-blocking

⚠ Decode coverage still open: moe.rs:505 selects the no-latent input, and Shared::Site runs the Q8_0 shared expert. The listed Nemotron MoE fixtures exercise latent and IQ2_XXS paths. Add a fixture covering decode, placed execution and prefill without a latent and with Q8_0 shared experts. Reading s.lat instead of t.buf.xn when latent_down is absent must fail its assertions.

⚠ Protect the top-k refusal: moe.rs:239 adds the safety check without a regression test. Add a gate rejecting a model mixing 128/top-6 and 240/top-9 layers. Removing route.n_used() != hp.top_k_max() must make that assertion fail; the listed fixtures use top-9 layers throughout.

Checked

  • Duplicates: no new definitions in the interdiff; dryer reports no pairs and excludes GPU code. The carried width-check copy is confirmed by tracing its allocation path.
  • Complexity: only MoeLayer::load gains a condition in this interdiff; it extends an existing refusal. Other diagnostic growth belongs to unchanged patches.
  • Silent failure: static tracing shows mismatched top-k returns a named shape error before decode or prefill.
  • Tests: no tests added or changed in the interdiff. The two coverage gaps remain advisory; runtime tests were not run.
  • Gates: both dated PINs are present; no threshold changes in the interdiff.
  • Escape catalog: C1–C4 do not match the guard or PIN changes.

Notes

The PR body lacks canon-check or identical ptx-scan evidence for the router move, and the card/driver line, measured commit hashes and gate command output required for GPU evidence. gpu.json remains false.

Card check: needs-gpu. This pull request changes crates/gpu/src/arch/nemotron_h_moe/body.rs, crates/gpu/src/arch/nemotron_h_moe/moe.rs, crates/gpu/src/arch/nemotron_h_moe/placed.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

midagedev and others added 4 commits October 22, 2026 15:16
… next-token block, hidden 2688)

The reader takes moe_latent_size as optional and the next-token block through
the common nextn_layers; the card body loads the trunk only. Each site's
activation form comes from its weight type (SiteTy::reads): Lightning's Q8_0
dense sites read 32-value blocks at hidden 2688, and a q8_1 form is asked only
of a layer whose launches read it. A width no form takes is refused by name
with the site and the width. The routed Q5_0/Q5_1/Q8_0 stacks run on the host
tier.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… raon1 and nemotron_h_moe

Raon-1's and Nemotron-3.5-Lightning's routers are the same instance (128
experts, the top 6). Its entry names are unchanged, so the move changes no
PTX. raon1's ffn module goes back to private.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…k is refused; the two absent-key defaults carry their evidence

The slots, scratch and pass are sized for the most experts any layer keeps,
so a layer that keeps fewer is refused at load by name instead of reading
past its ids. An absent moe_latent_size (no latent) and an absent
expert_gating_func (the sigmoid router) are dated rules: Lightning's GGUF
carries neither key, and llama.cpp reads both that way (nemotron-h.cpp:29,
:64, :324 at cd0a5b6a1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rule on Hparams with a host test

- body.rs: the q8_1 forms' width is checked once, by Q8Act::alloc; the repeat is gone.
- Hparams::refuse_card_keeps owns the card pass's rule (each MoE layer keeps the largest top-k, renormalized);
  MoeLayer::load calls it with the router's count. The message is unchanged.
- spec.rs: a file whose MoE layers keep 1 and 2 experts refuses the layer that keeps 1; dropping the
  largest-top-k clause turns it red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the last review:

  • Must-fix 1 fixed: body.rs:317 delegates width validation to the allocation owner.
  • Decode coverage still open: moe.rs:496; see below.
  • Top-k regression coverage fixed: spec.rs:981 tests refusal of mixed top-k and acceptance of the largest top-k.

Verdict: CLEAN: the earlier must-fix is resolved, and the new commit preserves both load-time refusals.

Non-blocking

⚠ Decode coverage remains incomplete: moe.rs:496 selects the no-latent input; the fixture pins a latent at fixture.rs:4743 and IQ2_XXS shared experts at line 4677. Add a fixture covering decode, placed execution and prefill without a latent and with Q8_0 shared experts. Selecting s.lat instead of t.buf.xn must fail its assertions.

Checked

  • Duplicates: 2 new definitions checked, no duplicate owner found. Dryer reports zero pairs and excludes GPU code; the deleted width check remains enforced by Q8Act::alloc.
  • Complexity: Body::load loses a branch; MoeLayer::load delegates its existing refusal. Crapper's other flags (moe_layer, shadow, front, PassSizes::of, moe_card_experts, Hparams::read, spec_of, Prompt::new) belong to unchanged patches.
  • Silent failure: 2 new sites followed. The zero fallback reaches a named refusal; ignored fixture cleanup does not affect inference.
  • Tests: the new test protects hparams.rs:333. Dropping n_used == self.top_k_max() makes expect_err fail. Static comparison found equivalent old/new predicates across 200 boundary combinations; Rust tests were not run.
  • Gates: no bands or thresholds move in this interdiff. Invalid q8_1 widths still fail before allocation; router-count and renormalization refusals remain intact. Changes are load-time only.
  • Escape catalog: C1–C4 do not match.

Notes

The PR body supplies no FAIL-first output for the new test, canon-check or identical ptx-scan evidence for the router move, or card/driver line, measured commit hashes and gate command output required for GPU evidence. gpu.json records false.

Card check: needs-gpu. This pull request changes crates/gpu/src/arch/nemotron_h_moe/body.rs, crates/gpu/src/arch/nemotron_h_moe/moe.rs, crates/gpu/src/arch/nemotron_h_moe/placed.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.

Not approved: a release freeze is on (#648), and a merge of a needs-gpu change now would change the tree under the release batch.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@midagedev
midagedev merged commit 26ecf13 into main Oct 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gpu The card engine: crates/gpu*, crates/app model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant