[PR #5517] [Engine] qwen3next family: geometry-derived trunk + GDN grouped-head support (Groot lane byte-identical) #5492

Open
opened 2026-11-08 02:48:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5517
Author: @archadrian
Created: 11/7/2026
Status: 🔄 Open

Base: main ← Head: qwen3-next-family


📝 Commits (6)

  • b3494c0 [Engine] qwen3next family: enum + geometry factory + read_geometry prefix + CPU kernel constants derived from kCompiledGeometry (one build, one shape via STRATA_GEOMETRY_QWEN3NEXT)
  • 1fbe27c [Engine] qwen3next: fused GDN projections in the layout table (ssm_in/ssm_ba, widths derived from geometry) + dense-kernel names; parity load-check 0 failures
  • 80254f2 qwen3next: dense attention decode path (identity selection via qsa_dense_ids, indexer sites family-gated) + block-division guards across kv_plan/verify/prefill/snapshot; engine loads, session comes up on the 3090
  • 00c5763 qwen3next: Prefill/prompt path ported from qwen4exp literals to compiled-geometry-derived shapes
  • c02b10d qwen3next: plain-residual trunk (residual_streams, gr_plain_read, verify-window + Prefill plain paths) + GDN family traits (SiLU output gate, grouped->tiled head gather via gdn_tile_heads, fused ssm_in/ssm_ba split in decode/verify/prefill); engine builds and serves, forward still wrong
  • 1f07e7d qwen3next: GDN v-head retile VPV divisor + grouped-column y for ssm_out on ALL paths (verify fused/split, prefill fused/split, session fused) — end-to-end 'The capital of France is -> Paris.' now correct; debug instruments STRATA_DEBUG_GDN/LOGITS/RESID in verify.cpp

📊 Changes

56 files changed (+3733 additions, -383 deletions)

View changed files

➕ bench/results/.deferred-vii-leftover/README.md (+60 -0)
➕ bench/results/.deferred-vii-leftover/results.json (+928 -0)
➕ bench/results/2026-11-05-community-vii-qwen3-8-flash-next-iq3-s-vii/README.md (+60 -0)
➕ bench/results/2026-11-05-community-vii-qwen3-8-flash-next-iq3-s-vii/results.json (+928 -0)
➕ data/expert-profile-q3next.bin (+0 -0)
📝 include/strata/artifact/gguf_reader.hpp (+9 -4)
📝 include/strata/artifact/model_family.hpp (+9 -1)
📝 include/strata/core/family_layout.hpp (+22 -9)
📝 include/strata/core/geometry.hpp (+53 -1)
📝 include/strata/core/layer.hpp (+6 -1)
📝 include/strata/core/verify.hpp (+1 -0)
📝 include/strata/kernels/cpu/expert.hpp (+3 -3)
📝 include/strata/kernels/gr.hpp (+7 -0)
📝 include/strata/kernels/qsa.hpp (+5 -0)
📝 include/strata/platform/hip_compat/strata_hip.h (+2 -0)
📝 include/strata/prefill/kernels.hpp (+11 -0)
➕ serve-fn-gyro-abl.sh (+4 -0)
➕ serve-gcoder-pair.sh (+9 -0)
➕ serve-gcoder-single.sh (+6 -0)
➕ serve-gcoder.sh (+14 -0)

...and 36 more files

📄 Description

What this adds

Support for the qwen3next family (Qwen3-Next-80B-A3B: hybrid GDN linear-attention + full-attention MoE) in one build, one shape via STRATA_GEOMETRY_QWEN3NEXT.

  • Geometry-derived shapes replace the qwen4exp literals (CPU kernel constants come from kCompiledGeometry).
  • Plain-residual trunk (residual_streams, gr_plain_read) gated on has_hyper_connections() — HC families compile exactly as before.
  • GDN family traits: kGdnGroupedHeads (grouped→tiled head gather), SiLU output gate, fused ssm_in/ssm_ba split.
  • Dense-attention decode path via identity selection (qsa_dense_ids); indexer sites family-gated.

The two families bracket each other: qwen4exp = maximal (HC + PLE + indexer), qwen3next = minimal (plain residual, dense attention, grouped GDN heads). Every future family lands between.

Safety: Groot lane byte-identical

Pre-PR binary (main@146df3c4) vs this branch, same Groot run: 20/20 --window-hashes lines match (per-window residual hashes + argmaxes). The profile files are in data/; we ran it with our TQ2_T Groot pack (same one the merged native-expert work uses — happy to share it; any Groot model that runs on main works for this comparison). Reproduce:

strata --pack pack-groot-gyro --native Groot-65B-A6B-GyroM.gguf \
  --expert-profile data/expert-profile-coder.bin --expert-cache 12288 --expert-cache-per-layer \
  --prefill 512 --spec 4 --spec-min-p 0.5 --max-context 512 --kv k8v4 \
  --tokens-file prompt.ids --max-new 32 --window-hashes /tmp/wh.txt

Functional proof

Qwen3-Next-80B-A3B-GyroM (TQ2_T pack, same format as the merged native-expert work) runs end-to-end:

strata --pack pack-gyro-m --native Qwen3-Next-80B-A3B-GyroM.gguf \
  --expert-profile data/expert-profile-q3next.bin --expert-cache auto \
  --spec 4 --spec-min-p 0.5 --no-ple --prefill 512 --max-context 512 --kv k8v4 \
  --tokens-file prompt.ids --max-new 16
# prompt.ids = 785 6722 315 9625 374  ->  first token 12095 (" Paris")

(build with -DSTRATA_GEOMETRY_QWEN3NEXT; the pack is in the Files section below)

Verified layer-by-layer against an fp8 HF oracle (residual / router-input / attn-out / moe-out / GDN-state dumps all match). Serve smoke: ~105 tok/s decode on one 3090.

These are bring-up checks, not a benchmark suite — proper evals and multi-hardware numbers follow once engine support lands.

The pack is private for now: https://huggingface.co/BoxyFit/Qwen3-Next-80B-A3B-GyroM — happy to invite you for access so you can run the smoke test directly.

The one non-obvious invariant

ssm_out.weight ships with HF-grouped value-head columns while the recurrence runs tiled — so the GDN step writes y/y16 in grouped order on every path (verify fused/split, prefill fused/split, session fused). Groot's GGUF is natively tiled and takes the untouched path; that is what kGdnGroupedHeads gates. Two bugs hid here for a while: a v-head retile divisor (VPV must divide by HK, not qk_heads) and a missed split-path norm write in prefill. Debug instruments STRATA_DEBUG_GDN/LOGITS/RESID in verify.cpp are included — env-gated, zero cost when unset — they made the bisection mechanical and may be useful for the next family port.

Notes

  • Branch rebased onto main@146df3c4 (2026-11-07): upstream's manifest notes, group scratch, HC sizing, fused rms+rope and two-pass selection are all kept, with the geometry generalization applied on top.
  • 6 commits, one per layer of the port (geometry → layout table → dense attention → prefill → trunk/traits → head-layout fixes).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/5517 **Author:** [@archadrian](https://github.com/archadrian) **Created:** 11/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `qwen3-next-family` --- ### 📝 Commits (6) - [`b3494c0`](https://github.com/Niko1221/Strata/commit/b3494c01c42f88b3f6dfa390edd17408d60fcc4a) [Engine] qwen3next family: enum + geometry factory + read_geometry prefix + CPU kernel constants derived from kCompiledGeometry (one build, one shape via STRATA_GEOMETRY_QWEN3NEXT) - [`1fbe27c`](https://github.com/Niko1221/Strata/commit/1fbe27c200cc611f75a39e7549932630ad426770) [Engine] qwen3next: fused GDN projections in the layout table (ssm_in/ssm_ba, widths derived from geometry) + dense-kernel names; parity load-check 0 failures - [`80254f2`](https://github.com/Niko1221/Strata/commit/80254f24520b44d1c0da54c2a6e16d28d3e002c6) qwen3next: dense attention decode path (identity selection via qsa_dense_ids, indexer sites family-gated) + block-division guards across kv_plan/verify/prefill/snapshot; engine loads, session comes up on the 3090 - [`00c5763`](https://github.com/Niko1221/Strata/commit/00c5763b85f5fda301bff4c06986c8ed6d1f90d7) qwen3next: Prefill/prompt path ported from qwen4exp literals to compiled-geometry-derived shapes - [`c02b10d`](https://github.com/Niko1221/Strata/commit/c02b10d9619a7b563e43e30b94c78cd995c6e1e4) qwen3next: plain-residual trunk (residual_streams, gr_plain_read, verify-window + Prefill plain paths) + GDN family traits (SiLU output gate, grouped->tiled head gather via gdn_tile_heads, fused ssm_in/ssm_ba split in decode/verify/prefill); engine builds and serves, forward still wrong - [`1f07e7d`](https://github.com/Niko1221/Strata/commit/1f07e7d51a1555a35c2e3a26200f23553f9e50db) qwen3next: GDN v-head retile VPV divisor + grouped-column y for ssm_out on ALL paths (verify fused/split, prefill fused/split, session fused) — end-to-end 'The capital of France is -> Paris.' now correct; debug instruments STRATA_DEBUG_GDN/LOGITS/RESID in verify.cpp ### 📊 Changes **56 files changed** (+3733 additions, -383 deletions) <details> <summary>View changed files</summary> ➕ `bench/results/.deferred-vii-leftover/README.md` (+60 -0) ➕ `bench/results/.deferred-vii-leftover/results.json` (+928 -0) ➕ `bench/results/2026-11-05-community-vii-qwen3-8-flash-next-iq3-s-vii/README.md` (+60 -0) ➕ `bench/results/2026-11-05-community-vii-qwen3-8-flash-next-iq3-s-vii/results.json` (+928 -0) ➕ `data/expert-profile-q3next.bin` (+0 -0) 📝 `include/strata/artifact/gguf_reader.hpp` (+9 -4) 📝 `include/strata/artifact/model_family.hpp` (+9 -1) 📝 `include/strata/core/family_layout.hpp` (+22 -9) 📝 `include/strata/core/geometry.hpp` (+53 -1) 📝 `include/strata/core/layer.hpp` (+6 -1) 📝 `include/strata/core/verify.hpp` (+1 -0) 📝 `include/strata/kernels/cpu/expert.hpp` (+3 -3) 📝 `include/strata/kernels/gr.hpp` (+7 -0) 📝 `include/strata/kernels/qsa.hpp` (+5 -0) 📝 `include/strata/platform/hip_compat/strata_hip.h` (+2 -0) 📝 `include/strata/prefill/kernels.hpp` (+11 -0) ➕ `serve-fn-gyro-abl.sh` (+4 -0) ➕ `serve-gcoder-pair.sh` (+9 -0) ➕ `serve-gcoder-single.sh` (+6 -0) ➕ `serve-gcoder.sh` (+14 -0) _...and 36 more files_ </details> ### 📄 Description ## What this adds Support for the **qwen3next** family (Qwen3-Next-80B-A3B: hybrid GDN linear-attention + full-attention MoE) in one build, one shape via `STRATA_GEOMETRY_QWEN3NEXT`. - Geometry-derived shapes replace the qwen4exp literals (CPU kernel constants come from `kCompiledGeometry`). - Plain-residual trunk (`residual_streams`, `gr_plain_read`) gated on `has_hyper_connections()` — HC families compile exactly as before. - GDN family traits: `kGdnGroupedHeads` (grouped→tiled head gather), SiLU output gate, fused `ssm_in`/`ssm_ba` split. - Dense-attention decode path via identity selection (`qsa_dense_ids`); indexer sites family-gated. The two families bracket each other: qwen4exp = maximal (HC + PLE + indexer), qwen3next = minimal (plain residual, dense attention, grouped GDN heads). Every future family lands between. ## Safety: Groot lane byte-identical Pre-PR binary (`main@146df3c4`) vs this branch, same Groot run: **20/20 `--window-hashes` lines match** (per-window residual hashes + argmaxes). The profile files are in `data/`; we ran it with our TQ2_T Groot pack (same one the merged native-expert work uses — happy to share it; any Groot model that runs on main works for this comparison). Reproduce: ``` strata --pack pack-groot-gyro --native Groot-65B-A6B-GyroM.gguf \ --expert-profile data/expert-profile-coder.bin --expert-cache 12288 --expert-cache-per-layer \ --prefill 512 --spec 4 --spec-min-p 0.5 --max-context 512 --kv k8v4 \ --tokens-file prompt.ids --max-new 32 --window-hashes /tmp/wh.txt ``` ## Functional proof Qwen3-Next-80B-A3B-GyroM (TQ2_T pack, same format as the merged native-expert work) runs end-to-end: ``` strata --pack pack-gyro-m --native Qwen3-Next-80B-A3B-GyroM.gguf \ --expert-profile data/expert-profile-q3next.bin --expert-cache auto \ --spec 4 --spec-min-p 0.5 --no-ple --prefill 512 --max-context 512 --kv k8v4 \ --tokens-file prompt.ids --max-new 16 # prompt.ids = 785 6722 315 9625 374 -> first token 12095 (" Paris") ``` (build with `-DSTRATA_GEOMETRY_QWEN3NEXT`; the pack is in the Files section below) Verified layer-by-layer against an fp8 HF oracle (residual / router-input / attn-out / moe-out / GDN-state dumps all match). Serve smoke: ~105 tok/s decode on one 3090. *These are bring-up checks, not a benchmark suite — proper evals and multi-hardware numbers follow once engine support lands.* The pack is private for now: https://huggingface.co/BoxyFit/Qwen3-Next-80B-A3B-GyroM — happy to invite you for access so you can run the smoke test directly. ## The one non-obvious invariant `ssm_out.weight` ships with **HF-grouped** value-head columns while the recurrence runs **tiled** — so the GDN step writes `y`/`y16` in grouped order on every path (verify fused/split, prefill fused/split, session fused). Groot's GGUF is natively tiled and takes the untouched path; that is what `kGdnGroupedHeads` gates. Two bugs hid here for a while: a v-head retile divisor (`VPV` must divide by `HK`, not `qk_heads`) and a missed split-path norm write in prefill. Debug instruments `STRATA_DEBUG_GDN/LOGITS/RESID` in `verify.cpp` are included — env-gated, zero cost when unset — they made the bisection mechanical and may be useful for the next family port. ## Notes - Branch rebased onto `main@146df3c4` (2026-11-07): upstream's manifest notes, group scratch, HC sizing, fused rms+rope and two-pass selection are all kept, with the geometry generalization applied on top. - 6 commits, one per layer of the port (geometry → layout table → dense attention → prefill → trunk/traits → head-layout fixes). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5492
No description provided.