Repository navigation
Allow GGUF export with deferred tokenizers - #693
Merged
Merged
Conversation
Performance Comparison
|
Contributor
There was a problem hiding this comment.
Pull request overview
Enables GGUF export to proceed when tokenizer materialization is deferred/blocked by introducing a component-level export report (export_report.json) and structured warnings, while keeping model/graph validation fail-closed and preserving validated runtime claims only when exact evidence matches.
Changes:
- Add
ComponentExportReport/ComponentExportDispositionand persistexport_report.jsonviaModelPackage.save/load. - Introduce GGUF partial-export policy + structured warnings (tokenizer blocker / runtime-unvalidated) and thread these dispositions through GGUF build + runtime packaging (including multimodal).
- Relax runtime packaging from hard-fail to “runtime-unvalidated” fallback when exact runtime evidence is unavailable, while still enforcing exact artifact identity and other fail-closed checks.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/gguf_test.py | Adds end-to-end tests for partial exports, warnings, CLI behavior, and multimodal/report propagation. |
| src/mobius/integrations/gguf/_tokenizer.py | Extends tokenizer verdict with stable diagnostics fields for deferred/blocked routes. |
| src/mobius/integrations/gguf/_tokenizer_test.py | Verifies authoritative blocker diagnostics and alias evidence wiring. |
| src/mobius/integrations/gguf/_tokenizer_evidence.py | Adds exact blocker-evidence matcher and refactors sequence digest logic. |
| src/mobius/integrations/gguf/_tokenizer_evidence_test.py | Tests blocker evidence matching behavior. |
| src/mobius/integrations/gguf/_runtime_package.py | Exports validated runtime packages when evidence matches, otherwise exports runtime-unvalidated packages + report. |
| src/mobius/integrations/gguf/_runtime_package_test.py | Expands runtime packaging tests for unvalidated/validated flows and tokenizer omission policy. |
| src/mobius/integrations/gguf/_runtime_evidence.py | Adds RuntimeEvidenceUnavailableError and splits “find match” vs “raise on missing” behavior. |
| src/mobius/integrations/gguf/_docs.py | Updates GGUF docs to describe partial exports, warnings, and report semantics. |
| src/mobius/integrations/gguf/_component_export.py | New module implementing component-aware export policy, report attachment, and structured warnings. |
| src/mobius/integrations/gguf/_builder.py | Ensures GGUF builds (including multimodal) attach canonical identities/routes and tokenizer dispositions. |
| src/mobius/integrations/gguf/_builder_test.py | Adjusts builder tests for new report/runtime packaging behavior and multimodal identity preservation. |
| src/mobius/integrations/gguf/init.py | Updates public GGUF integration docs to reflect runtime-unvalidated fallback behavior. |
| src/mobius/_model_package.py | Adds export_report persistence, output-directory safety checks for partial/unvalidated exports, and export-report collisions. |
| src/mobius/_model_package_test.py | Adds roundtrip + safety tests for export_report.json persistence and save-path validation. |
| src/mobius/_export_report.py | New deterministic, validated schema for component dispositions and package-level export/runtime status. |
| src/mobius/main.py | Updates CLI build-gguf flow to support partial exports + prints status via export_report.json. |
| src/mobius/init.py | Exposes export-report types as part of the public API. |
| docs/api/build_from_gguf.md | Updates API docs to describe partial exports, warnings, and export_report.json. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
justinchuby
force-pushed
the
justinchuby-warn-tokenizer-blockers
branch
2 times, most recently
from
August 28, 2026 18:18
c5e0242 to
a711d5e
Compare
Preserve proven model and runtime components when authoritative tokenizer semantics are deferred or blocked. Emit one structured warning, omit unverified tokenizer assets, and persist generic component export/runtime validation dispositions. Keep architecture, tensor, graph, qtype, source identity, I/O, and unexpected failures fail-closed while reusing the runtime advisory packaging introduced on main. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Validate runtime evidence against final staged metadata bytes, classify every incomplete tokenizer route, and publish report-bearing model packages atomically. Preserve MTP runtime status semantics and extend the existing GGUF reuse rollback transaction to cover export and draft metadata. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Distinguish fully emitted but runtime-unvalidated packages from partial packages that actually omit components. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Reject corrupt present tokenizer fields before incomplete-route downgrades and transactionally manage quantization, export, and draft reports across GGUF reuse updates. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Defer unknown tokenizer semantics with explicit component diagnostics while keeping malformed known fields fail-closed and allowing validated named chat-template fields. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Do not pass through tokenizer repositories for deferred MTP routes, and scope tokenless mask-token metadata to recognized diffusion architectures. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
justinchuby
force-pushed
the
justinchuby-warn-tokenizer-blockers
branch
from
August 28, 2026 18:57
99e2dd0 to
960beed
Compare
justinchuby
added a commit
that referenced
this pull request
Aug 28, 2026
Regenerate the GGUF support document after rebasing the OCR projector matrix onto PR #693's export-status and tokenizer-reporting changes. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f96aa7b0-95a6-473f-a875-5883767c2a24 Signed-off-by: Justin Chu <[email protected]>
justinchuby
added a commit
that referenced
this pull request
Aug 28, 2026
## Summary - Add exact target/draft GGUF pair construction with separate cache namespaces, target hidden-state outputs, shared embedding/LM-head bridges, atomic package publication, and self-verifying graph identities. - Add a direct ONNX Runtime greedy coordinator for DFlash and EAGLE3 with accepted-prefix verification, target/draft cache rollback, compressed-vocabulary remapping, strict output-capacity bounds, and target-only baseline comparison. - Add a separate test-only direct ORT oracle that imports neither `DraftPairRunner` nor production transition helpers, derives target-layer/remap/block/mask contracts from raw immutable GGUF metadata, and compares production behavior against independently recorded transitions. - Make EAGLE3 consume real draft-owned embeddings, normalize GGUF/HuggingFace hidden-state indices correctly, and preserve fully-owned cross-width variants. - Semantically rebase onto exact current `main` at `d68f66418096e0fe9a073764b819d6898de314de`, integrating #696, #693, and #691 while retaining shared MTP cache/publication/status infrastructure without duplication. - Keep higher-level runtime compatibility advisory; no production revision pin or downstream runtime gate is added. ## Immutable evidence Evidence is bound in `testdata/evidence/gguf_draft_runtime_evidence.json` (13,293,887,389 bytes total, below the 16 GiB cap), including artifact/config/tokenizer/source/graph/package/runtime hashes. Separate SHA-256-bound independent traces record every proposal ID/remapped token and proposal-logit digest, posterior/accepted prefix/correction, target verification/replay logits and tokens, target/draft cache lengths and tensor digests before/tentative/committed/replay states, final cache states, exact counters, and the explicit batch-size-one reorder disposition. - **DFlash:** `Qwen/Qwen3-4B-GGUF@bc640142...` + `AtomicChat/Qwen3-4B-DFlash-GGUF@b53c7de6...`; 32/32 direct-ORT greedy tokens equal target-only, 18/75 proposals accepted, 3 multi-token rounds, 5 rejected-suffix rollbacks. Independent full-tensor Q8 source comparison: cosine `0.999879`, relative L2 `0.005406`. - **EAGLE3:** `Qwen/Qwen3-8B-GGUF@7c41481f...` + `williamliao/Qwen3-8B-EAGLE3-Speculator-GGUF@44480ff4...`; 32/32 direct-ORT greedy tokens equal target-only, 20/43 proposals accepted, 7 multi-token rounds, 10 rejected-suffix rollbacks. Independent pinned llama.cpp conversion matches all 15 tensor names, qtypes, shapes, and values exactly. - Pinned llama.cpp additionally exercised the real acceptance loops with 49/114 DFlash and 45/85 EAGLE3 accepted tokens. - Four mutations now alter execution before validation: wrong mapping/order is fed through target verification, draft-cache corruption is threaded into the next round, and target rollback corruption is replayed against full committed history. Each fails its distinct semantic invariant. Target Q4_K/Q6_K imports truthfully report lossy INT4 affine block-32 repacking; target-only and speculative comparisons use the same repacked target graph. Every target replay starts from an empty cache and rebuilds the complete prompt plus committed token history. Quantized batched verification and full-history replay can differ numerically, so both states are bound and maximum absolute differences are recorded (DFlash `1.967625`, EAGLE3 `0.912386`) while replay argmax tokens must match exactly. Draft replay likewise reconstructs the complete committed history from empty state. Production DFlash uses target-only tail generation when fewer than one fixed block remains; EAGLE3 caps each final proposal width to `remaining - 1`. Parametric tests prove target sessions, caches, and counters never process beyond requested `max_new_tokens` for remaining capacity 1 through width+1. The reference coordinator is batch-size 1 and truthfully reports beam/reorder unsupported. Higher-level execution remains `runtime_unvalidated` without gating export. ## Validation - Final exact-main broad non-integration suite: 9,668 passed, 64 skipped, 1 subtest passed. - Final affected draft+MTP+CLI/evidence/docs/census suite: 302 passed, 2 real-artifact probes skipped by opt-in. - Both immutable real-artifact probes were rerun after the three blocker fixes; all eight execution-mutating discriminator runs failed at their expected semantic invariants. - Pinned Ruff format/lint, generated GGUF docs, and focused isolated mypy passed. `_config_mapping.py` retains three unrelated pre-existing mypy errors outside the DFlash change. - Final medium review specifically verified execution-mutating discriminators, complete empty-cache target replay, bounded final-round production behavior, DFlash mask metadata propagation, and semantic #693/#691 conflict resolution; no significant findings remain. No CI monitoring or merge is requested. --------- Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
support_status,export_status, andruntime_validation_statusinexport_report.json.Final blocker evidence
tokenizer.chat_template.*. Unknown/near-miss fields defer asunsupported-tokenizer-metadata-fields; malformed known fields remain fatal even when unknown fields coexist.pre, embedded JSON, RWKV, token list, types/scores/merges, special IDs, booleans, suppress/charsmap, and chat templates validate before downgrade. Tokenless special IDs fail; onlymask_token_idon recognized masked-diffusion architectures is left to the graph contract.Validation
lintrunner, and diff check: clean.Publication preflight
Signed-off-byand required CopilotCo-authored-bytrailers. GPG signing was unavailable becausegpgis not installed.Exact revisions
82e31222c9dbc08d2ea825fd6265498f0f594019960beeddec616d10d83f5bebe0ecd157a64ff199