Skip to content

Commit e9d5748

Browse files
justinchubyCopilot
andcommitted
Add deferred conventional MoE GGUF cohort
Audit six remaining conventional-attention MoE architectures against the pinned llama.cpp census and register explicit pre-config deferrals where Mobius cannot yet preserve their complete graph and tensor semantics. Record loader-consumed tensor families and sidecars, document the exact blockers, and test fail-closed registry and builder behavior. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
1 parent e913060 commit e9d5748

6 files changed

Lines changed: 331 additions & 7 deletions

File tree

‎docs/api/build_from_gguf.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ reason.
154154
|---|---|---|---|---|
155155
| `apertus` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
156156
| `arcee` | — | `arcee` | runtime deferred | supported |
157+
| `arctic` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
157158
| `arwkv7` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
158159
| `baichuan` | — | `baichuan` | runtime deferred | supported |
159160
| `bailingmoe3` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
@@ -162,6 +163,7 @@ reason.
162163
| `chatglm` | — | `chatglm` | runtime deferred | rejected |
163164
| `clip` | — | — | config rejected; tensor_map rejected; graph rejected; runtime rejected | unreachable |
164165
| `cohere2` | — | `cohere2` | runtime deferred | supported |
166+
| `dbrx` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
165167
| `deci` | — | `llama` | supported | supported |
166168
| `deepseek4` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
167169
| `dflash` | — | `DFlashDraftModel` | runtime deferred | supported |
@@ -176,9 +178,12 @@ reason.
176178
| `gemma3` | — | `gemma3_text` | supported | supported |
177179
| `gemma4` | — | `gemma4_text` | supported | supported |
178180
| `glm-dsa` | `glm_dsa` | `glm_moe_dsa` | tensor_map deferred | unreachable |
181+
| `gpt-oss` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
179182
| `gpt2` | — | `gpt2` | supported | supported |
180183
| `granitehybrid` | — | `granitemoehybrid` | runtime deferred | rejected |
181184
| `granitemoe` | — | `granitemoe` | runtime deferred | supported |
185+
| `grok` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
186+
| `grovemoe` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
182187
| `hunyuan-dense` | `hunyuan_v1_dense` | `hunyuan_v1_dense` | supported | supported |
183188
| `internlm2` | — | `internlm2` | supported | rejected |
184189
| `jamba` | — | `jamba` | runtime deferred | rejected |
@@ -226,6 +231,7 @@ reason.
226231
| `rwkv6qwen2` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
227232
| `rwkv7` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
228233
| `seed_oss` | — | `seed_oss` | runtime deferred | supported |
234+
| `smallthinker` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
229235
| `smollm3` | — | `smollm3` | supported | supported |
230236
| `stablelm` | — | `stablelm` | supported | supported |
231237
| `starcoder2` | — | `starcoder2` | supported | supported |
@@ -829,6 +835,39 @@ implemented and validated. These include fused/interleaved or dual-form QKV
829835
(GPT-NeoX and Phi-2), ALiBi (Baichuan and MPT), learned position embeddings
830836
(StarCoder), and unproven model aliases (Qwen and Command-R).
831837

838+
### Remaining conventional-attention MoE cohort
839+
840+
The next bounded C02 audit covers exactly Arctic, DBRX, GPT-OSS, Grok,
841+
GroveMoE, and SmallThinker at the pinned llama.cpp commit. All six are
842+
registered as explicit pre-config deferrals. Existing Hugging Face model
843+
registrations and similar expert tensor names are deliberately not treated as
844+
GGUF compatibility evidence.
845+
846+
- Arctic combines a dense parallel SwiGLU branch with a separately normalized
847+
routed branch sourced from a different residual.
848+
- DBRX requires LayerNorm, fused QKV, K/Q/V clamping, and a distinct
849+
post-attention normalization point.
850+
- GPT-OSS requires lossless interleaved gate/up splitting, expert-major MXFP4
851+
repacking, expert/router biases, attention sinks, and sliding-window
852+
semantics under one ownership contract.
853+
- Grok combines embedding/attention/logit scales, attention and optional
854+
final-logit softcaps, extra norms, and dense-plus-routed residual scaling.
855+
- GroveMoE shares router logits across normal and grouped chunk-expert banks,
856+
performs separate expert selections, and adds a scaled adjugate branch.
857+
- SmallThinker routes from the unnormalized residual, selects sigmoid or
858+
softmax gating from metadata, uses ReLU experts, and has per-layer
859+
RoPE/sliding-window scheduling.
860+
861+
The vendored census records every direct loader tensor name, including the
862+
conditional fused-or-split QKV union and optional biases from the shared loader
863+
helper, conditional Grok norm spellings, and GPT-OSS expert biases. Per-family
864+
suffix closure records the generic optional `.scale` and `.input_scale`
865+
sidecars for output, attention, dense FFN, and standard routed-expert
866+
projections, while GroveMoE chunk experts are explicitly limited to `.weight`.
867+
No mapping is installed, so malformed, partial, fused, quantized, or auxiliary
868+
representations cannot reach config extraction or graph construction. Runtime
869+
remains deferred by construction.
870+
832871
## Supported stored quantization types
833872

834873
`mobius/integrations/gguf/_quant_registry.py` covers all 43 `ggml_type` slots

‎src/mobius/integrations/gguf/_arch_registry.py‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,52 @@
104104
"weights. Use keep_quantized=False for explicit float import."
105105
)
106106

107+
_ARCTIC_GGUF_GRAPH_REASON = (
108+
"The pinned Arctic graph is not a standard pre-norm MoE block: every layer runs a "
109+
"dense parallel SwiGLU branch, then adds a separately normalized routed-expert branch "
110+
"computed from the pre-attention residual. Mobius's generic MoE graph replaces the "
111+
"dense FFN instead, so aliasing the existing Hugging Face 'arctic' registration would "
112+
"change residual topology and normalization."
113+
)
114+
115+
_DBRX_GGUF_GRAPH_REASON = (
116+
"The pinned DBRX graph requires LayerNorm, a fused QKV projection, Q/K/V projection "
117+
"clamping from attention.clamp_kqv, and a second LayerNorm before its routed experts. "
118+
"Mobius's generic MoE graph uses RMSNorm, separate Q/K/V projections, and no K/Q/V "
119+
"clamp; the existing Hugging Face 'dbrx' registration is therefore not GGUF-compatible."
120+
)
121+
122+
_GPT_OSS_GGUF_GRAPH_REASON = (
123+
"The pinned GPT-OSS converter splits interleaved gate/up expert rows and repacks "
124+
"checkpoint block+scale tensors into expert-major MXFP4 values. Its loader additionally "
125+
"consumes expert biases, router bias, attention sinks, output bias, post-attention RMSNorm, "
126+
"and sliding-window RoPE metadata. Mobius does not yet own that complete GGUF transform "
127+
"and packed-expert ABI, so partial float or MXFP4 import is deferred."
128+
)
129+
130+
_GROK_GGUF_GRAPH_REASON = (
131+
"The pinned Grok graph applies embedding, attention-output, and logit scales; attention, "
132+
"and optional final-logit softcaps; post-attention and post-FFN norms; and a "
133+
"dense-plus-routed expert residual scaled by sqrt(2)/2. Mobius's generic MoE graph has "
134+
"none of that combined topology, so the Hugging Face-style expert names are not evidence "
135+
"that a GGUF alias is safe."
136+
)
137+
138+
_GROVEMOE_GGUF_GRAPH_REASON = (
139+
"The pinned GroveMoE graph shares router logits across two distinct expert banks but "
140+
"performs separate selections for normal and grouped chunk experts, then scales the "
141+
"adjugate contribution independently. It also applies per-head Q/K RMSNorm. Mobius has "
142+
"no graph or quantized ownership contract for the chunk-expert tensors, and silently "
143+
"treating them as ordinary experts would drop a required branch."
144+
)
145+
146+
_SMALLTHINKER_GGUF_GRAPH_REASON = (
147+
"The pinned SmallThinker graph computes router logits from the unnormalized layer input, "
148+
"uses ReLU experts with metadata-selected sigmoid or softmax gating, and can disable RoPE "
149+
"or select sliding-window attention per layer. Mobius's generic MoE graph routes after "
150+
"the FFN norm with softmax/SwiGLU experts and has no matching per-layer RoPE schedule."
151+
)
152+
107153
_MINICPM3_GRAPH_REASON = (
108154
"The pinned MiniCPM3 graph uses MLA Q/KV LoRA projections, separate NoPE/RoPE "
109155
"query and key channels, and embedding, residual, and LM-head scales. The current "
@@ -866,6 +912,55 @@
866912
runtime=Support.DEFERRED,
867913
reason=_RUNTIME_VALIDATION_PENDING,
868914
),
915+
# ------------------------- Remaining conventional-attention MoE (audited/deferred)
916+
GGUFArchitectureSpec(
917+
gguf_arch="arctic",
918+
config=Support.DEFERRED,
919+
tensor_map=Support.DEFERRED,
920+
graph=Support.DEFERRED,
921+
runtime=Support.DEFERRED,
922+
reason=_ARCTIC_GGUF_GRAPH_REASON,
923+
),
924+
GGUFArchitectureSpec(
925+
gguf_arch="dbrx",
926+
config=Support.DEFERRED,
927+
tensor_map=Support.DEFERRED,
928+
graph=Support.DEFERRED,
929+
runtime=Support.DEFERRED,
930+
reason=_DBRX_GGUF_GRAPH_REASON,
931+
),
932+
GGUFArchitectureSpec(
933+
gguf_arch="gpt-oss",
934+
config=Support.DEFERRED,
935+
tensor_map=Support.DEFERRED,
936+
graph=Support.DEFERRED,
937+
runtime=Support.DEFERRED,
938+
reason=_GPT_OSS_GGUF_GRAPH_REASON,
939+
),
940+
GGUFArchitectureSpec(
941+
gguf_arch="grok",
942+
config=Support.DEFERRED,
943+
tensor_map=Support.DEFERRED,
944+
graph=Support.DEFERRED,
945+
runtime=Support.DEFERRED,
946+
reason=_GROK_GGUF_GRAPH_REASON,
947+
),
948+
GGUFArchitectureSpec(
949+
gguf_arch="grovemoe",
950+
config=Support.DEFERRED,
951+
tensor_map=Support.DEFERRED,
952+
graph=Support.DEFERRED,
953+
runtime=Support.DEFERRED,
954+
reason=_GROVEMOE_GGUF_GRAPH_REASON,
955+
),
956+
GGUFArchitectureSpec(
957+
gguf_arch="smallthinker",
958+
config=Support.DEFERRED,
959+
tensor_map=Support.DEFERRED,
960+
graph=Support.DEFERRED,
961+
runtime=Support.DEFERRED,
962+
reason=_SMALLTHINKER_GGUF_GRAPH_REASON,
963+
),
869964
GGUFArchitectureSpec(
870965
gguf_arch="cohere2",
871966
model_type="cohere2",

‎src/mobius/integrations/gguf/_arch_registry_test.py‎

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,183 @@ def test_hugging_face_deepseek_v4_registration_remains_valid(self) -> None:
714714
assert try_get_arch_spec("deepseek4").model_type is None
715715

716716

717+
class TestPinnedRemainingConventionalMoECohort:
718+
"""Pin the bounded C02 closure without aliasing incompatible MoE graphs."""
719+
720+
_ARCHITECTURES = (
721+
"arctic",
722+
"dbrx",
723+
"gpt-oss",
724+
"grok",
725+
"grovemoe",
726+
"smallthinker",
727+
)
728+
_EXPECTED_TENSOR_COUNTS: ClassVar[dict[str, int]] = {
729+
"arctic": 22,
730+
"dbrx": 11,
731+
"gpt-oss": 24,
732+
"grok": 24,
733+
"grovemoe": 23,
734+
"smallthinker": 18,
735+
}
736+
737+
@pytest.mark.parametrize("architecture", _ARCHITECTURES)
738+
def test_loader_inventory_and_expert_sidecars_are_suffix_exact(
739+
self, architecture: str
740+
) -> None:
741+
upstream = upstream_architectures()[architecture]
742+
names = set(upstream.tensor_names)
743+
assert len(names) == self._EXPECTED_TENSOR_COUNTS[architecture]
744+
assert upstream.expert_tensor_suffixes == ()
745+
suffixes = dict(upstream.tensor_suffixes)
746+
expected_families = {
747+
"output",
748+
"blk.{bid}.attn_qkv",
749+
"blk.{bid}.attn_output",
750+
"blk.{bid}.ffn_gate_exps",
751+
"blk.{bid}.ffn_down_exps",
752+
"blk.{bid}.ffn_up_exps",
753+
}
754+
if architecture != "dbrx":
755+
expected_families.update(
756+
{
757+
"blk.{bid}.attn_q",
758+
"blk.{bid}.attn_k",
759+
"blk.{bid}.attn_v",
760+
}
761+
)
762+
if architecture in {"arctic", "grok"}:
763+
expected_families.update(
764+
{
765+
"blk.{bid}.ffn_gate",
766+
"blk.{bid}.ffn_down",
767+
"blk.{bid}.ffn_up",
768+
}
769+
)
770+
if architecture == "grovemoe":
771+
expected_families.update(
772+
{
773+
"blk.{bid}.ffn_gate_chexps",
774+
"blk.{bid}.ffn_down_chexps",
775+
"blk.{bid}.ffn_up_chexps",
776+
}
777+
)
778+
assert set(suffixes) == expected_families
779+
projection_suffixes = ("weight", "scale", "input_scale")
780+
biased_projection_suffixes = ("weight", "bias", "scale", "input_scale")
781+
assert suffixes["blk.{bid}.attn_qkv"] == (
782+
projection_suffixes if architecture == "dbrx" else biased_projection_suffixes
783+
)
784+
for family in ("blk.{bid}.attn_q", "blk.{bid}.attn_k", "blk.{bid}.attn_v"):
785+
if architecture != "dbrx":
786+
assert suffixes[family] == biased_projection_suffixes
787+
assert suffixes["blk.{bid}.attn_output"] == (
788+
biased_projection_suffixes if architecture == "gpt-oss" else projection_suffixes
789+
)
790+
for family in (
791+
"blk.{bid}.ffn_gate_exps",
792+
"blk.{bid}.ffn_down_exps",
793+
"blk.{bid}.ffn_up_exps",
794+
):
795+
expected = (
796+
biased_projection_suffixes
797+
if architecture == "gpt-oss"
798+
else projection_suffixes
799+
)
800+
assert suffixes[family] == expected
801+
assert suffixes["output"] == projection_suffixes
802+
assert all(name.endswith((".weight", ".bias")) for name in names)
803+
assert {
804+
"blk.{bid}.ffn_gate_exps.weight",
805+
"blk.{bid}.ffn_down_exps.weight",
806+
"blk.{bid}.ffn_up_exps.weight",
807+
} <= names
808+
809+
def test_conditional_and_auxiliary_representations_are_not_conflated(self) -> None:
810+
arctic = set(upstream_architectures()["arctic"].tensor_names)
811+
dbrx = set(upstream_architectures()["dbrx"].tensor_names)
812+
gpt_oss = set(upstream_architectures()["gpt-oss"].tensor_names)
813+
grok = set(upstream_architectures()["grok"].tensor_names)
814+
grove = set(upstream_architectures()["grovemoe"].tensor_names)
815+
small = set(upstream_architectures()["smallthinker"].tensor_names)
816+
817+
assert "blk.{bid}.ffn_norm_exps.weight" in arctic
818+
assert "blk.{bid}.attn_qkv.weight" in dbrx
819+
assert not {"blk.{bid}.attn_q.weight", "blk.{bid}.attn_k.weight"} & dbrx
820+
for names in (arctic, gpt_oss, grok, grove, small):
821+
assert {
822+
"blk.{bid}.attn_qkv.weight",
823+
"blk.{bid}.attn_qkv.bias",
824+
"blk.{bid}.attn_q.weight",
825+
"blk.{bid}.attn_q.bias",
826+
"blk.{bid}.attn_k.weight",
827+
"blk.{bid}.attn_k.bias",
828+
"blk.{bid}.attn_v.weight",
829+
"blk.{bid}.attn_v.bias",
830+
} <= names
831+
assert "blk.{bid}.attn_sinks.weight" in gpt_oss
832+
assert "blk.{bid}.ffn_gate_exps.bias" in gpt_oss
833+
assert {
834+
"blk.{bid}.layer_output_norm.weight",
835+
"blk.{bid}.post_ffw_norm.weight",
836+
} <= grok
837+
assert {
838+
"blk.{bid}.ffn_gate_chexps.weight",
839+
"blk.{bid}.ffn_down_chexps.weight",
840+
"blk.{bid}.ffn_up_chexps.weight",
841+
} <= grove
842+
grove_suffixes = dict(upstream_architectures()["grovemoe"].tensor_suffixes)
843+
assert grove_suffixes["blk.{bid}.ffn_gate_chexps"] == ("weight",)
844+
assert grove_suffixes["blk.{bid}.ffn_down_chexps"] == ("weight",)
845+
assert grove_suffixes["blk.{bid}.ffn_up_chexps"] == ("weight",)
846+
assert not any("_chexps." in name for name in small)
847+
848+
@pytest.mark.parametrize("architecture", _ARCHITECTURES)
849+
def test_no_false_alias_config_or_tensor_claim_is_reachable(
850+
self, architecture: str
851+
) -> None:
852+
spec = try_get_arch_spec(architecture)
853+
assert spec is not None
854+
assert not spec.aliases
855+
assert spec.model_type is None
856+
assert spec.config_key_map is None
857+
assert spec.tensor_map_recipe == ()
858+
assert all(verdict is Support.DEFERRED for verdict in spec.verdicts.values())
859+
assert architecture not in GGUF_ARCH_TO_MODEL_TYPE
860+
861+
@pytest.mark.parametrize(
862+
("architecture", "reason_terms"),
863+
[
864+
("arctic", ("dense parallel", "separately normalized", "residual topology")),
865+
("dbrx", ("LayerNorm", "fused QKV", "clamp")),
866+
("gpt-oss", ("MXFP4", "expert biases", "attention sinks")),
867+
("grok", ("softcaps", "sqrt(2)/2", "dense-plus-routed")),
868+
("grovemoe", ("separate selections", "adjugate", "Q/K RMSNorm")),
869+
("smallthinker", ("unnormalized", "sigmoid or softmax", "ReLU")),
870+
],
871+
)
872+
def test_graph_and_routing_mismatch_is_explicit(
873+
self, architecture: str, reason_terms: tuple[str, ...]
874+
) -> None:
875+
reason = try_get_arch_spec(architecture).reason
876+
assert reason is not None
877+
for term in reason_terms:
878+
assert term in reason
879+
880+
@pytest.mark.parametrize("architecture", _ARCHITECTURES)
881+
def test_every_architecture_fails_before_graph_construction(
882+
self, architecture: str
883+
) -> None:
884+
with pytest.raises(UnsupportedGGUFArchitectureError, match=architecture):
885+
get_arch_spec(architecture)
886+
887+
def test_valid_hugging_face_registrations_are_not_reused_as_gguf_aliases(self) -> None:
888+
assert {"arctic", "dbrx", "gpt_oss"} <= set(_REGISTRATIONS)
889+
assert try_get_arch_spec("arctic").model_type is None
890+
assert try_get_arch_spec("dbrx").model_type is None
891+
assert try_get_arch_spec("gpt-oss").model_type is None
892+
893+
717894
class TestRejectionsAreActionable:
718895
"""An unsupported input must say what it is and what to do instead."""
719896

‎src/mobius/integrations/gguf/_builder_test.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4215,9 +4215,15 @@ def test_deferred_audio_architectures_fail_before_all_downstream_stages(
42154215
"kimi-k3",
42164216
"kimi-linear",
42174217
"lfm2moe",
4218+
"arctic",
4219+
"dbrx",
4220+
"gpt-oss",
4221+
"grok",
4222+
"grovemoe",
4223+
"smallthinker",
42184224
],
42194225
)
4220-
def test_deferred_second_hybrid_cohort_fails_before_graph_construction(
4226+
def test_deferred_audited_cohorts_fail_before_graph_construction(
42214227
self, architecture: str, tmp_path: Path
42224228
) -> None:
42234229
from mobius import _builder as core_builder

0 commit comments

Comments
 (0)