Repository navigation
Add exact Grok, GroveMoE, and Hunyuan-MoE GGUF graphs - #685
Merged
Merged
Conversation
Performance Comparison
|
Implement exact float-import graphs for Grok, GroveMoE, and Hunyuan-MoE, including pinned metadata defaults, suffix-closed tensor mappings, packed expert expansion, architecture-specific routing and normalization, and fail-closed quantized/runtime capability verdicts. Add executable synthetic parity, end-to-end GGUF builds, architecture fingerprint isolation, immutable artifact evidence, model coverage, and regenerated registry census documentation. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Use an approximate assertion for the pinned floating-point softcap default so the final lint gate remains clean. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds float-importable GGUF graph support for three previously-deferred MoE architectures (grok, grovemoe, hunyuan-moe) by introducing dedicated model implementations, GGUF config/tensor mapping, and strict validation + synthetic parity tests, and wiring everything into the GGUF architecture registry and docs.
Changes:
- Implement Grok/GroveMoE/Hunyuan-MoE GGUF-specific model graphs (incl. Grok scaling/softcaps/sandwich norms, GroveMoE dual-bank routing, Hunyuan post-RoPE Q/K norm).
- Add GGUF tensor mapping recipes + new “remaining MoE” tensor-contract validator and comprehensive synthetic GGUF build/parity tests.
- Register new model/config types across the core registry, GGUF arch registry, route census, and public GGUF docs.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/synthetic_parity_test.py | Skips HF synthetic parity for new GGUF-only model types. |
| tests/_test_configs.py | Adds tiny test configs for grok_gguf, grovemoe_gguf, hunyuan_moe_gguf. |
| src/mobius/models/moe.py | Adds Grok/GroveMoE/Hunyuan-MoE GGUF graph implementations and attention variant. |
| src/mobius/models/init.py | Exports the new GGUF causal LM model classes. |
| src/mobius/integrations/gguf/_tensor_mapping.py | Adds stem mappings + suffix allowlists for the three new GGUF architectures. |
| src/mobius/integrations/gguf/_route_census_test.py | Updates pinned route-category counts. |
| src/mobius/integrations/gguf/_remaining_moe.py | New: validates exact tensor/metadata closure for Grok/GroveMoE/Hunyuan-MoE. |
| src/mobius/integrations/gguf/_remaining_moe_test.py | New: contract + synthetic end-to-end GGUF build/execution/parity tests. |
| src/mobius/integrations/gguf/_config_mapping.py | Adds config postprocessors for Grok/GroveMoE/Hunyuan-MoE and YaRN beta_fast rule. |
| src/mobius/integrations/gguf/_builder.py | Hooks remaining-MoE validation; adjusts config fingerprint field filtering; supports chunk expert unpacking. |
| src/mobius/integrations/gguf/_builder_test.py | Removes grok/grovemoe from a list expecting pre-graph failures. |
| src/mobius/integrations/gguf/_arch_registry.py | Promotes grok/grovemoe/hunyuan-moe to graph-importable (runtime still deferred; quantized import rejected). |
| src/mobius/integrations/gguf/_arch_registry_test.py | Updates supported-count pins and registry invariants for new architectures. |
| src/mobius/_registry.py | Adds fallback registrations for the new GGUF model types. |
| src/mobius/_configs/_base.py | Adds GrokGGUFConfig and GroveMoEGGUFConfig. |
| src/mobius/_configs/init.py | Re-exports the new GGUF config classes. |
| docs/api/build_from_gguf.md | Updates the support matrix / census numbers and route listings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Document why the three GGUF-only registry keys use dedicated metadata, graph, and synthetic parity coverage instead of native Hugging Face L2 model IDs. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
justinchuby
force-pushed
the
justinchuby-add-remaining-moe-gguf-graphs
branch
from
August 28, 2026 06:26
12d95ec to
460fa59
Compare
Restore the architecture-owned RMSNorm epsilon when Grok metadata also carries LayerNorm epsilon, and accept the pinned loader’s valid ungated dense up/down pair while preserving uniform topology checks. Preserve optional base-model outputs in the Grok wrapper and leave mapped auxiliary sidecars to the existing fail-closed quantization preflight, with discriminating execution and regression coverage. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
justinchuby
added a commit
that referenced
this pull request
Aug 28, 2026
## Summary - add exact explicit-float MiniMax-M2 import with non-square Q/O geometry, full-vector Q/K RMSNorm, partial NeoX RoPE, F32 correction-biased sigmoid routing, and dynamic/static KV coverage - add Mistral4 as its pinned DeepSeek-V2 MLA/MoE architecture, including a dedicated latent K-only cache and metadata-owned YaRN scaling; correct the vendored llama.cpp census that previously mislabeled it as Mistral3 - complete GLM-DSA tensor routing and split K/V-B transforms while preserving the dedicated DSA cache contract and fail-closed MTP boundary - promote all three graph routes in the registry/census and regenerate the GGUF support documentation This includes and supersedes the draft GLM-only work in #682. ## Post-review fixes - canonicalize `glm_dsa` aliases for validation/task/package dispatch while retaining the raw alias prefix for metadata reads; the alias-spelled GGUF proves the exact mixed full/shared indexer schedule, dedicated default task, complete indexer initializer materialization, and executable dense-MLA logits - consume Mistral4's serialized `rope.scaling.yarn_log_multiplier` through `yarn_apply_mscale`; an independent metadata oracle pins `0.0707`, factor `4`, qk dim `4` to `0.6028141`, and mutation to `0.1` discriminates the result - fail closed during Mistral4 config extraction unless the multiplier is a non-boolean finite number in the inclusive semantic range `[0.0, 0.1]`; the wire endpoint is `float(np.float32(0.1))`, used for both validation and normalization - reject NaN, `+inf`, `-inf`, negative values, and the immediate float32 successor above `0.1`; real `GGUFWriter`/`GGUFModel` round trips accept both endpoints and prove finite attention scale and rotary caches before graph execution - call the immediate Mistral4 superclass initializer and force `GlmMoeDsaTask()` when callers omit `task` - reply to and resolve both GitHub review threads ## Evidence and capability boundaries Pinned semantic source: `ggml-org/llama.cpp@8d9af256337d1a501250f9bbf4c0859a654bddd6`. All three real candidates exceed the 16 GiB bounded-artifact policy, so the PR records immutable metadata-only LFS evidence and uses reduced synthetic GGUFs for executable graph/cache parity: | Architecture | Smallest pinned candidate | Complete bytes | |---|---|---:| | `minimax-m2` | `mradermacher/MiniMax-M2-i1-GGUF@2d4f9b1a86d32ce4dfc47db312c8d6fcae8d7b37` / `MiniMax-M2.i1-IQ1_S.gguf` | 46,514,882,176 | | `mistral4` | `unsloth/Mistral-Small-4-119B-2603-GGUF@bd93c721735aa32c035c0f19e738cb3371fd56ff` / `Mistral-Small-4-119B-2603-UD-IQ1_M.gguf` | 32,306,941,632 | | `glm-dsa` | `unsloth/GLM-5.2-GGUF@abc55e72527792c6e77069c99b4cb7de16fa9f23` / six `UD-IQ1_S` shards | 216,715,360,960 | No GGUF payload was downloaded. Hub probes read file metadata only. Runtime support remains `DEFERRED`, and quantization-preserving import is `REJECTED`; callers must use `keep_quantized=False`. GLM routed DSA/MLA MTP, Mistral4 NextN/legacy MLA/Q-LoRA-free/nonzero-temperature layouts, and unowned GLM RoPE scaling all fail closed. There are no production model-ID or revision gates. **Coverage waivers:** real-weight L2/L4/L5 and runtime generation evidence cannot fit the artifact budget. Synthetic tests instead execute full-logit prefill/cached decode, MiniMax static cache, Mistral latent-vs-expanded MLA parity, GLM indexer scheduling, alias-spelled weight closure, and weight application. ## Rebase reconciliation Rebased onto #685 at `86e70a846b572a5266170420373781d2cac23450`. The combined tree preserves the Grok/GroveMoE/Hunyuan-MoE and MiniMax-M2/Mistral4/GLM-DSA cohorts in registry dispatch, tensor-contract validation, architecture fingerprint isolation, model coverage, parity exclusions, census, and generated docs. Combined pins are 105 supported architectures and `107` dependency-blocked / `100` evidence-only / `47` immediately implementable remaining routes. ## Validation - focused combined GGUF/model coverage suite: `2417 passed, 273 skipped` - immutable Hub metadata probes: `3 passed` - broad serial non-integration suite: `8981 passed, 64 skipped, 12 deselected, 1 subtest passed` - `lintrunner f --output oneline --all-files` and `lintrunner -a --output oneline` - `python scripts/generate_gguf_support_docs.py --check` - `git diff --check origin/main...HEAD` - changed-line mypy: `0` errors (`29` pre-existing production-file errors outside changed lines) - independent max-effort review found no significant issues and verified both cohorts, the float32 YaRN endpoint, pre-graph failure timing, fingerprint isolation, tensor mapping, cache semantics, census/docs, and fail-closed ordering Base: `86e70a846b572a5266170420373781d2cac23450` Head: `208f2cb3c7c5215ea9bcf8547a54109acf768bee` --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: 0ee8718a-33b9-4015-9e20-3745bad54686
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.
Summary
grok,grovemoe, andhunyuan-moeUpstream and artifact evidence
Implementation is pinned to
ggml-org/llama.cpp@8d9af256337d1a501250f9bbf4c0859a654bddd6.Bounded HTTP range reads validated 8 MiB from each immutable artifact (24 MiB total; payloads removed afterward):
grokunsloth/grok-2-GGUF/Q2_K/grok-2-Q2_K-00001-of-00003.gguf7b560aeb31bbd8ff7a026f3cfd981c0364024cbfgrok, 477 tensors, split 0/3, 963 logical tensorsgrovemoemradermacher/GroveMoE-Inst-GGUF/GroveMoE-Inst.Q2_K.gguf4dec2e9eaf01d5150d5b45a7d7c95c6220aaad7fgrovemoe, 723 tensorshunyuan-moegabriellarson/Hunyuan-A13B-Instruct-GGUF/Hunyuan-A13B-Instruct-IQ1_S.gguf1ab8a37a314dfa05d4dc11cd899a5dded62c0578hunyuan-moe, 482 tensorsThe older Arki05 Grok-1 IQ1_S header was also audited and deliberately rejected as a current route because it uses the legacy per-expert
ffn_{gate,up,down}.N.weightlayout rather than the pinned loader's packed*_expstensors.GroveMoE intentionally follows the pinned llama.cpp graph where the chunk bank consumes the primary MoE output and gathers weights at floor-mapped chunk IDs, even though those details differ from the Hugging Face reference.
Validation
Capability boundaries / waivers
keep_quantized=Truefails closed because these dedicated graphs currently expose floatingLinear/expert modules only.