Skip to content

Commit 5f941f5

Browse files
justinchubyCopilot
andcommitted
Reconcile recurrent GGUF quantization policy
Preserve the reviewed Mamba and Mamba2 recurrent import semantics atop the parent squash while honoring the parent branch's explicit quantized-reachability contract. Reject keep_quantized for recurrent graphs without packed projection consumers, retain explicit float dequantization and stateful execution coverage, and regenerate the support matrix. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
1 parent 9b20bb4 commit 5f941f5

4 files changed

Lines changed: 23 additions & 19 deletions

File tree

‎docs/api/build_from_gguf.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ reason.
146146
| GGUF architecture | Accepted aliases | mobius `model_type` | Float import | Quantized import |
147147
|---|---|---|---|---|
148148
| `arcee` | — | `arcee` | runtime deferred | supported |
149+
| `arwkv7` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
149150
| `bloom` | — | `bloom` | tensor_map deferred | unreachable |
150151
| `clip` | — | — | config rejected; tensor_map rejected; graph rejected; runtime rejected | unreachable |
151152
| `cohere2` | — | `cohere2` | runtime deferred | supported |
@@ -163,7 +164,8 @@ reason.
163164
| `hunyuan-dense` | `hunyuan_v1_dense` | `hunyuan_v1_dense` | supported | supported |
164165
| `internlm2` | — | `internlm2` | supported | rejected |
165166
| `llama` | `mistral` | `llama` | supported | supported |
166-
| `mamba` | — | `mamba` | supported | supported |
167+
| `mamba` | — | `mamba` | runtime deferred | rejected |
168+
| `mamba2` | — | `mamba2` | runtime deferred | rejected |
167169
| `muse-glimmer` | `muse_glimmer` | `muse_glimmer_text` | supported | supported |
168170
| `nemotron` | — | `nemotron` | supported | supported |
169171
| `nemotron_h_moe` | — | — | config rejected; tensor_map rejected; graph rejected; runtime rejected | unreachable |
@@ -178,6 +180,9 @@ reason.
178180
| `qwen35` | — | `qwen3_5_text` | supported | supported |
179181
| `qwen35moe` | — | `qwen3_5_moe` | supported | supported |
180182
| `qwen3moe` | `qwen3_moe` | `qwen3_moe` | runtime deferred | supported |
183+
| `rwkv6` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
184+
| `rwkv6qwen2` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
185+
| `rwkv7` | — | — | config deferred; tensor_map deferred; graph deferred; runtime deferred | unreachable |
181186
| `smollm3` | — | `smollm3` | supported | supported |
182187
| `stablelm` | — | `stablelm` | supported | supported |
183188
| `starcoder2` | — | `starcoder2` | supported | supported |

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@
260260
"ssm.time_step_rank",
261261
),
262262
runtime=Support.DEFERRED,
263-
reason=_RECURRENT_RUNTIME_VALIDATION_PENDING,
263+
quantized_import=Support.REJECTED,
264+
reason=_RECURRENT_RUNTIME_VALIDATION_PENDING + " " + _NO_QUANTIZED_PROJECTION_REASON,
264265
),
265266
GGUFArchitectureSpec(
266267
gguf_arch="mamba2",
@@ -278,7 +279,8 @@
278279
"ssm.time_step_rank",
279280
),
280281
runtime=Support.DEFERRED,
281-
reason=_RECURRENT_RUNTIME_VALIDATION_PENDING,
282+
quantized_import=Support.REJECTED,
283+
reason=_RECURRENT_RUNTIME_VALIDATION_PENDING + " " + _NO_QUANTIZED_PROJECTION_REASON,
282284
),
283285
GGUFArchitectureSpec(
284286
gguf_arch="starcoder2",

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
"granitemoe",
7878
"hunyuan-dense",
7979
"llama",
80-
"mamba",
8180
"muse-glimmer",
8281
"nemotron",
8382
"olmo",
@@ -162,11 +161,12 @@ def test_every_float_importable_architecture_has_a_quantized_verdict(self) -> No
162161
if spec.is_importable
163162
}
164163
assert set(actual) == set(supported_architectures())
165-
assert actual["internlm2"] is Support.REJECTED
164+
rejected = {"internlm2", "mamba", "mamba2"}
165+
assert all(actual[arch] is Support.REJECTED for arch in rejected)
166166
assert all(
167167
verdict is Support.SUPPORTED
168168
for arch, verdict in actual.items()
169-
if arch != "internlm2"
169+
if arch not in rejected
170170
)
171171

172172

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

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,27 +2203,24 @@ def test_float_prefill_decode_state_threading_and_save_load(
22032203
assert np.count_nonzero(outputs[-1]["present.0.ssm_state"]) > 0
22042204

22052205
@pytest.mark.parametrize("architecture", ["mamba", "mamba2"])
2206-
def test_quantized_projections_dequantize_without_state_or_logit_loss(
2206+
def test_quantized_projection_preservation_is_rejected_and_float_import_executes(
22072207
self, tmp_path: Path, architecture: str
22082208
) -> None:
22092209
from mobius.integrations.gguf import build_from_gguf
22102210

22112211
path = tmp_path / f"{architecture}-q4.gguf"
22122212
_write_recurrent_gguf(path, architecture, quantized=True)
2213-
preserved = build_from_gguf(path, keep_quantized=True)["model"]
2214-
explicit_float = build_from_gguf(path, keep_quantized=False)["model"]
2213+
with pytest.raises(ValueError, match="does not support keep_quantized=True"):
2214+
build_from_gguf(path, keep_quantized=True)
22152215

2216-
# Current Mamba projection consumers are ordinary Linear modules, so
2217-
# quantized source tensors must dequantize rather than attach to an
2218-
# incompatible MatMulNBits ABI.
2219-
assert "MatMulNBits" not in {node.op_type for node in preserved.graph}
2220-
preserved_steps = self._run_steps(preserved, architecture)
2216+
# Current Mamba projection consumers are ordinary Linear modules.
2217+
# Explicit float import dequantizes the GGUF source before stateful execution.
2218+
explicit_float = build_from_gguf(path, keep_quantized=False)["model"]
2219+
assert "MatMulNBits" not in {node.op_type for node in explicit_float.graph}
22212220
float_steps = self._run_steps(explicit_float, architecture)
2222-
assert len(preserved_steps) == len(float_steps)
2223-
for actual, expected in zip(preserved_steps, float_steps):
2224-
assert set(actual) == set(expected)
2225-
for name in actual:
2226-
np.testing.assert_allclose(actual[name], expected[name], rtol=0, atol=0)
2221+
assert all(np.isfinite(out["logits"]).all() for out in float_steps)
2222+
assert np.count_nonzero(float_steps[-1]["present.0.conv_state"]) > 0
2223+
assert np.count_nonzero(float_steps[-1]["present.0.ssm_state"]) > 0
22272224

22282225
@pytest.mark.parametrize("architecture", ["mamba", "mamba2"])
22292226
def test_static_kv_cache_is_rejected(self, tmp_path: Path, architecture: str) -> None:

0 commit comments

Comments
 (0)