Skip to content

Commit bd54679

Browse files
justinchubyCopilot
andauthored
Add second hybrid GGUF cohort (#588)
## Summary - add exact dense graph-import contracts for `jamba`, `nemotron_h`, and `granitehybrid` from pinned llama.cpp metadata, schedules, tensor closure, and Mamba transforms - defer unsupported MoE/MTP/quantization subsets and document caller-owned hybrid state rollback/reorder semantics - defer `minimax-01`, `plamo2`, and `falcon-h1` before graph construction; remove the false `falcon_h1` alias to ordinary Falcon - add schedule mutation, closure, mapping, processor, task-dispatch, and Falcon early-rejection regressions; update the pinned census and generated support documentation ## Validation - `1032 passed` in focused GGUF/task tests - `1031 passed` in representative graph tests - full lint passed - broad non-integration suite: `6211 passed, 52 skipped`; two pre-existing `glm_moe_dsa` shape-inference/checker failures remain and are unrelated to this diff --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]>
1 parent 781bb67 commit bd54679

26 files changed

Lines changed: 1090 additions & 168 deletions

‎docs/api/build_from_gguf.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,18 @@ reason.
166166
| `eurobert` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
167167
| `exaone` | — | `exaone` | runtime deferred | supported |
168168
| `falcon` | — | `falcon` | supported | supported |
169+
| `falcon-h1` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
169170
| `gemma` | — | `gemma` | supported | supported |
170171
| `gemma2` | — | `gemma2` | supported | supported |
171172
| `gemma3` | — | `gemma3_text` | supported | supported |
172173
| `gemma4` | — | `gemma4_text` | supported | supported |
173174
| `glm-dsa` | `glm_dsa` | `glm_moe_dsa` | tensor_map deferred | unreachable |
174175
| `gpt2` | — | `gpt2` | supported | supported |
176+
| `granitehybrid` | — | `granitemoehybrid` | runtime deferred | rejected |
175177
| `granitemoe` | — | `granitemoe` | runtime deferred | supported |
176178
| `hunyuan-dense` | `hunyuan_v1_dense` | `hunyuan_v1_dense` | supported | supported |
177179
| `internlm2` | — | `internlm2` | supported | rejected |
180+
| `jamba` | — | `jamba` | runtime deferred | rejected |
178181
| `jina-bert-v2` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
179182
| `jina-bert-v3` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
180183
| `lfm2` | — | `lfm2` | runtime deferred | supported |
@@ -183,9 +186,11 @@ reason.
183186
| `llama` | `mistral` | `llama` | supported | supported |
184187
| `mamba` | — | `mamba` | runtime deferred | rejected |
185188
| `mamba2` | — | `mamba2` | runtime deferred | rejected |
189+
| `minimax-01` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
186190
| `modern-bert` | — | `modernbert` | runtime deferred | supported |
187191
| `muse-glimmer` | `muse_glimmer` | `muse_glimmer_text` | supported | supported |
188192
| `nemotron` | — | `nemotron` | supported | supported |
193+
| `nemotron_h` | — | `nemotron_h` | runtime deferred | rejected |
189194
| `nemotron_h_moe` | — | — | config rejected; tensor_map rejected; graph rejected; runtime rejected | unreachable |
190195
| `neo-bert` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
191196
| `nomic-bert` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
@@ -195,6 +200,7 @@ reason.
195200
| `olmoe` | — | `olmoe` | runtime deferred | supported |
196201
| `phi3` | — | `phi3` | supported | supported |
197202
| `phimoe` | — | `phimoe` | runtime deferred | supported |
203+
| `plamo2` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
198204
| `pockettts` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
199205
| `qwen2` | — | `qwen2` | supported | supported |
200206
| `qwen2moe` | `qwen2_moe` | `qwen2_moe` | runtime deferred | supported |
@@ -222,6 +228,41 @@ validated against a vendored census of the 147 architectures llama.cpp defines
222228
at commit `8d9af256337d1a501250f9bbf4c0859a654bddd6`. Aliases are spellings
223229
llama.cpp does not emit but that mobius still accepts.
224230

231+
### Second hybrid cohort
232+
233+
`jamba`, `nemotron_h`, and `granitehybrid` have graph-import support for exact
234+
dense subsets only; runtime packaging remains deferred pending independent
235+
real-artifact full-logit and stateful-generation parity.
236+
237+
- Schedules come from suffix-exact per-layer metadata. Jamba and GraniteHybrid
238+
use `attention.head_count_kv` (`0` selects Mamba/Mamba2). Nemotron-H combines
239+
that array with per-layer `feed_forward_length` to select exactly one of
240+
Mamba2, attention, or dense ReLU² MLP.
241+
- Jamba requires `ssm.inner_size == 2 * embedding_length`. Nemotron-H rejects
242+
MTP and all MoE files. GraniteHybrid rejects routed-MoE files until 3-D expert
243+
fusion, ordering, and quantized preservation have independent value tests.
244+
- Every layer must provide exactly its pinned loader tensor family. Missing,
245+
wrong-mixer, partial, auxiliary, scale/input-scale, and out-of-range tensors
246+
are rejected before graph construction. GGUF Mamba decay values are inverted
247+
from `-exp(A_log)`; convolution and grouped Mamba2 tensors are restored to
248+
graph shapes.
249+
- State inputs and outputs are caller-owned. Mamba1 uses conv
250+
`[B, d_inner, conv_kernel-1]` and SSM `[B, d_inner, d_state]`; Mamba2 uses
251+
conv `[B, d_inner + 2*groups*d_state, conv_kernel-1]` and SSM
252+
`[B, heads, d_state, head_dim]`. Rollback restores a previously saved complete
253+
state tuple; reorder gathers every state on the batch axis. This does not
254+
claim llama.cpp's in-place snapshot/copy-on-write rollback manager.
255+
- `static_cache=True` and non-hybrid task dispatch are rejected for these mixed
256+
state ABIs.
257+
258+
`minimax-01`, `plamo2`, and `falcon-h1` are deferred before config extraction.
259+
MiniMax-01's pinned Lightning schedule and decay/scaling semantics do not match
260+
the current graph; PLaMo2 needs a dedicated fused-QKV Mamba1/attention graph;
261+
Falcon-H1 executes attention and Mamba2 in parallel in every block and therefore
262+
needs KV plus conv/SSM states simultaneously. It is not an alias of ordinary
263+
Falcon. `nemotron_h_moe` remains rejected because its folded MTP attention+MoE
264+
head has no equivalent package contract.
265+
225266
### Audio/TTS/codec cohort
226267

227268
The four C09 architectures below were audited against llama.cpp commit

‎scripts/detect_affected_models_test.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ def test_registry_has_falcon(self):
119119
assert "FalconCausalLMModel" in mapping
120120
types = mapping["FalconCausalLMModel"]
121121
assert "falcon" in types
122-
assert "falcon_h1" in types
122+
assert "falcon_h1" not in types
123123

124124
def test_source_module_to_types(self):
125125
mapping = _build_source_module_to_types()
126-
# falcon.py should map to falcon, bloom, mpt, falcon_h1
126+
# Falcon-H1 is a parallel attention+Mamba2 architecture, not a Falcon alias.
127127
falcon_key = "mobius.models.falcon"
128128
assert falcon_key in mapping
129129
types = mapping[falcon_key]

‎src/mobius/_configs/_base.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ def from_transformers(cls, config, parent_config=None) -> ArchitectureConfig:
10741074
)
10751075

10761076
# Falcon/Bloom model-specific overrides
1077-
if model_type in ("falcon", "falcon_h1"):
1077+
if model_type == "falcon":
10781078
# Falcon MQA: multi_query=True with old architecture → 1 KV head
10791079
if getattr(config, "multi_query", False) and not getattr(
10801080
config, "new_decoder_architecture", False

‎src/mobius/_registry.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ def _detect_fallback_registration(hf_config) -> ModelRegistration | None:
448448
"ernie4_5": ModelRegistration(ErnieCausalLMModel),
449449
"exaone4": ModelRegistration(ExaOne4CausalLMModel),
450450
"falcon": ModelRegistration(FalconCausalLMModel),
451-
"falcon_h1": ModelRegistration(FalconCausalLMModel),
452451
"gemma": ModelRegistration(GemmaCausalLMModel),
453452
"gemma2": ModelRegistration(Gemma2CausalLMModel),
454453
"gemma3": ModelRegistration(Gemma3MultiModalModel, task="vision-language"),
@@ -1019,7 +1018,6 @@ def _create_default_registry() -> ModelRegistry:
10191018
"cosmos3_omni": "nvidia/Cosmos3-Nano",
10201019
"ctrl": "Salesforce/ctrl",
10211020
"ernie4_5": "baidu/ERNIE-4.5-0.3B-PT",
1022-
"falcon_h1": "tiiuae/Falcon-H1-0.5B-Base",
10231021
"gpt-sw3": "AI-Sweden-Models/gpt-sw3-356m",
10241022
"gpt_bigcode": "bigcode/gpt_bigcode-santacoder",
10251023
"gpt_neo": "EleutherAI/gpt-neo-125m",
@@ -1343,7 +1341,6 @@ def _create_default_registry() -> ModelRegistry:
13431341
"mixtral": "mistral",
13441342
"pixtral": "mistral",
13451343
"falcon": "falcon",
1346-
"falcon_h1": "falcon",
13471344
"falcon_mamba": "falcon",
13481345
"mamba": "mamba",
13491346
"mamba2": "mamba",
@@ -1401,7 +1398,6 @@ def _create_default_registry() -> ModelRegistry:
14011398
"deepseek_v4": "dense-csa-fallback+mtp+moe+hc",
14021399
"glm_moe_dsa": "mla+dsa-indexshare+full-attention-fallback+moe",
14031400
"phi3small": "blocksparse",
1404-
"falcon_h1": "hybrid-ssm",
14051401
"mamba": "ssm",
14061402
"mamba2": "ssm",
14071403
"falcon_mamba": "ssm",

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

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,97 @@
516516
quantized_import=Support.REJECTED,
517517
reason=_RECURRENT_RUNTIME_VALIDATION_PENDING + " " + _NO_QUANTIZED_PROJECTION_REASON,
518518
),
519+
GGUFArchitectureSpec(
520+
gguf_arch="jamba",
521+
model_type="jamba",
522+
tensor_map_recipe=("jamba",),
523+
config_key_map="jamba",
524+
config_postprocessor="jamba",
525+
tensor_processor="mamba",
526+
required_metadata=(
527+
"attention.layer_norm_rms_epsilon",
528+
"ssm.conv_kernel",
529+
"ssm.inner_size",
530+
"ssm.state_size",
531+
"ssm.time_step_rank",
532+
),
533+
runtime=Support.DEFERRED,
534+
quantized_import=Support.REJECTED,
535+
reason=_RECURRENT_RUNTIME_VALIDATION_PENDING + " " + _NO_QUANTIZED_PROJECTION_REASON,
536+
),
537+
GGUFArchitectureSpec(
538+
gguf_arch="nemotron_h",
539+
model_type="nemotron_h",
540+
tensor_map_recipe=("nemotron_h",),
541+
config_key_map="nemotron_h",
542+
config_postprocessor="nemotron_h",
543+
tensor_processor="mamba",
544+
required_metadata=(
545+
"attention.layer_norm_rms_epsilon",
546+
"ssm.conv_kernel",
547+
"ssm.group_count",
548+
"ssm.inner_size",
549+
"ssm.state_size",
550+
"ssm.time_step_rank",
551+
),
552+
runtime=Support.DEFERRED,
553+
quantized_import=Support.REJECTED,
554+
reason=_RECURRENT_RUNTIME_VALIDATION_PENDING + " " + _NO_QUANTIZED_PROJECTION_REASON,
555+
),
556+
GGUFArchitectureSpec(
557+
gguf_arch="granitehybrid",
558+
model_type="granitemoehybrid",
559+
tensor_map_recipe=("granitehybrid",),
560+
config_key_map="granitehybrid",
561+
config_postprocessor="granitehybrid",
562+
tensor_processor="granitehybrid",
563+
required_metadata=(
564+
"attention.layer_norm_rms_epsilon",
565+
"ssm.conv_kernel",
566+
"ssm.group_count",
567+
"ssm.inner_size",
568+
"ssm.state_size",
569+
"ssm.time_step_rank",
570+
),
571+
runtime=Support.DEFERRED,
572+
quantized_import=Support.REJECTED,
573+
reason=_RECURRENT_RUNTIME_VALIDATION_PENDING + " " + _NO_QUANTIZED_PROJECTION_REASON,
574+
),
575+
GGUFArchitectureSpec(
576+
gguf_arch="minimax-01",
577+
config=Support.DEFERRED,
578+
tensor_map=Support.DEFERRED,
579+
graph=Support.DEFERRED,
580+
runtime=Support.DEFERRED,
581+
reason=(
582+
"The pinned loader schedule is not periodic and its Lightning Attention "
583+
"decay, scaling, residual multipliers, and recurrent rollback semantics "
584+
"are not represented by the current MiniMax graph."
585+
),
586+
),
587+
GGUFArchitectureSpec(
588+
gguf_arch="plamo2",
589+
config=Support.DEFERRED,
590+
tensor_map=Support.DEFERRED,
591+
graph=Support.DEFERRED,
592+
runtime=Support.DEFERRED,
593+
reason=(
594+
"The pinned PLaMo2 loader requires a dedicated fused-QKV Mamba1/attention "
595+
"graph with sandwich norms and offset transforms that Mobius does not have."
596+
),
597+
),
598+
GGUFArchitectureSpec(
599+
gguf_arch="falcon-h1",
600+
config=Support.DEFERRED,
601+
tensor_map=Support.DEFERRED,
602+
graph=Support.DEFERRED,
603+
runtime=Support.DEFERRED,
604+
reason=(
605+
"Falcon-H1 executes attention and Mamba2 in parallel in every block and "
606+
"requires KV and recurrent states simultaneously; FalconCausalLMModel is "
607+
"not compatible with that graph or state ABI."
608+
),
609+
),
519610
# --------------------------------------------------------- Encoder-only
520611
GGUFArchitectureSpec(
521612
gguf_arch="bert",

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,15 @@ def test_a_buildable_architecture_resolves_in_the_mobius_registry(self, spec) ->
154154

155155
def test_the_supported_set_is_pinned(self) -> None:
156156
"""Gaining or losing support is a deliberate, reviewable change."""
157-
assert len(supported_architectures()) == _EXPECTED_SUPPORTED_COUNT + 4
157+
assert len(supported_architectures()) == _EXPECTED_SUPPORTED_COUNT + 7
158+
159+
def test_falcon_h1_is_not_a_generic_falcon_alias(self) -> None:
160+
"""Falcon-H1 must fail before constructing the incompatible Falcon graph."""
161+
spec = try_get_arch_spec("falcon-h1")
162+
assert spec is not None
163+
assert spec.model_type is None
164+
assert spec.graph is Support.DEFERRED
165+
assert "falcon_h1" not in _REGISTRATIONS
158166

159167
def test_quantized_import_set_is_pinned(self) -> None:
160168
"""Builder acceptance and rejection must come from an explicit policy set."""
@@ -173,7 +181,14 @@ def test_every_float_importable_architecture_has_a_quantized_verdict(self) -> No
173181
if spec.is_importable
174182
}
175183
assert set(actual) == set(supported_architectures())
176-
rejected = {"internlm2", "mamba", "mamba2"}
184+
rejected = {
185+
"granitehybrid",
186+
"internlm2",
187+
"jamba",
188+
"mamba",
189+
"mamba2",
190+
"nemotron_h",
191+
}
177192
assert all(actual[arch] is Support.REJECTED for arch in rejected)
178193
assert all(
179194
verdict is Support.SUPPORTED

0 commit comments

Comments
 (0)