Skip to content

Extend GGUF grouped experts and byte-preserving auxiliary packages - #834

Merged
justinchuby merged 8 commits into
mainfrom
justinchuby-gguf-moe-auxiliary-models
Nov 17, 2026
Merged

justinchuby merged 8 commits into
mainfrom
justinchuby-gguf-moe-auxiliary-models

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Stacked on #827.

Extend exact grouped dispatch to ordinary/shared experts and Flash-Next fused expert banks. Add original-byte multi-component/MTP packaging and functional standalone Janus-Pro mmproj conversion. Align LinearAttention with merged independent value heads and optional recurrence trajectories.

The capability survey documents remaining specialized-architecture, projector, runtime-fusion and whole-model rollback restrictions; this does not claim universal efficient MoE execution.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing c8fb589f → b802c43d

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 68 68 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 68 68 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 109 109 +0.0% ⚪
gpt2 model_size_bytes 324 KB 324 KB +0.0% ⚪
gpt2 num_nodes 54 54 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 60 60 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 56 56 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 94 94 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 58 58 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 54 54 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 60 60 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 271 272 +0.4% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 133 134 +0.8% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 463 464 +0.2% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 176 176 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing c8fb589f → b802c43d

Model Sub-model Changes Status
bert (feature-extraction) model 0 ⚪
falcon model 0 ⚪
gemma2 model 0 ⚪
gemma4 (gemma4) decoder 0 ⚪
gemma4 (gemma4) embedding 0 ⚪
gemma4 (gemma4) vision_encoder 0 ⚪
gemma4_text model 0 ⚪
gpt2 model 0 ⚪
llama model 0 ⚪
llama (static-cache) model 0 ⚪
mamba (ssm-text-generation) model 0 ⚪
phi3 model 0 ⚪
phi3 (static-cache) model 0 ⚪
qwen model 0 ⚪
qwen (static-cache) model 0 ⚪
qwen2 model 0 ⚪
qwen2 (static-cache) model 0 ⚪
qwen2_moe model 0 ⚪
qwen2_moe (static-cache) model 0 ⚪
qwen3 model 0 ⚪
qwen3 (static-cache) model 0 ⚪
qwen3_5_moe (hybrid-text-generation) model 11 🟡
qwen3_5_text (hybrid-text-generation) model 9 🟡
qwen3_5_vl (hybrid-qwen-vl) decoder 10 🟡
qwen3_5_vl (hybrid-qwen-vl) embedding 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) vision_encoder 0 ⚪
qwen3_moe model 0 ⚪
qwen3_moe (static-cache) model 0 ⚪
qwen3_next (hybrid-text-generation) model 73 🟡
t5 (seq2seq) decoder 0 ⚪
t5 (seq2seq) encoder 0 ⚪
whisper (speech-to-text) decoder 0 ⚪
whisper (speech-to-text) encoder 0 ⚪
qwen3_5_moe (hybrid-text-generation) / model — 11 change(s)

Op summary: 271 → 272 nodes

--- base
+++ head
@@ -59,6 +59,7 @@
 Sigmoid
 Add
 Softplus
+CastLike
 Exp
 Neg
 Mul

Added nodes:

  • + CastLike

Modified attributes:

  • node[180] RotaryEmbedding: num_heads: 2 → 4

Connectivity changes:

  • node[67] Reshape: input_ids [101, 145] → [144, 146]
  • node[69] Cast: input_ids [26] → [147]
  • node[81] Add: input_ids [28, 16] → [76, 160]
  • node[160] Add: input_ids [160, 240] → [228, 240]
  • node[161] Add: input_ids [46, 16] → [161, 241]
  • node[178] Reshape: input_ids [258, 49] → [257, 49]
  • node[187] Add: input_ids [56, 16] → [242, 270]
  • node[266] Add: input_ids [270, 350] → [338, 350]
  • node[267] Add: input_ids [74, 16] → [271, 351]
qwen3_5_text (hybrid-text-generation) / model — 9 change(s)

Op summary: 133 → 134 nodes

--- base
+++ head
@@ -59,6 +59,7 @@
 Sigmoid
 Add
 Softplus
+CastLike
 Exp
 Neg
 Mul

Added nodes:

  • + CastLike

Modified attributes:

  • node[111] RotaryEmbedding: num_heads: 2 → 4

Connectivity changes:

  • node[67] Reshape: input_ids [73, 117] → [116, 118]
  • node[69] Cast: input_ids [26] → [119]
  • node[81] Add: input_ids [28, 16] → [48, 132]
  • node[92] Add: input_ids [32, 16] → [133, 143]
  • node[109] Reshape: input_ids [160, 35] → [159, 35]
  • node[118] Add: input_ids [42, 16] → [144, 172]
  • node[129] Add: input_ids [46, 16] → [173, 183]
qwen3_5_vl (hybrid-qwen-vl) / decoder — 10 change(s)

Op summary: 159 → 160 nodes

--- base
+++ head
@@ -84,6 +84,7 @@
 Sigmoid
 Add
 Softplus
+CastLike
 Exp
 Neg
 Mul

Added nodes:

  • + CastLike

Modified attributes:

  • node[137] RotaryEmbedding: num_heads: 2 → 4

Connectivity changes:

  • node[92] Reshape: input_ids [103, 147] → [146, 148]
  • node[94] Cast: input_ids [31] → [149]
  • node[106] Add: input_ids [33, 21] → [0, 162]
  • node[117] Add: input_ids [173, 57] → [163, 173]
  • node[118] Add: input_ids [37, 21] → [174, 57]
  • node[135] Reshape: input_ids [191, 40] → [190, 40]
  • node[144] Add: input_ids [47, 21] → [175, 203]
  • node[155] Add: input_ids [51, 21] → [204, 214]
qwen3_next (hybrid-text-generation) / model — 73 change(s)

Op summary: 567 → 570 nodes

--- base
+++ head
@@ -55,6 +55,7 @@
 Sigmoid
 Add
 Softplus
+CastLike
 Exp
 Neg
 Mul
@@ -199,6 +200,7 @@
 Sigmoid
 Add
 Softplus
+CastLike
 Exp
 Neg
 Mul
@@ -343,6 +345,7 @@
 Sigmoid
 Add
 Softplus
+CastLike
 Exp
 Neg
 Mul

Added nodes:

  • + CastLike
  • + CastLike
  • + CastLike

Modified attributes:

  • node[318] Transpose: perm: [0, 2, 1] → [1, 0]
  • node[321] Constant: value_float: None → 0.0, value_ints: [128] → None
  • node[330] Constant: value_ints: [32] → [2, 16]

Connectivity changes:

  • node[63] Reshape: input_ids [160, 200] → [199, 201]
  • node[65] Cast: input_ids [29] → [202]
  • node[77] Add: input_ids [31, 20] → [135, 215]
  • node[162] Add: input_ids [215, 301] → [289, 301]
  • node[163] Add: input_ids [49, 20] → [216, 302]
  • node[193] Reshape: input_ids [324, 328] → [335, 331]
  • node[211] Cast: input_ids [351] → [57]
  • node[301] Transpose: input_ids [76] → [75]
  • node[302] MatMul: input_ids [366, 446] → [445, 446]
  • node[307] Add: input_ids [77, 20] → [439, 451]
  • node[312] Transpose: input_ids [81] → [80]
  • node[313] MatMul: input_ids [453, 457] → [455, 457]
  • node[314] Transpose: input_ids [82] → [81]
  • node[315] MatMul: input_ids [453, 459] → [455, 459]
  • node[316] Transpose: input_ids [83] → [82]
  • node[317] MatMul: input_ids [453, 461] → [455, 461]
  • node[318] Transpose: input_ids [456] → [83]
  • node[331] Concat: input_ids [454, 475, 478] → [456, 477, 478]
  • node[355] Cast: input_ids [500] → [502]
  • node[377] Transpose: input_ids [90] → [89]
  • node[378] MatMul: input_ids [515, 527] → [518, 527]
  • node[380] Transpose: input_ids [91] → [90]
  • node[381] MatMul: input_ids [529, 530] → [518, 530]
  • node[388] Mul: input_ids [531, 537] → [526, 537]
  • node[392] Transpose: input_ids [93] → [92]
  • node[393] MatMul: input_ids [515, 542] → [518, 542]
  • node[395] Transpose: input_ids [94] → [93]
  • node[396] MatMul: input_ids [544, 545] → [518, 545]
  • node[403] Mul: input_ids [546, 552] → [526, 552]
  • node[408] Transpose: input_ids [96] → [95]
  • node[409] MatMul: input_ids [515, 558] → [518, 558]
  • node[411] Transpose: input_ids [97] → [96]
  • node[412] MatMul: input_ids [560, 561] → [518, 561]
  • node[419] Mul: input_ids [562, 568] → [526, 568]
  • node[424] Transpose: input_ids [99] → [98]
  • node[425] MatMul: input_ids [515, 574] → [518, 574]
  • node[427] Transpose: input_ids [100] → [99]
  • node[428] MatMul: input_ids [576, 577] → [518, 577]
  • node[435] Mul: input_ids [578, 584] → [526, 584]
  • node[440] Transpose: input_ids [102] → [101]
  • node[441] MatMul: input_ids [515, 590] → [518, 590]
  • node[443] Transpose: input_ids [103] → [102]
  • node[444] MatMul: input_ids [592, 593] → [518, 593]
  • node[489] Transpose: input_ids [118] → [117]
  • node[490] MatMul: input_ids [631, 643] → [634, 643]
  • node[492] Transpose: input_ids [119] → [118]
  • node[493] MatMul: input_ids [645, 646] → [634, 646]
  • node[500] Mul: input_ids [647, 653] → [642, 653]
  • node[504] Transpose: input_ids [121] → [120]
  • node[505] MatMul: input_ids [631, 658] → [634, 658]
  • node[507] Transpose: input_ids [122] → [121]
  • node[508] MatMul: input_ids [660, 661] → [634, 661]
  • node[515] Mul: input_ids [662, 668] → [642, 668]
  • node[520] Transpose: input_ids [124] → [123]
  • node[521] MatMul: input_ids [631, 674] → [634, 674]
  • node[523] Transpose: input_ids [125] → [124]
  • node[524] MatMul: input_ids [676, 677] → [634, 677]
  • node[531] Mul: input_ids [678, 684] → [642, 684]
  • node[536] Transpose: input_ids [127] → [126]
  • node[537] MatMul: input_ids [631, 690] → [634, 690]
  • node[539] Transpose: input_ids [128] → [127]
  • node[540] MatMul: input_ids [692, 693] → [634, 693]
  • node[547] Mul: input_ids [694, 700] → [642, 700]
  • node[552] Transpose: input_ids [130] → [129]
  • node[553] MatMul: input_ids [631, 706] → [634, 706]
  • node[555] Transpose: input_ids [131] → [130]
  • node[556] MatMul: input_ids [708, 709] → [634, 709]

Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

@justinchuby
justinchuby force-pushed the justinchuby-gguf-moe-auxiliary-models branch from 5f9c745 to 522968a Compare November 17, 2026 16:37
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

@justinchuby
justinchuby force-pushed the justinchuby-gguf-moe-auxiliary-models branch from 522968a to a9127b0 Compare November 17, 2026 18:11
Base automatically changed from justinchuby-qwen38-compatibility to main November 17, 2026 18:17
@justinchuby
justinchuby requested a review from a team November 17, 2026 18:17
justinchuby and others added 4 commits November 17, 2026 10:18
Preserve original sources across named components and MTP sidecars, bind a functional standalone Janus-Pro projector, and consume effective norms and recurrent decay directly. Extend exact grouped expert compositions and Flash-Next value-head/state representations without claiming unqualified runtime fusion.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Clarify the independent value-head and optional recurrence trajectory contracts, including the distinction between graph representation and whole-model rollback or runtime fusion.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Add an exact LFM2 adapter that forwards its registered selection-only bias to the unchanged sigmoid router. Cover normalization and scaling with independent numerical fixtures, and persist merged LinearAttention value-head schema and trajectory shape checks.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Retain MTP and recurrent byte-identity roundtrips without installed packed schemas while gating only numerical/schema variants. Gate Qwen2 grouped validation consistently with its extended grouped dispatch.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
@justinchuby
justinchuby force-pushed the justinchuby-gguf-moe-auxiliary-models branch from a9127b0 to 776754d Compare November 17, 2026 18:20
Copilot AI balanced review requested due to automatic review settings November 17, 2026 18:20

Copilot AI 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.

🟡 Changes recommended

Failed multi-component saves can leave loadable mixtures of old and new graphs, while packed saves can silently omit requested MTP policy or adapter artifacts.

2 open issues
What changed in this PR

Building on #827, this PR expands mobius’s byte-preserving GGUF export support for opset 29, while documenting remaining architecture and runtime limitations.

Changes:

  • Extends grouped expert dispatch to ordinary/shared experts, LFM2, and Flash-Next.
  • Adds multi-component and MTP packaging, plus lossless standalone Janus-Pro projector conversion.
  • Aligns LinearAttention with independent value heads and optional state trajectories, with regression tests and updated documentation.
File Description
src/​mobius/​tasks/​_cache_utils.py Registers opset-aware LinearAttention head attributes.
src/​mobius/​models/​qwen4_exp.py Adds grouped dispatch for fused expert banks.
src/​mobius/​models/​qwen4_exp_test.py Tests grouped expert structure and numerical parity.
src/​mobius/​models/​lfm2.py Preserves selection-only bias in grouped dispatch.
src/​mobius/​integrations/​gguf/​_remaining_projectors_test.py Tests lossless Janus-Pro conversion and roundtrip.
src/​mobius/​integrations/​gguf/​_packed.py Adds multi-component persistence and original-parameter handling.
src/​mobius/​integrations/​gguf/​_packed_test.py Covers MTP, shared sources, expert banks, and decay.
src/​mobius/​integrations/​gguf/​_mtp.py Binds MTP heads to original GGUF bytes.
src/​mobius/​integrations/​gguf/​_mmproj.py Enables lossless standalone Janus-Pro binding.
src/​mobius/​integrations/​gguf/​_grouped_moe_test.py Tests supported replacements and LFM2 routing parity.
src/​mobius/​integrations/​gguf/​_docs.py Updates generated capability descriptions and limitations.
src/​mobius/​integrations/​gguf/​_builder.py Integrates grouped experts and original-parameter consumers.
src/​mobius/​integrations/​gguf/​_builder_test_utils.py Makes expert counts configurable in fixtures.
src/​mobius/​functions/​linear_attention.py Supports independent value heads and state trajectories.
src/​mobius/​functions/​linear_attention_test.py Tests schemas, recurrence, grouped queries, and trajectories.
src/​mobius/​components/​_moe.py Adds biased experts and shared-expert grouped variants.
src/​mobius/​components/​_moe_test.py Tests grouped numerical parity and graph structure.
src/​mobius/​components/​_gated_deltanet.py Adds direct decay consumption and opset-29 emission.
src/​mobius/​components/​_gated_deltanet_test.py Tests decay handling and opset-specific interfaces.
src/​mobius/​components/​__init__.py Exports new grouped and decay components.
src/​mobius/​_model_package.py Detects composed original-byte models for packed saving.
docs/​gguf-capability-catalog.md Summarizes expanded capabilities and remaining restrictions.
docs/​api/​build_from_gguf.md Documents packaging, projector usage, and runtime limits.

Review effort: Balanced

Comment thread src/mobius/integrations/gguf/_packed.py Resolved
Comment thread src/mobius/_model_package.py Resolved
justinchuby and others added 2 commits November 17, 2026 11:00
Use immutable generation filenames and load only manifest-selected components so interrupted multi-model publication cannot invalidate the previous generation. Reject requested policy/adapter artifacts throughout the MTP chain and retain explicit omission support. Update stale Flash-Next dispatch expectations and precisely gate absent LinearAttention schemas.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Advance the dedicated schema build to the merged ONNX value-head ABI and assert it is installed. The previous pin omitted LinearAttention29, skipping recurrence and schema tests and leaving their patch coverage absent despite a green fallback job.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Keep the standalone projector example and essential source, MTP, grouped-dispatch and runtime restrictions without repeating implementation detail.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>

Copilot AI 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.

🔵 Needs a closer look

In-place saves after adding a component or MTP head to a v1 package are blocked because publication rejects the existing model.onnx instead of retaining it until the new v2 manifest is committed.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Allow the prior graph file during v1-to-v2 publication

src/​mobius/​integrations/​gguf/​_packed.py:1009

Loading a v1 package, adding a component or MTP head, and saving in place selects v2 filenames, but this check rejects the committed model.onnx as unrelated/stale. Permit the prior manifest's graph during publication, then retire it only after the new manifest is committed so later v2 saves work too.

2 resolved since last review

Review effort: Balanced

Represent every package with v1 source and model records, including single models and MTP chains. Remove the legacy flat-model branch and v2 compatibility path while preserving immutable-generation publication and strict source integrity.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
@justinchuby
justinchuby requested a balanced review from Copilot November 17, 2026 20:08
@justinchuby
justinchuby merged commit 099be6b into main Nov 17, 2026
27 of 29 checks passed
@justinchuby
justinchuby deleted the justinchuby-gguf-moe-auxiliary-models branch November 17, 2026 20:09

Copilot AI 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.

🟡 Changes recommended

Repeated saves leave unreferenced graph generations on disk without bounded retention, and packed-package roundtrips silently discard MTP-head quantization reports.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity MTP head quantization report is lost during save and load

src/​mobius/​integrations/​gguf/​_packed.py:1059

For a packed package with an MTP head, saving writes only the root reports, and loading recreates the head with gguf_quantization_report=None. This silently drops the head's report describing source-weight preservation and conversion. Persist reports by MTP depth and restore them onto the corresponding package, with a roundtrip assertion for the head report.

Review effort: Balanced

for artifact in stage.iterdir():
if artifact.name != _MANIFEST:
os.replace(artifact, root / artifact.name)
os.replace(stage / _MANIFEST, root / _MANIFEST)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants