Skip to content

Commit e8f1ad0

Browse files
justinchubyCopilot
andauthored
Promote first GGUF text architecture cohort (#677)
## Summary Promote five previously `immediately-implementable` GGUF architecture routes with architecture-owned metadata, tensor, graph, and fail-closed capability contracts: - `granite`: exact dense/MoE union, Granite scaling, optional biases/shared experts, fused/split QKV transforms, tied output, and validated LongRoPE/no-RoPE paths. Packed import remains supported only where the transforms are proven; unmapped YaRN metadata is rejected. - `jina-bert-v3`: dedicated dense RoPE encoder with fused/split QKV closure, post-norm GELU blocks, pooling, singleton token-type transform, and mandatory encoder-only task/cache guards. Unreachable MoE and packed preservation are rejected. - `maincoder`: dedicated post-RoPE learned Q/K RMSNorm decoder with tied output and exact dynamic/static KV semantics. Packed import is rejected. - `plamo`: shared-pre-norm parallel attention/SwiGLU decoder, cyclic 5-to-40-head KV expansion/cache, and inverse converter Q/output shuffles. Packed preservation, static cache, and external weight reuse are rejected. - `smallthinker`: unnormalized-input routing, ReGLU experts, softmax/sigmoid gating normalization, and exact SWA/NoPE/local-RoPE schedules. Non-integral gating enums and unproven routing scales fail closed; packed import and static cache are rejected. All five routes keep downstream runtime packaging explicitly deferred pending representative real-weight parity. No production routing pins, defaults, or rejects Hugging Face revisions by `model_id`; `revision=None` and arbitrary explicit revisions are unchanged. Immutable Maincoder/Jina revisions are test-only. PLaMo/SmallThinker use explicit model-coverage exemptions because their exact semantics are restored only by GGUF metadata postprocessing, not a native HF config alias. The generated GGUF census/docs now remove these routes from `immediately-implementable` and record their exact import, quantization, and runtime dispositions. ## Review corrections - Exclude `encoder_fused_qkv` from unrelated route fingerprints while retaining it for Jina-v3; regression coverage proves the llama, qwen2, lfm2, and qwen35moe evidence routes are invariant. - Add immutable test-only L2 IDs/revisions for Maincoder and Jina-v3; document explicit GGUF-only exemptions for PLaMo and SmallThinker. - Add Jina-v3 to the encoder-only guard so static cache and incompatible task overrides fail before task dispatch. - Reject Granite YaRN until every serialized parameter, including `attn_factor`, has an exact mapping. - Require SmallThinker gating enums to be finite integers and reject any nonzero `expert_weights_scale` absent from the pinned loader contract. ## Validation - Rebased onto `origin/main` `20a29ed2a935f01ec0cf2fc82939e50bc71dcdea`. - Five-finding regression selection: **96 passed, 5 skipped**. - Focused cohort suite: **575 passed, 33 skipped**. - Exact model coverage: **786 passed, 257 justified skips**. - Pinned Maincoder/Jina L2 config and full-graph validation: **6 passed**. - Broad serial non-integration suite: **8,703 passed, 64 skipped, 12 deselected**. - Generated GGUF docs/registry suite: **1,146 passed, 1 skipped**. - Full `lintrunner` formatting/lint and `git diff --check` pass. - Configured mypy was rerun; it reports the repository's existing type-error baseline, with no diagnostic on a changed line. The new route modules retain their prior targeted type-check evidence. - Independent review of the complete correction diff found no significant issues. ## Artifact budget and cleanup Recorded bounded artifact/source reads total at most **34,042,487 bytes** plus small metadata responses, far below the **16 GiB** limit. Only two 16 MiB GGUF ranges were read (Maincoder and JinaBERT-v3); Granite, PLaMo, and SmallThinker downloaded no model payloads. The correction pass downloaded config-only L2 metadata, not model weights. Sparse headers, pinned source scratch files, transient outputs, caches, and temporary packages were deleted. No `.gguf`, `.onnx`, `.safetensors`, or model `.bin` payload remains in the worktree. ## Deferred evidence / waivers - Representative real-weight full-logit prefill/cached-decode parity and deterministic generation remain deferred for all five routes; suitable immutable artifacts either exceed the per-route budget or were not required to prove the narrowed import contract. - ORT GenAI/runtime packaging, CUDA/DML, L4/L5 goldens, and deployment claims remain deferred. - JinaBERT-v3, Maincoder, PLaMo, and SmallThinker native packed quantization remain rejected. Granite packed import is covered by synthetic packed graph/value evidence, not a real-weight runtime parity claim. - PLaMo’s smallest immutable public GGUF is 4,910,733,280 bytes, above the 3 GiB route ceiling, so no payload was downloaded. --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: 71862fcb-bc9a-4734-b047-b5376afabc3e
1 parent b0fb5af commit e8f1ad0

33 files changed

Lines changed: 4638 additions & 156 deletions

‎docs/api/build_from_gguf.md‎

Lines changed: 10 additions & 11 deletions
Large diffs are not rendered by default.

‎src/mobius/_configs/_base.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ class ArchitectureConfig(BaseModelConfig):
486486
encoder_qk_norm: bool = False
487487
encoder_extra_attention_norm: bool = False
488488
encoder_fused_geglu: bool = False
489+
encoder_fused_qkv: bool = False
489490
pooling_type: int = 0
490491
embedding_dense_2_out: int | None = None
491492
embedding_dense_3_in: int | None = None

‎src/mobius/_registry.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
LLaDAMoEModel,
105105
Llama4CausalLMModel,
106106
MageVLForConditionalGeneration,
107+
MaincoderCausalLMModel,
107108
MoECausalLMModel,
108109
MoonshineForConditionalGeneration,
109110
NanoChatCausalLMModel,
@@ -121,6 +122,7 @@
121122
PhiCausalLMModel,
122123
PhiMoEGGUFCausalLMModel,
123124
Plamo2ForCausalLM,
125+
PlamoGGUFCausalLMModel,
124126
PLMCausalLMModel,
125127
Qwen2MoECausalLMModel,
126128
Qwen2VLCausalLMModel,
@@ -141,6 +143,7 @@
141143
Qwen35VLTextModel,
142144
QwenCausalLMModel,
143145
RND1Model,
146+
SmallThinkerGGUFCausalLMModel,
144147
SmolLM3CausalLMModel,
145148
SortformerDiarizationModel,
146149
WhisperForConditionalGeneration,
@@ -169,6 +172,7 @@
169172
from mobius.models.gguf_encoders import (
170173
EuroBertGGUFModel,
171174
JinaBertV2GGUFModel,
175+
JinaBertV3GGUFModel,
172176
NeoBertGGUFModel,
173177
NomicBertGGUFModel,
174178
NomicBertMoEGGUFModel,
@@ -477,6 +481,11 @@ def _detect_fallback_registration(hf_config) -> ModelRegistration | None:
477481
"arcee": ModelRegistration(ArceeCausalLMModel),
478482
"bitnet": ModelRegistration(BitNetCausalLMModel),
479483
"talkie": ModelRegistration(TalkieForCausalLM),
484+
"maincoder": ModelRegistration(
485+
MaincoderCausalLMModel,
486+
test_model_id="Maincode/Maincoder-1B",
487+
test_revision="088ec98640bdeb105f46a9ef6a1370ed5d0d2ea5",
488+
),
480489
"bloom": ModelRegistration(BloomCausalLMModel),
481490
"orion": ModelRegistration(LayerNormCausalLMModel),
482491
"chatglm": ModelRegistration(ChatGLMCausalLMModel),
@@ -558,6 +567,10 @@ def _detect_fallback_registration(hf_config) -> ModelRegistration | None:
558567
"glm4": ModelRegistration(Glm4CausalLMModel),
559568
"gpt_neox": ModelRegistration(GPTNeoXCausalLMModel),
560569
"gguf_legacy": ModelRegistration(ExactLegacyGGUFCausalLMModel),
570+
"gguf_plamo": ModelRegistration(
571+
PlamoGGUFCausalLMModel,
572+
task="plamo-text-generation",
573+
),
561574
"gpt_neox_japanese": ModelRegistration(GPTNeoXJapaneseCausalLMModel),
562575
"gpt_oss": ModelRegistration(GPTOSSCausalLMModel),
563576
"gptj": ModelRegistration(GPTJCausalLMModel),
@@ -635,6 +648,12 @@ def _detect_fallback_registration(hf_config) -> ModelRegistration | None:
635648
variant="speculators",
636649
),
637650
"shieldgemma2": ModelRegistration(Gemma2CausalLMModel),
651+
"smallthinker_gguf": ModelRegistration(
652+
SmallThinkerGGUFCausalLMModel,
653+
task="smallthinker-gguf-text-generation",
654+
family="smallthinker",
655+
variant="gguf",
656+
),
638657
"smollm3": ModelRegistration(SmolLM3CausalLMModel),
639658
"stablelm": ModelRegistration(LayerNormCausalLMModel),
640659
"starcoder2": ModelRegistration(StarCoder2CausalLMModel),
@@ -882,6 +901,12 @@ def _detect_fallback_registration(hf_config) -> ModelRegistration | None:
882901
"jina_bert_v2_gguf": ModelRegistration(
883902
JinaBertV2GGUFModel, task="gguf-encoder-feature-extraction"
884903
),
904+
"jina_bert_v3_gguf": ModelRegistration(
905+
JinaBertV3GGUFModel,
906+
task="gguf-encoder-feature-extraction",
907+
test_model_id="jinaai/jina-embeddings-v3",
908+
test_revision="ab036b023d30b4d1138c4c3bfa9f0c445ab455d6",
909+
),
885910
"neo_bert_gguf": ModelRegistration(
886911
NeoBertGGUFModel, task="gguf-encoder-feature-extraction"
887912
),

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

Lines changed: 123 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,11 @@
143143
)
144144

145145
_SMALLTHINKER_GGUF_GRAPH_REASON = (
146-
"The pinned SmallThinker graph computes router logits from the unnormalized layer input, "
147-
"uses ReLU experts with metadata-selected sigmoid or softmax gating, and can disable RoPE "
148-
"or select sliding-window attention per layer. Mobius's generic MoE graph routes after "
149-
"the FFN norm with softmax/SwiGLU experts and has no matching per-layer RoPE schedule."
146+
"The exact float-import graph owns SmallThinker's pre-norm router, ReGLU experts, "
147+
"metadata-selected sigmoid/softmax gate, and per-layer SWA/NoPE schedule. Quantization "
148+
"preservation is rejected because QMoE implements SwiGLU and cannot represent this ReGLU "
149+
"contract. Runtime packaging remains deferred until a representative real-weight GGUF "
150+
"passes full-logit prefill and cached-decode parity."
150151
)
151152

152153
_CHAMELEON_GGUF_GRAPH_REASON = (
@@ -378,12 +379,7 @@
378379
"runtime packaging is refused before graph construction."
379380
)
380381

381-
_ENCODER_GRAPH_MISMATCH = {
382-
"jina-bert-v3": (
383-
"JinaBERT v3 uses RoPE and may alternate dense GELU and routed MoE layers. "
384-
"BertModel has absolute positions and no MoE path."
385-
),
386-
}
382+
_ENCODER_GRAPH_MISMATCH: dict[str, str] = {}
387383

388384
_FINAL_CENSUS_DEFERRED_REASONS = {
389385
# Dense / legacy / embedding.
@@ -438,11 +434,6 @@
438434
"attention-output bias plus conditional LongRoPE factor tensors. Mobius has no "
439435
"exact graph or suffix closure for this misleadingly named architecture."
440436
),
441-
"plamo": (
442-
"PLaMo uses one RMSNorm feeding attention and FFN in parallel, fixed grouped-query "
443-
"geometry, and converter-specific Q/output projection shuffles. Sequential Llama "
444-
"topology and direct external tensor reuse would both be incorrect."
445-
),
446437
"plamo3": (
447438
"PLaMo3 requires fused QKV and fused SwiGLU, four norm sites with architecture-"
448439
"specific offset transforms, Q/K norm before RoPE, and a periodic full/sliding "
@@ -481,12 +472,6 @@
481472
"optional attention-output bias and ERNIE-specific position metadata. Similarity "
482473
"to Qwen/Llama is not a suffix-exact tensor or graph contract."
483474
),
484-
"granite": (
485-
"The granite architecture is a conditional dense-or-MoE union with residual, "
486-
"embedding, attention, and inverse-logit scales, optional biases/RoPE factors, "
487-
"shared experts, and optional deep-stack inputs. It is not the GraniteMoE or "
488-
"GraniteHybrid GGUF contract."
489-
),
490475
"granite_swa": (
491476
"Granite SWA requires attention sinks, a complete interleaved sliding-window "
492477
"schedule, residual/logit scaling, fused routed gate-up experts, and optional "
@@ -1345,6 +1330,30 @@
13451330
"runtime packaging remains tracked by #605."
13461331
),
13471332
),
1333+
GGUFArchitectureSpec(
1334+
gguf_arch="plamo",
1335+
model_type="plamo",
1336+
module_type="gguf_plamo",
1337+
config_postprocessor="plamo",
1338+
tensor_map_recipe=("plamo",),
1339+
tensor_processor="plamo",
1340+
required_metadata=(
1341+
"context_length",
1342+
"embedding_length",
1343+
"block_count",
1344+
"feed_forward_length",
1345+
"attention.head_count",
1346+
"attention.head_count_kv",
1347+
"attention.layer_norm_rms_epsilon",
1348+
),
1349+
runtime=Support.DEFERRED,
1350+
quantized_import=Support.REJECTED,
1351+
reason=(
1352+
"Exact graph/config/tensor import is implemented for the pinned PLaMo-13B "
1353+
"converter contract. Runtime remains deferred pending representative real-weight "
1354+
"prefill and expanded-cache decode parity."
1355+
),
1356+
),
13481357
GGUFArchitectureSpec(
13491358
gguf_arch="plamo2",
13501359
model_type="plamo2",
@@ -1421,6 +1430,26 @@
14211430
runtime=Support.DEFERRED,
14221431
reason=_ENCODER_RUNTIME_VALIDATION_PENDING,
14231432
),
1433+
GGUFArchitectureSpec(
1434+
gguf_arch="jina-bert-v3",
1435+
model_type="jina-bert-v3",
1436+
module_type="jina_bert_v3_gguf",
1437+
tensor_map_recipe=("jina_bert_v3",),
1438+
config_postprocessor="jina_bert_v3_encoder",
1439+
required_metadata=(
1440+
"attention.causal",
1441+
"attention.layer_norm_epsilon",
1442+
"rope.freq_base",
1443+
),
1444+
runtime=Support.DEFERRED,
1445+
quantized_import=Support.REJECTED,
1446+
reason=(
1447+
"The dedicated graph and float importer preserve the pinned RoPE, post-norm, "
1448+
"and sequential GELU contracts of the reachable dense loader path. The pinned "
1449+
"loader does not read moe_every_n_layers, so MoE schedules, quantized packed "
1450+
"projections, and runtime packaging remain fail-closed pending proof."
1451+
),
1452+
),
14241453
GGUFArchitectureSpec(
14251454
gguf_arch="modern-bert",
14261455
model_type="modernbert",
@@ -1647,6 +1676,27 @@
16471676
runtime=Support.DEFERRED,
16481677
reason=_RUNTIME_VALIDATION_PENDING,
16491678
),
1679+
GGUFArchitectureSpec(
1680+
gguf_arch="granite",
1681+
model_type="granite",
1682+
tensor_map_recipe=("llama", "diffusion_fused_qkv", "moe_extras"),
1683+
config_postprocessor="granite",
1684+
required_metadata=(
1685+
"attention.layer_norm_rms_epsilon",
1686+
"logit_scale",
1687+
),
1688+
tensor_processor="llama",
1689+
llama_qk_permute=True,
1690+
runtime=Support.DEFERRED,
1691+
reason=(
1692+
"Exact float and quantization-preserving import covers the pinned dense-or-MoE "
1693+
"union, fused or split QKV, optional projection biases, ungated shared experts, "
1694+
"and Granite scaling. Non-empty deep-stack mappings and tensor-backed LongRoPE "
1695+
"remain fail-closed because the current text task cannot represent those data-plane "
1696+
"inputs or preserve the serialized attention factor exactly. "
1697+
+ _RUNTIME_VALIDATION_PENDING
1698+
),
1699+
),
16501700
GGUFArchitectureSpec(
16511701
gguf_arch="granitemoe",
16521702
model_type="granitemoe",
@@ -1784,10 +1834,29 @@
17841834
),
17851835
GGUFArchitectureSpec(
17861836
gguf_arch="smallthinker",
1787-
config=Support.DEFERRED,
1788-
tensor_map=Support.DEFERRED,
1789-
graph=Support.DEFERRED,
1837+
model_type="smallthinker_gguf",
1838+
module_type="smallthinker_gguf",
1839+
tensor_map_recipe=("smallthinker",),
1840+
config_postprocessor="smallthinker",
1841+
required_metadata=(
1842+
"context_length",
1843+
"embedding_length",
1844+
"feed_forward_length",
1845+
"block_count",
1846+
"attention.head_count",
1847+
"attention.head_count_kv",
1848+
"attention.layer_norm_rms_epsilon",
1849+
"rope.dimension_count",
1850+
"rope.freq_base",
1851+
"expert_count",
1852+
"expert_used_count",
1853+
"expert_feed_forward_length",
1854+
"expert_gating_func",
1855+
),
1856+
tensor_processor="llama",
1857+
llama_qk_permute=True,
17901858
runtime=Support.DEFERRED,
1859+
quantized_import=Support.REJECTED,
17911860
reason=_SMALLTHINKER_GGUF_GRAPH_REASON,
17921861
),
17931862
# ------------------------------ Remaining multimodal text backbones (audited/deferred)
@@ -2359,6 +2428,35 @@
23592428
"packed projection preservation remain deferred; use keep_quantized=False."
23602429
),
23612430
),
2431+
GGUFArchitectureSpec(
2432+
gguf_arch="maincoder",
2433+
model_type="maincoder",
2434+
tensor_map_recipe=("llama", "exact_legacy_gguf_extras"),
2435+
config_postprocessor="maincoder",
2436+
required_metadata=(
2437+
"context_length",
2438+
"embedding_length",
2439+
"feed_forward_length",
2440+
"block_count",
2441+
"attention.head_count",
2442+
"attention.head_count_kv",
2443+
"attention.key_length",
2444+
"attention.value_length",
2445+
"attention.layer_norm_rms_epsilon",
2446+
"rope.freq_base",
2447+
"rope.dimension_count",
2448+
),
2449+
rope_interleave=True,
2450+
llama_qk_permute=False,
2451+
runtime=Support.DEFERRED,
2452+
quantized_import=Support.REJECTED,
2453+
reason=(
2454+
"Exact float import is covered with learned per-head Q/K RMSNorm after "
2455+
"adjacent-pair RoPE, sequential pre-norm SwiGLU blocks, causal GQA cache, "
2456+
"and a tied output head. Packed projection preservation and runtime packaging "
2457+
"remain deferred; use keep_quantized=False."
2458+
),
2459+
),
23622460
GGUFArchitectureSpec(
23632461
gguf_arch="wavtokenizer-dec",
23642462
config=Support.DEFERRED,
@@ -2388,6 +2486,7 @@
23882486
"gemma-embedding",
23892487
"jais2",
23902488
"minicpm",
2489+
"maincoder",
23912490
"plm",
23922491
"orion",
23932492
"pangu-embedded",

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@
6060
#: Number of importable architectures. Pinned so that adding support is a
6161
#: deliberate act that also updates the documented support matrix, and so that
6262
#: accidentally losing an architecture is a failure rather than a silence.
63-
_EXPECTED_SUPPORTED_COUNT = 93
63+
_EXPECTED_SUPPORTED_COUNT = 98
6464
_PROMOTED_CONVENTIONAL_DECODERS = frozenset(
6565
{
6666
"bitnet",
6767
"codeshell",
6868
"command-r",
6969
"ernie4_5",
7070
"gptneox",
71+
"granite",
7172
"jais",
7273
"jais2",
7374
"minicpm",
@@ -76,10 +77,12 @@
7677
"orion",
7778
"pangu-embedded",
7879
"plm",
80+
"plamo",
7981
"qwen",
8082
"refact",
8183
"gemma-embedding",
8284
"llama-embed",
85+
"maincoder",
8386
"starcoder",
8487
"xverse",
8588
}
@@ -185,6 +188,7 @@
185188
"gemma2",
186189
"gemma3",
187190
"gemma4",
191+
"granite",
188192
"granitemoe",
189193
"hunyuan-dense",
190194
"jamba",
@@ -316,10 +320,12 @@ def test_every_float_importable_architecture_has_a_quantized_verdict(self) -> No
316320
"granitehybrid",
317321
"internlm2",
318322
"jina-bert-v2",
323+
"jina-bert-v3",
319324
"llama-embed",
320325
"lfm2moe",
321326
"mamba",
322327
"mamba2",
328+
"maincoder",
323329
"nemotron_h",
324330
"nemotron_h_moe",
325331
"neo-bert",
@@ -336,9 +342,11 @@ def test_every_float_importable_architecture_has_a_quantized_verdict(self) -> No
336342
"mpt",
337343
"openelm",
338344
"orion",
345+
"plamo",
339346
"qwen",
340347
"refact",
341348
"starcoder",
349+
"smallthinker",
342350
"talkie",
343351
"xverse",
344352
}
@@ -1091,7 +1099,6 @@ class TestPinnedRemainingConventionalMoECohort:
10911099
"gpt-oss",
10921100
"grok",
10931101
"grovemoe",
1094-
"smallthinker",
10951102
)
10961103
_DEFERRED_ARCHITECTURES = tuple(
10971104
architecture
@@ -1104,7 +1111,6 @@ class TestPinnedRemainingConventionalMoECohort:
11041111
"gpt-oss": 24,
11051112
"grok": 24,
11061113
"grovemoe": 23,
1107-
"smallthinker": 18,
11081114
}
11091115

11101116
@pytest.mark.parametrize("architecture", _DEFERRED_ARCHITECTURES)
@@ -1237,7 +1243,6 @@ def test_no_false_alias_config_or_tensor_claim_is_reachable(
12371243
("gpt-oss", ("MXFP4", "expert biases", "attention sinks")),
12381244
("grok", ("softcaps", "sqrt(2)/2", "dense-plus-routed")),
12391245
("grovemoe", ("separate selections", "adjugate", "Q/K RMSNorm")),
1240-
("smallthinker", ("unnormalized", "sigmoid or softmax", "ReLU")),
12411246
],
12421247
)
12431248
def test_graph_and_routing_mismatch_is_explicit(

0 commit comments

Comments
 (0)