Skip to content

Commit e913060

Browse files
justinchubyCopilot
andauthored
Add remaining dense GGUF architectures (#595)
## Summary - add exact pinned GGUF graph/config/tensor support for the reviewable dense cohort: 32-layer Baichuan 7B, modern ChatGLM, Phi-2, and 64-layer Seed-OSS - enforce fail-before-graph metadata, geometry, tensor closure, bias-family, tied-head ownership, and quantization-preservation contracts - add exact Baichuan Q/K inverse permutation, ChatGLM fused QKV/gate-up splitting, Phi-2 tanh-approximated GELU and complete bias topology, and Seed-OSS optional all-layer Q/K/V bias support - explicitly defer Apertus, MiniCPM3, OpenELM, and MPT before config extraction where current Mobius graphs cannot represent pinned llama.cpp semantics - update the pinned tensor census, generated support matrix, architecture coverage, and focused mutation/value/ownership tests Pinned llama.cpp SHA: `8d9af256337d1a501250f9bbf4c0859a654bddd6` ## Validation - focused dense GGUF and registry suite: `620 passed` - GGUF + representative graph + coverage suite: `3998 passed, 268 skipped, 7 deselected` - broad non-integration suite: `6298 passed, 52 skipped, 1 subtest passed` - affected post-review graph suite: `2025 passed, 44 skipped, 4 deselected` - initialized pinned lintrunner, formatter clean, full lint clean - two independent high-confidence reviews completed; the first found the Phi-2 GELU approximation mismatch, which was fixed and regression-tested, and the final review reported no remaining findings The excluded `glm_moe_dsa` graph/checker failures reproduce on the stacked base and are unrelated to this change. ## Deferrals / waivers - runtime packaging remains deferred for the four supported graph-import profiles until pinned real-artifact provenance, independent full-logit parity, and deterministic generation are available - Apertus is fully deferred because its converter-emitted serialized Llama-3 `rope_freqs` tensor is consumed as per-dimension RoPE factors by the pinned loader, while the current Mobius graph derives RoPE only from scalar config - MiniCPM3, OpenELM, and MPT remain fully deferred for their unrepresented topology/config/tensor semantics - L4/L5, multi-dtype, CLI real-artifact, CUDA, ORT GenAI, Foundry Local, and Olive probes are not claimed because no pinned representative real GGUF artifact with provenance was established; these do not weaken the bounded graph-import verdicts above --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]>
1 parent 6715f09 commit e913060

11 files changed

Lines changed: 1127 additions & 11 deletions

File tree

‎docs/api/build_from_gguf.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,14 @@ reason.
152152

153153
| GGUF architecture | Accepted aliases | mobius `model_type` | Float import | Quantized import |
154154
|---|---|---|---|---|
155+
| `apertus` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
155156
| `arcee` | — | `arcee` | runtime deferred | supported |
156157
| `arwkv7` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
158+
| `baichuan` | — | `baichuan` | runtime deferred | supported |
157159
| `bailingmoe3` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
158160
| `bert` | — | `bert` | runtime deferred | supported |
159161
| `bloom` | — | `bloom` | tensor_map deferred | unreachable |
162+
| `chatglm` | — | `chatglm` | runtime deferred | rejected |
160163
| `clip` | — | — | config rejected; tensor_map rejected; graph rejected; runtime rejected | unreachable |
161164
| `cohere2` | — | `cohere2` | runtime deferred | supported |
162165
| `deci` | — | `llama` | supported | supported |
@@ -190,8 +193,10 @@ reason.
190193
| `llama` | `mistral` | `llama` | supported | supported |
191194
| `mamba` | — | `mamba` | runtime deferred | rejected |
192195
| `mamba2` | — | `mamba2` | runtime deferred | rejected |
196+
| `minicpm3` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
193197
| `minimax-01` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
194198
| `modern-bert` | — | `modernbert` | runtime deferred | supported |
199+
| `mpt` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
195200
| `muse-glimmer` | `muse_glimmer` | `muse_glimmer_text` | supported | supported |
196201
| `nemotron` | — | `nemotron` | supported | supported |
197202
| `nemotron_h` | — | `nemotron_h` | runtime deferred | rejected |
@@ -202,6 +207,8 @@ reason.
202207
| `olmo` | — | `olmo` | supported | supported |
203208
| `olmo2` | — | `olmo2` | supported | supported |
204209
| `olmoe` | — | `olmoe` | runtime deferred | supported |
210+
| `openelm` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
211+
| `phi2` | — | `phi` | runtime deferred | rejected |
205212
| `phi3` | — | `phi3` | supported | supported |
206213
| `phimoe` | — | `phimoe` | runtime deferred | supported |
207214
| `plamo2` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
@@ -218,20 +225,44 @@ reason.
218225
| `rwkv6` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
219226
| `rwkv6qwen2` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
220227
| `rwkv7` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
228+
| `seed_oss` | — | `seed_oss` | runtime deferred | supported |
221229
| `smollm3` | — | `smollm3` | supported | supported |
222230
| `stablelm` | — | `stablelm` | supported | supported |
223231
| `starcoder2` | — | `starcoder2` | supported | supported |
224232
| `t5` | — | `t5` | runtime deferred | supported |
225233
| `t5encoder` | — | `t5encoder` | runtime deferred | supported |
226234
| `talkie` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
227235
| `wavtokenizer-dec` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
236+
228237
<!-- END GGUF SUPPORT MATRIX -->
229238

230239
Canonical names are the strings llama.cpp writes into `general.architecture`,
231240
validated against a vendored census of the 147 architectures llama.cpp defines
232241
at commit `8d9af256337d1a501250f9bbf4c0859a654bddd6`. Aliases are spellings
233242
llama.cpp does not emit but that mobius still accepts.
234243

244+
### Dense C01 cohort
245+
246+
The pinned llama.cpp `8d9af256337d1a501250f9bbf4c0859a654bddd6` dense cohort
247+
adds bounded graph import for 32-layer `baichuan`, modern `chatglm`, `phi2`, and
248+
64-layer `seed_oss`. Runtime remains deferred until a pinned real GGUF has
249+
independent full-logit and generation parity.
250+
251+
- Baichuan accepts only the 7B RoPE graph, reverses the converter Q/K permutation,
252+
and rejects the 40-layer hardcoded-ALiBi path. Phi-2 requires its complete bias
253+
closure, 4H tanh-approximated GELU MLP, full MHA, and an untied output.
254+
- ChatGLM accepts only contiguous fused QKV and fused gate/up tensors. Quantized
255+
fused forms are rejected because splitting their packed values and sidecars is
256+
not yet losslessly covered. Seed-OSS maps `post_attention_norm` exactly and permits
257+
either an explicit output or effective ownership by the token embedding, and
258+
accepts Q/K/V biases only as a complete all-layer family.
259+
- `apertus`, `minicpm3`, `openelm`, and `mpt` are explicit pre-config deferrals.
260+
Apertus's serialized Llama-3 `rope_freqs` tensor supplies per-dimension factors
261+
that the current scalar-config Mobius RoPE graph cannot consume. The others'
262+
MLA/scaling topology, per-layer fused/tied topology, and optional learned
263+
positions/QK norms/clipping/AWQ/bias closure are likewise not represented by
264+
current Mobius graphs.
265+
235266
### Second hybrid cohort
236267

237268
`jamba`, `nemotron_h`, and `granitehybrid` have graph-import support for exact

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

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

107+
_MINICPM3_GRAPH_REASON = (
108+
"The pinned MiniCPM3 graph uses MLA Q/KV LoRA projections, separate NoPE/RoPE "
109+
"query and key channels, and embedding, residual, and LM-head scales. The current "
110+
"Mobius MiniCPM graph does not represent that exact topology or its scales."
111+
)
112+
113+
_OPENELM_GRAPH_REASON = (
114+
"The pinned OpenELM graph requires per-layer Q/KV-head and feed-forward-width "
115+
"arrays, fused QKV with Q/K normalization, and mandatory tied embeddings. Those "
116+
"per-layer contracts cannot be scalarized into the current generic graph."
117+
)
118+
119+
_MPT_GRAPH_REASON = (
120+
"The pinned MPT graph permits learned positions, Q/K LayerNorm, KQV clipping, AWQ "
121+
"FFN scales, and several optional bias families. Mobius does not represent that "
122+
"whole closure safely, and the current MPT preprocessing overwrites norm biases."
123+
)
124+
125+
_APERTUS_GRAPH_REASON = (
126+
"The pinned Apertus converter emits a serialized Llama-3 rope_freqs tensor that "
127+
"the pinned loader consumes as per-dimension RoPE factors. The current Mobius "
128+
"Apertus graph computes RoPE frequencies from scalar config and cannot represent "
129+
"that tensor without changing attention semantics."
130+
)
131+
107132
_RECURRENT_RUNTIME_VALIDATION_PENDING = (
108133
"Config extraction, exact pinned tensor-name closure, GGUF value transforms, and "
109134
"synthetic recurrent-state execution are covered, but no representative real-weight "
@@ -508,6 +533,55 @@
508533
model_type="phi3",
509534
tensor_map_recipe=("phi3",),
510535
),
536+
GGUFArchitectureSpec(
537+
gguf_arch="baichuan",
538+
model_type="baichuan",
539+
tensor_map_recipe=("llama",),
540+
config_postprocessor="baichuan",
541+
tensor_processor="llama",
542+
llama_qk_permute=True,
543+
required_metadata=("attention.layer_norm_rms_epsilon",),
544+
runtime=Support.DEFERRED,
545+
reason=_RUNTIME_VALIDATION_PENDING,
546+
),
547+
GGUFArchitectureSpec(
548+
gguf_arch="chatglm",
549+
model_type="chatglm",
550+
tensor_map_recipe=("chatglm",),
551+
config_postprocessor="chatglm",
552+
required_metadata=("attention.layer_norm_rms_epsilon",),
553+
rope_interleave=True,
554+
runtime=Support.DEFERRED,
555+
quantized_import=Support.REJECTED,
556+
reason=(
557+
_RUNTIME_VALIDATION_PENDING
558+
+ " Quantization preservation is rejected because fused QKV and gate/up "
559+
"tensors must be split into separate packed graph targets."
560+
),
561+
),
562+
GGUFArchitectureSpec(
563+
gguf_arch="phi2",
564+
model_type="phi",
565+
tensor_map_recipe=("phi2",),
566+
config_postprocessor="phi2",
567+
required_metadata=("attention.layer_norm_epsilon",),
568+
runtime=Support.DEFERRED,
569+
quantized_import=Support.REJECTED,
570+
reason=(
571+
_RUNTIME_VALIDATION_PENDING
572+
+ " Quantization preservation is rejected because the Phi-2 attention, "
573+
"MLP, and output graph uses float-only linear modules."
574+
),
575+
),
576+
GGUFArchitectureSpec(
577+
gguf_arch="seed_oss",
578+
model_type="seed_oss",
579+
tensor_map_recipe=("llama", "seed_oss_extras"),
580+
config_postprocessor="seed_oss",
581+
required_metadata=("attention.layer_norm_rms_epsilon",),
582+
runtime=Support.DEFERRED,
583+
reason=_RUNTIME_VALIDATION_PENDING,
584+
),
511585
GGUFArchitectureSpec(
512586
gguf_arch="falcon",
513587
model_type="falcon",
@@ -882,6 +956,38 @@
882956
"into the graph. " + _NO_TENSOR_MAP
883957
),
884958
),
959+
GGUFArchitectureSpec(
960+
gguf_arch="apertus",
961+
config=Support.DEFERRED,
962+
tensor_map=Support.DEFERRED,
963+
graph=Support.DEFERRED,
964+
runtime=Support.DEFERRED,
965+
reason=_APERTUS_GRAPH_REASON,
966+
),
967+
GGUFArchitectureSpec(
968+
gguf_arch="minicpm3",
969+
config=Support.DEFERRED,
970+
tensor_map=Support.DEFERRED,
971+
graph=Support.DEFERRED,
972+
runtime=Support.DEFERRED,
973+
reason=_MINICPM3_GRAPH_REASON,
974+
),
975+
GGUFArchitectureSpec(
976+
gguf_arch="openelm",
977+
config=Support.DEFERRED,
978+
tensor_map=Support.DEFERRED,
979+
graph=Support.DEFERRED,
980+
runtime=Support.DEFERRED,
981+
reason=_OPENELM_GRAPH_REASON,
982+
),
983+
GGUFArchitectureSpec(
984+
gguf_arch="mpt",
985+
config=Support.DEFERRED,
986+
tensor_map=Support.DEFERRED,
987+
graph=Support.DEFERRED,
988+
runtime=Support.DEFERRED,
989+
reason=_MPT_GRAPH_REASON,
990+
),
885991
# ------------------------------------------------ known but not importable
886992
GGUFArchitectureSpec(
887993
gguf_arch="bloom",

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
_EXPECTED_QUANTIZED_IMPORT_ARCHITECTURES = frozenset(
6565
{
6666
"arcee",
67+
"baichuan",
6768
"bert",
6869
"cohere2",
6970
"deci",
@@ -99,6 +100,7 @@
99100
"qwen3moe",
100101
"qwen3next",
101102
"rnd1",
103+
"seed_oss",
102104
"smollm3",
103105
"stablelm",
104106
"starcoder2",
@@ -153,7 +155,7 @@ def test_a_buildable_architecture_resolves_in_the_mobius_registry(self, spec) ->
153155

154156
def test_the_supported_set_is_pinned(self) -> None:
155157
"""Gaining or losing support is a deliberate, reviewable change."""
156-
assert len(supported_architectures()) == _EXPECTED_SUPPORTED_COUNT + 6
158+
assert len(supported_architectures()) == _EXPECTED_SUPPORTED_COUNT + 10
157159

158160
def test_falcon_h1_is_not_a_generic_falcon_alias(self) -> None:
159161
"""Falcon-H1 must fail before constructing the incompatible Falcon graph."""
@@ -181,12 +183,14 @@ def test_every_float_importable_architecture_has_a_quantized_verdict(self) -> No
181183
}
182184
assert set(actual) == set(supported_architectures())
183185
rejected = {
186+
"chatglm",
184187
"granitehybrid",
185188
"internlm2",
186189
"jamba",
187190
"mamba",
188191
"mamba2",
189192
"nemotron_h",
193+
"phi2",
190194
}
191195
assert all(actual[arch] is Support.REJECTED for arch in rejected)
192196
assert all(
@@ -318,6 +322,10 @@ class TestPinnedTensorClosure:
318322
"llada",
319323
"llada-moe",
320324
"rnd1",
325+
"baichuan",
326+
"chatglm",
327+
"phi2",
328+
"seed_oss",
321329
)
322330

323331
@staticmethod

0 commit comments

Comments
 (0)