Skip to content

Commit 27c24d3

Browse files
justinchubyCopilot
andauthored
Prove GGUF quantized runtime capabilities (#661)
## Summary Follow-up to merged #659 and rebased onto current `main` (`cc3647ea`). - generate `testdata/evidence/gguf_quantization_capabilities.json` for all 25 stored qtypes and every projection, affine-only, output, embedding, expert-major, and non-MatMul route - separate parse/dequantization capability, packed target storage, source fidelity, operator ABI, compute capability, and real runtime evidence - retain Q4_K/Q6_K as supported lossy affine INT4 target-storage routes while reporting `source_fidelity=false`; dequantize/requantize is never labeled preserved - retain qtype-level runtime support only for the exact Q8_0 projection/output/embedding CPU route - keep all IQ/MXFP4 `pkg.nxrt::BlockQuantizedMatMul/v1` execution deferred; byte ABI compatibility is not execution evidence - strictly parse runtime import routes as duplicate-free JSON and require top-level `preserve_quantization` to be exactly boolean `true` - persist and hash-verify `quantization_report.json` in every evidenced graph/runtime package ## Pinned artifacts Selected total: **1,763,532,768 bytes** (1.64 GiB), below the 16 GiB policy. | Artifact | Bytes | SHA-256 | Result | |---|---:|---|---| | `Qwen/Qwen2.5-0.5B-Instruct-GGUF@9217f5db79a29953eb74d5343926648285ec7e67/qwen2.5-0.5b-instruct-q8_0.gguf` | 675,710,816 | `ca59ca7f13d0e15a8cfa77bd17e65d24f6844b554a7b6c12e07a5f89ff76844e` | Q8_0 source-faithful packed target; full logits, prefill + 20 decode steps, replay, rollback, reorder, deterministic generation; ORT 1.29.0 CPU and ORT GenAI 0.15.2 passed | | `unsloth/SmolLM2-135M-Instruct-GGUF@9e6855bc4be717fca1ef21360a1db4b29d5c559a/SmolLM2-135M-Instruct-Q4_K_M.gguf` | 105,454,144 | `ed5fa30c487b282ec156c29062f1222e5c20875a944ac98289dbd242e947f747` | lossy INT4 affine block-32 target storage succeeds with `source_fidelity=false`; explicit float import passed same-artifact full-logit prefill/decode and deterministic generation; runtime support remains deferred | | `neopolita/smollm-135m-gguf@22cca988936eafe92908e7558907c3964e10bba7/ggml-model-f16.gguf` | 270,885,504 | `ec8c775c16944a7e4b5251f97b3f848500dcc3e701b0d492ce9055cea42138a2` | float package/runtime evidence retained and regenerated post-#668 | | `LiquidAI/LFM2-350M-GGUF@8fdc9d526b7ed346b19257551b05816c7912ecc2/LFM2-350M-F16.gguf` | 711,482,304 | `379ffdcbf08147c0313f6f1ce7ff558a2bc935eda633f4b46c52347032419c42` | heterogeneous convolution/KV state package/runtime evidence retained and regenerated post-#668 | ## Post-#668 package identities | Route | Graph SHA-256 | Runtime package SHA-256 | |---|---|---| | SmolLM F16 / ONNX runtime | `4b608b099fb17471f342c925c20173f297abd0f8456c9e96a11b1d044272d1ad` | `57038e28e83a2b4251e334b6098f59b4344c7e526746e29d9fa42eeaebfcbddc` | | SmolLM F16 / ORT GenAI | same graph | `15d0218a4b326648d514a98c4f073251c674312b1faa83bec9022cc91daa0a53` | | Qwen2.5 Q8_0 / ORT GenAI | `240e5e374803c94efdb17eee39c09b0d3e9aed10b6d8b4e1c92e39918ea2155e` | `5029bbfcdd8d1ae1d2b0ed9587cc288a68cb38bb7f92b9e10f9bf64a436b1762` | | LFM2 F16 / ORT GenAI | `27e4ebb4c0c8b6c01ee57fa7825f34c5ddadc8ca5dc0c75d989e4507d4dcdfdb` | `ef3816d4f93c7061fd4653248629f0439d6ad1c623bdd0f27d31fe0349cb3505` | Every graph and runtime identity includes validated `quantization_report.json`; tests assert exact report save/load equality. ## Validation - 394 focused capability/registry/report/repacker/evidence/doc tests passed - 8,488 broad serial tests passed, 62 skipped, 12 deselected, 1 subtest passed - all 3 pinned real runtime-evidence routes passed together with zero process exit - pinned Q4_K_M lossy-target + explicit-float qualification passed - initialized pinned Ruff/format linters passed - strict changed-source mypy passed - final GPT-5.6 Sol medium independent review: no findings - all 17 prior lint review threads replied to and resolved ## Limitations - Native IQ/MXFP4 execution remains deferred pending pinned real-artifact full-logit and deterministic native-runtime proof. - ORT GenAI is optional downstream evidence and pinned here to 0.15.2; direct ORT evidence is pinned to 1.29.0 CPU. Do not merge directly. --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: da8e7ec7-2747-41aa-99eb-05a1c5227ce2
1 parent cc3647e commit 27c24d3

15 files changed

Lines changed: 3690 additions & 68 deletions

‎.github/workflows/ort_genai_e2e.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- name: Install pinned runtime and test dependencies
3737
run: |
3838
python -m pip install --disable-pip-version-check \
39+
"onnxruntime==1.29.0" \
3940
"onnxruntime-genai==0.15.2" \
4041
"pytest==8.4.2" \
4142
"pytest-timeout==2.4.0"
@@ -73,6 +74,7 @@ jobs:
7374
- name: Install pinned runtime and test dependencies
7475
run: |
7576
python -m pip install --disable-pip-version-check \
77+
"onnxruntime==1.29.0" \
7678
"onnxruntime-genai==0.15.2" \
7779
"pytest==8.4.2" \
7880
"pytest-timeout==2.4.0" \

‎docs/api/build_from_gguf.md‎

Lines changed: 36 additions & 31 deletions
Large diffs are not rendered by default.

‎scripts/generate_gguf_support_docs.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
1313

1414
from mobius.integrations.gguf._docs import DOC_PATH, update_document
15+
from mobius.integrations.gguf._quant_capabilities import (
16+
CAPABILITY_MATRIX_PATH,
17+
render_quantization_capability_matrix,
18+
)
1519

1620

1721
def main() -> None:
@@ -20,14 +24,21 @@ def main() -> None:
2024
args = parser.parse_args()
2125
generated = update_document()
2226
current = DOC_PATH.read_text(encoding="utf-8")
27+
capability_matrix = render_quantization_capability_matrix()
28+
current_capability_matrix = (
29+
CAPABILITY_MATRIX_PATH.read_text(encoding="utf-8")
30+
if CAPABILITY_MATRIX_PATH.exists()
31+
else ""
32+
)
2333
if args.check:
24-
if current != generated:
34+
if current != generated or current_capability_matrix != capability_matrix:
2535
raise SystemExit(
26-
"docs/api/build_from_gguf.md is stale; run "
36+
"GGUF generated docs or capability evidence is stale; run "
2737
"`python scripts/generate_gguf_support_docs.py`"
2838
)
2939
return
3040
DOC_PATH.write_text(generated, encoding="utf-8")
41+
CAPABILITY_MATRIX_PATH.write_text(capability_matrix, encoding="utf-8")
3142

3243

3344
if __name__ == "__main__":

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,10 @@ def _runtime_evidence_table() -> str:
312312
f"`{evidence.config_repository}@{evidence.config_revision}` | "
313313
f"`{evidence.tokenizer_repository}@{evidence.tokenizer_revision}`<br>{assets}<br>"
314314
f"metadata `{evidence.tokenizer_metadata_sha256}` | "
315-
f"{evidence.runtime} {evidence.runtime_version}; {evidence.parity_kind}; "
316-
f"{evidence.stateful_semantics} |"
315+
f"ONNX Runtime {evidence.onnxruntime_version} "
316+
f"`{evidence.execution_provider}`; {evidence.runtime} "
317+
f"{evidence.runtime_version}; result={evidence.result}; "
318+
f"{evidence.parity_kind}; {evidence.stateful_semantics} |"
317319
)
318320
return "\n".join(rows)
319321

@@ -570,6 +572,11 @@ def render_document() -> str:
570572
571573
## Stored quantization types
572574
575+
The generated machine-readable source for this table is
576+
`testdata/evidence/gguf_quantization_capabilities.json`. It records parse and exact
577+
dequantization support separately from conversion, names the implementation transform and
578+
operator ABI for every tensor role, and treats dequantize/requantize as non-preserving.
579+
573580
<!-- BEGIN GGUF QUANTIZATION MATRIX (generated; see _quant_registry.py) -->
574581
575582
{blocks["qtypes"]}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
MMPROJ_ARTIFACT_PINS,
2424
iter_projector_specs,
2525
)
26+
from mobius.integrations.gguf._quant_capabilities import (
27+
check_quantization_capability_matrix,
28+
)
2629
from mobius.integrations.gguf._quant_registry import iter_quant_specs
2730
from mobius.integrations.gguf._spec import StorageRole, Support
2831
from mobius.integrations.gguf._tokenizer_registry import tokenizer_pre_policies
@@ -31,11 +34,12 @@
3134

3235
def test_document_is_exact_generator_output() -> None:
3336
assert check_document()
37+
assert check_quantization_capability_matrix()
3438

3539

3640
def test_document_is_concise_and_reason_coded() -> None:
3741
document = Path("docs/api/build_from_gguf.md").read_text(encoding="utf-8")
38-
assert len(document.splitlines()) < 525
42+
assert len(document.splitlines()) < 535
3943
assert "RUNTIME_EVIDENCE_PENDING" in document
4044
assert "qwen3.5-0.8b-q4-tokenizer" in document
4145
assert "qwen2.5-0.5b-instruct-q8-tokenizer" in document

0 commit comments

Comments
 (0)