Skip to content

Commit ab11232

Browse files
justinchubyCopilot
andauthored
Finalize generated GGUF support matrix (#604)
## Summary - generate the authoritative GGUF support matrix from the pinned llama.cpp census at `8d9af256337d1a501250f9bbf4c0859a654bddd6` (`2026-08-23T16:59:42Z`) - lock documentation to all 147 architectures, 25 active stored qtypes, 60 projector strings, and 87 tokenizer pre-types in 56 semantic groups - distinguish graph construction/importability from real runtime support and downgrade every architecture/projector without complete evidence - fail runtime publication closed unless canonical architecture, exact runtime/version, immutable source identity, tensor/qtype census, graph-shaping import route, serialized graph, tokenizer/config, and complete staged package all match structured evidence - document exact-copy versus conversion qtype routes, CLI/Hub provenance, tokenizer/mmproj/MTP behavior, transaction limitations, and downstream-runtime scope ## Final verdicts - architectures: 147 total; 52 graph-supported; 51 fully importable; 0 runtime-supported - stored qtypes: 25 active; 24 routed; `Q2_0` deferred because pinned gguf-py has no dequantizer - projectors: 60 total; 2 graph-importable (`gemma4v`, `muse-glimmer`); 0 runtime-supported - tokenizers: 87 exact identifiers in 56 semantic groups; exact copy only when a vocabulary-identical embedded `tokenizer.huggingface.json` is present ## Local validation - `python scripts/generate_gguf_support_docs.py --check` - `lintrunner f --output oneline --all-files` - `lintrunner -a` - GGUF/CLI/coverage suite: 3,375 passed, 225 skipped - broad non-integration suite: 7,027 passed, 52 skipped, 1 subtest passed (known unrelated `glm_moe_dsa` baseline excluded) - two independent full-diff reviews: CLEAN - final cross-stack policy review: CLEAN ## Waivers and limitations This PR closes importer/registry/documentation policy; it does not add a new model architecture or claim downstream runtime readiness. - L1-L3 architecture-model checklist items: not applicable to this registry/importer closure; existing graph/CLI/import suites cover changed behavior. - L4/L5 and representative real-weight full-logit/generation parity: not claimed globally. Their absence is why runtime verdicts remain deferred/rejected. - fp16/bf16/CUDA/DirectML/cross-EP semantic parity: not claimed by this matrix without architecture-specific real evidence. - ORT GenAI, Foundry Local, and Olive: optional downstream probes; absence does not gate Mobius graph export and implies no runtime support. - direct source-backed GGUF external-data reuse: not implemented. Packages are self-contained; source-range manifests, source-backed locking/recovery, and source-reference symlink containment are not claimed. - publication uses staged files plus two renames and in-process rollback; it is not a single-step atomic exchange, crash-durable transaction, or multi-process lock. Stacked on #603 / `justinchuby-close-gguf-tokenizer-census`. --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]>
1 parent aa19199 commit ab11232

27 files changed

Lines changed: 1768 additions & 474 deletions

‎docs/api/build_from_gguf.md‎

Lines changed: 397 additions & 276 deletions
Large diffs are not rendered by default.

‎docs/cli_reference.md‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ mobius build --model Qwen/Qwen2.5-0.5B --output output_dir/ \
321321

322322
## `mobius build-gguf`
323323

324-
Build an ONNX model from a GGUF file (e.g. from llama.cpp).
324+
Build an ONNX model from a GGUF file (e.g. from llama.cpp). This is an explicit
325+
opt-in import path; `mobius build` does not auto-discover or select GGUF files.
325326
Supported GGUF quantization is preserved by default. This can involve
326327
byte-preserving native blocks in text-only builds, affine repacking, or
327328
dequantize/requantize for multimodal and mixed source qtypes.
@@ -338,7 +339,7 @@ mobius build-gguf GGUF_PATH --output OUTPUT_DIR [options]
338339

339340
| Argument | Description |
340341
|----------|-------------|
341-
| `GGUF_PATH` | Path to a `.gguf` model file. |
342+
| `GGUF_PATH` | Local `.gguf` path or exact `owner/repo:filename.gguf` Hub reference. Hub preflight range-reads only that filename, resolves the requested ref to an immutable commit, and downloads that exact revision; repository-level metadata is never used. |
342343

343344
### Options
344345

@@ -350,7 +351,10 @@ mobius build-gguf GGUF_PATH --output OUTPUT_DIR [options]
350351
| `--dtype DTYPE` | Target dtype for model weights: `f16`, `bf16`, `f32`. |
351352
| `--external-data FORMAT` | External data format: `onnx` (default) or `safetensors`. |
352353
| `--ep EP` | Target execution provider for EP-aware optimization. |
353-
| `--runtime RUNTIME` | `onnx-genai` emits supported runtime metadata. `ort-genai` is rejected until GGUF cache/tokenizer generation coverage exists. |
354+
| `--runtime RUNTIME` | Request `onnx-genai` or `ort-genai` metadata. Emission is rejected unless the architecture has structured runtime evidence and the GGUF embeds an exact validated tokenizer; neither format bypasses the architecture verdict. |
355+
| `--runtime-version VERSION` | Exact selected runtime version. Once runtime support exists, this must equal the version in the matching evidence record; compatible-version ranges are not inferred. |
356+
| `--mmproj PATH` | Exact companion `clip` GGUF. Pairing validates source identity, target architecture, modality, tensor closure, and dimensions before graph construction. |
357+
| `--target-config PATH` | Exact target config directory for `dflash`/`eagle3`; requires the adjacent complete `tokenizer.json` and emits a target-binding draft manifest. |
354358
| `--release` | Strip build-time debug and provenance metadata before saving while preserving functional `mobius.*` metadata. |
355359
| `--static-cache` | Build a fixed-width cache where supported. |
356360
| `--max-seq-len N` | Set the fixed cache length; requires `--static-cache`. |
@@ -371,7 +375,7 @@ mobius build-gguf model.gguf --output output/ --dtype f16
371375
F32-, F16-, and BF16-only files build normally as float models because they
372376
contain no quantization to preserve.
373377
Quantized files containing only qtypes with no supported preservation target
374-
(for example, pure Q6_K or Q5_K weights) fail instead of silently becoming
378+
(for example, pure Q5_K weights) fail instead of silently becoming
375379
float. Re-run with `--dequantize` to request explicit float conversion.
376380

377381
Encoder-only BERT and ModernBERT GGUF backbones auto-select
@@ -390,6 +394,13 @@ parity, mixed expert quantization, tokenizer provenance, and real ORT/ORT GenAI
390394
generation are validated. See
391395
[`build_from_gguf()`](api/build_from_gguf.md#nvidia-nemotron-35-lightning-waiver).
392396

397+
Runtime packaging requires a validated embedded `tokenizer.huggingface.json`;
398+
opaque tokenizer pre-types are never reconstructed. Deferred/rejected
399+
architecture, tokenizer, draft-pairing, or mmproj checks run before durable
400+
output. Multimodal packages use `decoder`, `vision_encoder`, optional
401+
`audio_encoder`, and `embedding`; an admitted trailing MTP head is persisted
402+
under `mtp/`.
403+
393404
---
394405

395406
## `mobius list`
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
"""Refresh or check the generated GGUF support census documentation."""
5+
6+
from __future__ import annotations
7+
8+
import argparse
9+
import sys
10+
from pathlib import Path
11+
12+
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
13+
14+
from mobius.integrations.gguf._docs import DOC_PATH, update_document
15+
16+
17+
def main() -> None:
18+
parser = argparse.ArgumentParser()
19+
parser.add_argument("--check", action="store_true")
20+
args = parser.parse_args()
21+
generated = update_document()
22+
current = DOC_PATH.read_text(encoding="utf-8")
23+
if args.check:
24+
if current != generated:
25+
raise SystemExit(
26+
"docs/api/build_from_gguf.md is stale; run "
27+
"`python scripts/generate_gguf_support_docs.py`"
28+
)
29+
return
30+
DOC_PATH.write_text(generated, encoding="utf-8")
31+
32+
33+
if __name__ == "__main__":
34+
main()

‎src/mobius/__main__.py‎

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ def _cmd_build_gguf(args: argparse.Namespace) -> None:
619619
print("Dequantized mode: converting GGUF weights to float...")
620620

621621
gguf_path = args.gguf_path
622+
gguf_reference = gguf_path
622623
output_dir = args.output_dir
623624
target_config = getattr(args, "target_config", None)
624625
runtime = getattr(args, "runtime", None)
@@ -638,28 +639,36 @@ def _cmd_build_gguf(args: argparse.Namespace) -> None:
638639
)
639640

640641
if runtime is not None:
642+
from mobius.integrations.gguf._arch_registry import get_arch_spec
641643
from mobius.integrations.gguf._builder import (
642644
_resolve_gguf_path,
643645
_validate_gguf_model,
644646
)
645647
from mobius.integrations.gguf._reader import GGUFModel
648+
from mobius.integrations.gguf._spec import Support
646649
from mobius.integrations.gguf._tokenizer import inspect_gguf_tokenizer
647650

648651
# Resolve and validate the exact selected source before graph construction
649652
# so a deferred tokenizer cannot leave a graph-only directory behind.
650-
gguf_path = _resolve_gguf_path(gguf_path)
651-
gguf_model = GGUFModel(gguf_path)
652-
_validate_gguf_model(gguf_model, source=str(gguf_path))
653+
resolved_gguf_path = _resolve_gguf_path(gguf_path)
654+
gguf_model = GGUFModel(resolved_gguf_path)
655+
_validate_gguf_model(gguf_model, source=str(resolved_gguf_path))
656+
architecture_spec = get_arch_spec(gguf_model.architecture)
657+
if architecture_spec.runtime is not Support.SUPPORTED:
658+
raise SystemExit(
659+
f"Error: GGUF runtime packaging for {architecture_spec.gguf_arch!r} is "
660+
f"{architecture_spec.runtime.value}: {architecture_spec.reason}"
661+
)
653662
tokenizer_verdict = inspect_gguf_tokenizer(
654-
gguf_model.metadata, source=str(gguf_path), require_complete=True
663+
gguf_model.metadata, source=str(resolved_gguf_path), require_complete=True
655664
)
656665
if not tokenizer_verdict.materialized:
657666
raise SystemExit(
658667
f"Error: cannot emit a complete {runtime} package: {tokenizer_verdict.reason}"
659668
)
660669

661670
pkg = build_from_gguf(
662-
gguf_path,
671+
gguf_reference,
663672
mmproj=mmproj_path,
664673
dtype=args.dtype,
665674
keep_quantized=keep_quantized,
@@ -715,6 +724,7 @@ def _cmd_build_gguf(args: argparse.Namespace) -> None:
715724
gguf_path,
716725
output_dir,
717726
runtime=runtime,
727+
runtime_version=getattr(args, "runtime_version", None),
718728
external_data=args.external_data,
719729
max_shard_size_bytes=(
720730
_parse_size(args.max_shard_size) if args.max_shard_size else None
@@ -1251,6 +1261,14 @@ def build_parser() -> argparse.ArgumentParser:
12511261
"genai_config.json."
12521262
),
12531263
)
1264+
gguf_parser.add_argument(
1265+
"--runtime-version",
1266+
default=None,
1267+
help=(
1268+
"Exact selected runtime version. Required once an architecture has a "
1269+
"runtime-supported evidence record; it must equal the version validated there."
1270+
),
1271+
)
12541272
gguf_parser.add_argument(
12551273
"--static-cache",
12561274
action="store_true",

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
# Multimodal (text + companion mmproj vision/audio encoder)
1919
pkg = build_from_gguf("path/to/model.gguf", mmproj="path/to/mmproj.gguf")
2020
21-
# Write a directory the runtime can actually load (graph + tokenizer +
22-
# inference metadata). Saving only the graph produces a package that
23-
# loads nowhere.
24-
write_gguf_runtime_package(pkg, "path/to/model.gguf", "out_dir")
21+
# Runtime packaging is fail-closed and currently unavailable because no
22+
# architecture has complete real-artifact runtime evidence.
2523
2624
:func:`build_from_gguf` is the single entry point; passing ``mmproj`` delegates
2725
to :func:`build_gemma4_vlm_from_gguf` for the multimodal assembly.

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

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,24 +690,32 @@
690690
tensor_map_recipe=("llama",),
691691
tensor_processor="llama",
692692
llama_qk_permute=True,
693+
runtime=Support.DEFERRED,
694+
reason=_RUNTIME_VALIDATION_PENDING,
693695
),
694696
GGUFArchitectureSpec(
695697
gguf_arch="deci",
696698
model_type="llama",
697699
tensor_map_recipe=("llama",),
698700
tensor_processor="llama",
699701
llama_qk_permute=True,
702+
runtime=Support.DEFERRED,
703+
reason=_RUNTIME_VALIDATION_PENDING,
700704
),
701705
# ----------------------------------------------------------------- Qwen
702706
GGUFArchitectureSpec(
703707
gguf_arch="qwen2",
704708
model_type="qwen2",
705709
tensor_map_recipe=("llama",),
710+
runtime=Support.DEFERRED,
711+
reason=_RUNTIME_VALIDATION_PENDING,
706712
),
707713
GGUFArchitectureSpec(
708714
gguf_arch="qwen3",
709715
model_type="qwen3",
710716
tensor_map_recipe=("llama",),
717+
runtime=Support.DEFERRED,
718+
reason=_RUNTIME_VALIDATION_PENDING,
711719
),
712720
GGUFArchitectureSpec(
713721
gguf_arch="dflash",
@@ -903,13 +911,17 @@
903911
model_type="gemma",
904912
tensor_map_recipe=("llama",),
905913
tensor_processor="unoffset_norm",
914+
runtime=Support.DEFERRED,
915+
reason=_RUNTIME_VALIDATION_PENDING,
906916
),
907917
GGUFArchitectureSpec(
908918
gguf_arch="gemma2",
909919
model_type="gemma2",
910920
tensor_map_recipe=("llama", "gemma2_extras"),
911921
tensor_processor="unoffset_norm",
912922
config_postprocessor="gemma2",
923+
runtime=Support.DEFERRED,
924+
reason=_RUNTIME_VALIDATION_PENDING,
913925
),
914926
GGUFArchitectureSpec(
915927
gguf_arch="gemma3",
@@ -919,6 +931,8 @@
919931
# `+1` baked into every *norm.weight must be removed on import.
920932
tensor_processor="unoffset_norm",
921933
config_postprocessor="gemma3",
934+
runtime=Support.DEFERRED,
935+
reason=_RUNTIME_VALIDATION_PENDING,
922936
),
923937
GGUFArchitectureSpec(
924938
gguf_arch="gemma4",
@@ -930,12 +944,16 @@
930944
# corrupt every norm.
931945
config_postprocessor="gemma4",
932946
vlm_builder="gemma4",
947+
runtime=Support.DEFERRED,
948+
reason=_RUNTIME_VALIDATION_PENDING,
933949
),
934950
# -------------------------------------------------------------- Various
935951
GGUFArchitectureSpec(
936952
gguf_arch="phi3",
937953
model_type="phi3",
938954
tensor_map_recipe=("phi3",),
955+
runtime=Support.DEFERRED,
956+
reason=_RUNTIME_VALIDATION_PENDING,
939957
),
940958
GGUFArchitectureSpec(
941959
gguf_arch="baichuan",
@@ -990,12 +1008,16 @@
9901008
gguf_arch="falcon",
9911009
model_type="falcon",
9921010
tensor_map_recipe=("falcon",),
1011+
runtime=Support.DEFERRED,
1012+
reason=_RUNTIME_VALIDATION_PENDING,
9931013
),
9941014
GGUFArchitectureSpec(
9951015
gguf_arch="gpt2",
9961016
model_type="gpt2",
9971017
tensor_map_recipe=("gpt2",),
9981018
tensor_processor="gpt2",
1019+
runtime=Support.DEFERRED,
1020+
reason=_RUNTIME_VALIDATION_PENDING,
9991021
),
10001022
GGUFArchitectureSpec(
10011023
gguf_arch="mamba",
@@ -1198,20 +1220,25 @@
11981220
gguf_arch="starcoder2",
11991221
model_type="starcoder2",
12001222
tensor_map_recipe=("llama",),
1223+
runtime=Support.DEFERRED,
1224+
reason=_RUNTIME_VALIDATION_PENDING,
12011225
),
12021226
GGUFArchitectureSpec(
12031227
gguf_arch="stablelm",
12041228
model_type="stablelm",
12051229
tensor_map_recipe=("llama",),
1230+
runtime=Support.DEFERRED,
1231+
reason=_RUNTIME_VALIDATION_PENDING,
12061232
),
12071233
GGUFArchitectureSpec(
12081234
gguf_arch="internlm2",
12091235
model_type="internlm2",
12101236
tensor_map_recipe=("llama",),
12111237
tensor_processor="llama",
12121238
llama_qk_permute=True,
1239+
runtime=Support.DEFERRED,
12131240
quantized_import=Support.REJECTED,
1214-
reason=_NO_QUANTIZED_PROJECTION_REASON,
1241+
reason=_RUNTIME_VALIDATION_PENDING + " " + _NO_QUANTIZED_PROJECTION_REASON,
12151242
),
12161243
GGUFArchitectureSpec(
12171244
gguf_arch="olmo",
@@ -1221,13 +1248,17 @@
12211248
required_metadata=("attention.layer_norm_epsilon",),
12221249
tensor_processor="llama",
12231250
llama_qk_permute=True,
1251+
runtime=Support.DEFERRED,
1252+
reason=_RUNTIME_VALIDATION_PENDING,
12241253
),
12251254
GGUFArchitectureSpec(
12261255
gguf_arch="olmo2",
12271256
model_type="olmo2",
12281257
tensor_map_recipe=("llama", "olmo2_extras"),
12291258
config_postprocessor="dense_sliding",
12301259
required_metadata=("attention.layer_norm_rms_epsilon",),
1260+
runtime=Support.DEFERRED,
1261+
reason=_RUNTIME_VALIDATION_PENDING,
12311262
),
12321263
GGUFArchitectureSpec(
12331264
gguf_arch="olmoe",
@@ -1439,6 +1470,8 @@
14391470
required_metadata=("attention.layer_norm_rms_epsilon",),
14401471
tensor_processor="llama",
14411472
llama_qk_permute=True,
1473+
runtime=Support.DEFERRED,
1474+
reason=_RUNTIME_VALIDATION_PENDING,
14421475
),
14431476
GGUFArchitectureSpec(
14441477
gguf_arch="exaone",
@@ -1453,12 +1486,16 @@
14531486
model_type="nemotron",
14541487
tensor_map_recipe=("llama",),
14551488
tensor_processor="unoffset_norm",
1489+
runtime=Support.DEFERRED,
1490+
reason=_RUNTIME_VALIDATION_PENDING,
14561491
),
14571492
GGUFArchitectureSpec(
14581493
gguf_arch="hunyuan-dense",
14591494
model_type="hunyuan_v1_dense",
14601495
aliases=frozenset({"hunyuan_v1_dense"}),
14611496
tensor_map_recipe=("llama", "hunyuan_extras"),
1497+
runtime=Support.DEFERRED,
1498+
reason=_RUNTIME_VALIDATION_PENDING,
14621499
),
14631500
GGUFArchitectureSpec(
14641501
gguf_arch="muse-glimmer",
@@ -1470,6 +1507,8 @@
14701507
config_postprocessor="muse_glimmer",
14711508
vlm_builder="muse_glimmer",
14721509
llama_qk_permute=True,
1510+
runtime=Support.DEFERRED,
1511+
reason=_RUNTIME_VALIDATION_PENDING,
14731512
),
14741513
GGUFArchitectureSpec(
14751514
gguf_arch="deepseek4",
@@ -1535,6 +1574,7 @@
15351574
gguf_arch="bloom",
15361575
model_type="bloom",
15371576
tensor_map=Support.DEFERRED,
1577+
runtime=Support.DEFERRED,
15381578
quantized_import=Support.REJECTED,
15391579
reason=_NO_TENSOR_MAP,
15401580
),

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,15 +1551,11 @@ def _expected_rows() -> list[str]:
15511551
return rows
15521552

15531553
def test_the_doc_table_matches_the_registry(self) -> None:
1554-
text = self._DOC.read_text(encoding="utf-8")
1555-
assert self._BEGIN in text and self._END in text, (
1556-
f"{self._DOC} is missing the generated support-matrix markers"
1557-
)
1558-
block = text.split(self._BEGIN, 1)[1].split(self._END, 1)[0]
1559-
documented = [line for line in block.splitlines() if line.startswith("| `")]
1560-
assert documented == self._expected_rows(), (
1561-
"docs/api/build_from_gguf.md is out of date with the architecture "
1562-
"registry. Regenerate the support matrix between its markers."
1554+
from mobius.integrations.gguf._docs import check_document
1555+
1556+
assert check_document(), (
1557+
"docs/api/build_from_gguf.md is out of date; run "
1558+
"`python scripts/generate_gguf_support_docs.py`."
15631559
)
15641560

15651561

0 commit comments

Comments
 (0)