Skip to content

Commit efa4524

Browse files
justinchubyCopilot
andcommitted
Remove production checkpoint revision gates
Restore normal Hugging Face revision semantics for Transformers builds and route Qwen4Exp GGUF fail-closed checks by detected architecture and tensor contract instead of repository, revision, or shard identity. Keep immutable checkpoint details in tests and evidence documentation only. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
1 parent 91225ed commit efa4524

9 files changed

Lines changed: 154 additions & 327 deletions

File tree

‎docs/design/qwen4-exp-text-core.md‎

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ Mobius implements both the `qwen4_exp_text` decoder and the
66
`decoder`, `vision_encoder`, and `embedding`. `text_only=True` selects the same
77
decoder without the vision stages.
88

9-
The implementation is pinned to:
9+
The implementation evidence was collected from:
1010

1111
- `Qwen/Qwen3.8-Flash-Next@f5d08274bafd880402bd16f5e3e6c514136ec06c`
1212
- `unsloth/Qwen3.8-Flash-Next-FP8@41cc25fe32cc20053a59c89716196897580cddf6`
1313
- `unsloth/Qwen3.8-Flash-Next-GGUF@d3bc75ee6ccef3efc1e228ec00a6cc2cdb1e2249`
1414
- `huggingface/transformers@598d8ba8baaec7fec5a22da0e2844c7bf4ea20e1`
1515

16-
Exported models record that pin as `mobius.semantic_reference_revision` and
16+
Exported models record the semantic reference as `mobius.semantic_reference_revision` and
1717
record the caller's requested checkpoint revision separately as
1818
`mobius.source_revision` (`unpinned` when no revision was supplied).
1919

@@ -24,7 +24,7 @@ schedule, full-kernel Gated-DeltaNet convolution state, recurrent delta-rule
2424
state, four-stream gated residual hyper-connections, exact softmax-first
2525
top-k routed MoE plus the sigmoid-gated shared expert, QSA block pooling and
2626
token selection, and PLE hashed n-gram embeddings with their dilated
27-
convolution and token-context states. The pinned BF16 checkpoint keeps
27+
convolution and token-context states. The evidenced BF16 checkpoint keeps
2828
DeltaNet recurrent math and recurrent cache state in float32, while convolution
2929
state, projections, sparse-attention caches, and logits remain in model dtype.
3030
Official safetensors are loaded through a bounded-memory package transaction:
@@ -59,7 +59,7 @@ embeddings. Mobius reuses the Qwen3 vision implementation with DeepStack
5959
disabled and the merger projected to the decoder width of 2560.
6060

6161
The embedding graph scatters `image_features` at token 248056 while preserving
62-
the original token IDs for PLE. The processor contract is the pinned Qwen3
62+
the original token IDs for PLE. The processor contract follows the evidenced Qwen3
6363
image processor with vision start/end tokens 248053/248054. This package is
6464
explicitly image-only: config extraction validates the checkpoint's video token
6565
but removes it from runtime metadata, the embedding graph exposes no video
@@ -78,28 +78,29 @@ of a dedicated sparse-attention runtime kernel.
7878

7979
## Guarded features
8080

81-
The pinned ordinary Transformers forward preserves MTP metadata but does not
81+
The evidenced ordinary Transformers forward preserves MTP metadata but does not
8282
execute its `mtp.*` sidecar. Mobius mirrors that next-token route and does not
8383
publish an MTP task. Dedicated MTP embeddings fail closed because no flattened
8484
NextN cache ABI exists. Alternative vision geometries and nonempty DeepStack
8585
configurations also fail closed.
8686

8787
## GGUF header support and payload guard
8888

89-
The pinned GGUF is a text-only `general.architecture=qwen4exp` split set:
89+
The GGUF evidence artifact is a text-only `general.architecture=qwen4exp` split set:
9090

9191
| Shard | Tensors | Bytes | LFS SHA-256 |
9292
|---|---:|---:|---|
9393
| `UD-IQ1_S/Qwen3.8-Flash-Next-UD-IQ1_S-00001-of-00003.gguf` | 0 | 10,946,624 | `88a1420825a9304063e882ada29d438263617f51ac8923d438d927496693bafd` |
9494
| `UD-IQ1_S/Qwen3.8-Flash-Next-UD-IQ1_S-00002-of-00003.gguf` | 595 | 49,990,818,368 | `3a62e35bbf9add4733bd1438ebd3a67649d5edd6cb0e72bb78e33c913992b2b6` |
9595
| `UD-IQ1_S/Qwen3.8-Flash-Next-UD-IQ1_S-00003-of-00003.gguf` | 629 | 22,544,696,352 | `0e25ceaeb89b8a80aa973c6c0c7448943682f7408c2855b2ebd016b7643a861a` |
9696

97-
Shard 0 owns all model/tokenizer metadata and no tensors. The importer
98-
inherits that metadata across the complete set and requires the exact
99-
`0 + 595 + 629 = 1224` closure. Header validation covers every
100-
hyper-connection, PLE, QSA/indexer, DeltaNet, routed/shared expert, and final
101-
output mixer tensor. GGUF's split indexer query/key matrices are concatenated
102-
row-wise into Hugging Face's fused `index_qk_proj`; they are not Q/K-permuted.
97+
Shard 0 owns all model/tokenizer metadata and no tensors in that evidence set.
98+
Production routing is not bound to its repository, revision, filenames, byte
99+
sizes, hashes, or shard distribution. Bounded header inspection identifies
100+
`general.architecture=qwen4exp`, while validation uses the model metadata and
101+
complete 1,224-name tensor shape/qtype contract. GGUF's split indexer query/key
102+
matrices are concatenated row-wise into Hugging Face's fused `index_qk_proj`;
103+
they are not Q/K-permuted.
103104

104105
Payload conversion deliberately fails before Hub download. The combined PLE
105106
table is an enormous IQ4_NL embedding for which the graph has no compatible
@@ -120,28 +121,30 @@ lossy `%d` cache templates. The decoder graph carries a separate
120121
`mobius.state_manifest` metadata document with explicit role-to-layer
121122
membership for direct ONNX Runtime orchestration.
122123

123-
## Pinned FP8 checkpoint
124+
## FP8 checkpoint evidence
124125

125-
`unsloth/Qwen3.8-Flash-Next-FP8` is accepted only at immutable revision
126-
`41cc25fe32cc20053a59c89716196897580cddf6`. Its 131 safetensors headers were
127-
range-read without downloading the 185.5 GB tensor payload. The committed
128-
schema evidence records the config/index hashes, complete tensor census, and
129-
canonical header-schema hash.
126+
The committed evidence for `unsloth/Qwen3.8-Flash-Next-FP8` was collected at
127+
immutable revision `41cc25fe32cc20053a59c89716196897580cddf6`. Library builds do
128+
not lock to that revision: omitting `revision` follows the Hugging Face default,
129+
and an explicit branch, tag, or SHA is forwarded unchanged to config and weight
130+
loading. Its 131 safetensors headers were range-read without downloading the
131+
185.5 GB tensor payload. The schema evidence records the config/index hashes,
132+
complete tensor census, and canonical header-schema hash.
130133

131134
The checkpoint uses three text-weight paths:
132135

133136
- 73,728 routed-expert matrices use `F8_E4M3` values plus BF16 inverse-scale
134137
grids. Every grid is validated as exactly
135138
`[ceil(rows / 128), ceil(cols / 128)]`.
136139
- 128 PLE embedding shards use `F8_E4M3` storage and one shared BF16
137-
`ngram_embedding.weight_scale` scalar. Its pinned payload is BF16 bits
140+
`ngram_embedding.weight_scale` scalar. The evidenced payload is BF16 bits
138141
`0x3951` (`0.00019931793212890625` as float32). Mobius requires that exact
139142
scalar and reconstructs each shard lazily as
140143
`shard.astype(target_dtype) * weight_scale`. The shards remain separate in
141144
the ONNX graph instead of concatenating a roughly 95 GiB dense table during
142145
export.
143146
- Remaining text weights are ordinary BF16 tensors. The 943-entry
144-
`modules_to_not_convert` list resolves completely against the pinned header.
147+
`modules_to_not_convert` list resolves completely against the evidenced header.
145148

146149
By default Mobius preserves every FP8 code tensor and BF16 scale tensor as an
147150
external-data initializer. Standard ONNX QDQ reconstructs the logical weights:

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

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -483,13 +483,6 @@ def _gguf_header_info_from_header_prefix(
483483
)
484484

485485

486-
def _requires_strict_hub_header_preflight(repo_id: str) -> bool:
487-
"""Return whether this route must never fall back to payload download."""
488-
from mobius.integrations.gguf._qwen4_exp import QWEN4EXP_GGUF_REPO
489-
490-
return repo_id == QWEN4EXP_GGUF_REPO
491-
492-
493486
def _validate_preflight_split_header(info: GGUFHeaderInfo, *, source: str) -> None:
494487
"""Require complete, internally consistent split bookkeeping when present."""
495488
split_values = (info.split_no, info.split_count, info.split_tensors_count)
@@ -585,12 +578,6 @@ def read_response(response) -> list[bytes]:
585578
with session.get(metadata.location, headers=headers, stream=True) as response:
586579
chunks = read_response(response)
587580
except _HUB_PREFLIGHT_TRANSPORT_ERRORS as error:
588-
if _requires_strict_hub_header_preflight(repo_id):
589-
raise RuntimeError(
590-
f"Cannot read the bounded GGUF header for {source!r}; refusing payload "
591-
"download because Qwen4Exp route policy cannot be established. "
592-
"No payload was downloaded."
593-
) from error
594581
logger.warning(
595582
"Bounded GGUF header range read failed for %s (%s); downloading the "
596583
"same immutable revision and validating its local header before dispatch.",
@@ -603,13 +590,7 @@ def read_response(response) -> list[bytes]:
603590
b"".join(chunks),
604591
source=source,
605592
)
606-
except GGUFHeaderTruncatedError as error:
607-
if _requires_strict_hub_header_preflight(repo_id):
608-
raise RuntimeError(
609-
f"The selected GGUF metadata header for {source!r} exceeds the bounded "
610-
"range; refusing payload download because Qwen4Exp route policy cannot "
611-
"be established. No payload was downloaded."
612-
) from error
593+
except GGUFHeaderTruncatedError:
613594
logger.warning(
614595
"The selected GGUF metadata header for %s exceeds the bounded range; "
615596
"downloading the same immutable revision for full local validation.",
@@ -646,9 +627,9 @@ def read_response(response) -> list[bytes]:
646627
allow_preflight_only=True,
647628
)
648629
if architecture == "qwen4exp" and dispatch_architecture:
649-
from mobius.integrations.gguf._qwen4_exp import validate_qwen4exp_hub_source
630+
from mobius.integrations.gguf._qwen4_exp import reject_qwen4exp_payload
650631

651-
validate_qwen4exp_hub_source(repo_id=repo_id, revision=commit_hash)
632+
reject_qwen4exp_payload()
652633
return _GGUFPreflightRevision(commit_hash, header_info)
653634

654635

@@ -5018,9 +4999,9 @@ def _select_hf_gguf_set_from_split_headers(
50184999
allow_preflight_only=True,
50195000
)
50205001
if primary_architecture == "qwen4exp":
5021-
from mobius.integrations.gguf._qwen4_exp import validate_qwen4exp_hub_source
5002+
from mobius.integrations.gguf._qwen4_exp import reject_qwen4exp_payload
50225003

5023-
validate_qwen4exp_hub_source(repo_id=repo_id, revision=revision)
5004+
reject_qwen4exp_payload()
50245005
mismatched_architectures = {
50255006
name: architecture
50265007
for name, architecture in declared_architectures.items()
@@ -5258,19 +5239,6 @@ def _resolve_gguf_path_impl(
52585239
filename, selected_files = _select_complete_hf_gguf_set(pinned_files, filename)
52595240

52605241
if len(selected_files) > 1:
5261-
from mobius.integrations.gguf._qwen4_exp import (
5262-
QWEN4EXP_GGUF_REPO,
5263-
validate_qwen4exp_hub_artifact,
5264-
)
5265-
5266-
if repo_id == QWEN4EXP_GGUF_REPO:
5267-
validate_qwen4exp_hub_artifact(
5268-
api,
5269-
repo_id=repo_id,
5270-
revision=resolved_revision,
5271-
shard_filenames=selected_files,
5272-
keep_quantized=keep_quantized,
5273-
)
52745242
return _download_hf_gguf_shards(
52755243
api,
52765244
repo_id=repo_id,

0 commit comments

Comments
 (0)