Repository navigation
Prove DFlash and EAGLE3 GGUF draft runtime - #695
Merged
Merged
Conversation
Performance Comparison
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an end-to-end, target-coupled GGUF “draft pair” export and a direct ONNX Runtime greedy coordinator for DFlash and EAGLE3, with immutable evidence capture and documentation updates to reflect the new runtime-unvalidated but directly-executable workflow.
Changes:
- Introduces
build_draft_pair_from_gguf/write_draft_pair_packageto emit exact target+draft graph packages with separate cache namespaces, shared-weight bridges (embedding/LM-head), and self-verifying graph package identities. - Adds
DraftPairRunner(direct ORT coordinator) implementing speculative acceptance/rollback for DFlash and EAGLE3, including compressed-vocabulary remapping and target-only baseline comparison. - Updates EAGLE3 to optionally consume draft-owned embeddings and normalizes GGUF/HF hidden-state index conventions; adds tests + docs + CLI support (
--target-gguf) and evidence fixtures.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/gguf_draft_runtime_integration_test.py | Real-artifact integration probe gated by env var; verifies direct-ORT acceptance loop equals target-only. |
| testdata/evidence/gguf_draft_runtime_evidence.json | Adds pinned evidence record for DFlash/EAGLE3 identities + direct-ORT results. |
| src/mobius/tasks/_eagle3.py | Task input contract updated to support input_ids when draft owns embeddings. |
| src/mobius/tasks/_draft_target.py | New task emitting target decoder + optional embedding/LM-head bridge graphs; supports shared initializer binding. |
| src/mobius/tasks/_draft_target_test.py | Unit test validating emitted decoder/embedding/head graphs and hidden-state outputs. |
| src/mobius/tasks/init.py | Exports DraftTargetCausalLMTask. |
| src/mobius/models/eagle3.py | Adds optional draft-owned embedding path; updates weight preprocessing and forward input validation. |
| src/mobius/models/_eagle3_test.py | Tests for owning embeddings, retaining embedding weights, and graph input selection. |
| src/mobius/integrations/gguf/_tensor_mapping.py | Maps EAGLE3 token_embd → embed_tokens. |
| src/mobius/integrations/gguf/_runtime_evidence.py | Extends graph package identity hashing with an explicit “selected files” mode + stricter validation. |
| src/mobius/integrations/gguf/_runtime_evidence_test.py | Tests selected-file identity stability and path-escape rejection. |
| src/mobius/integrations/gguf/_route_census.py | Treats draft arches with direct runtime as no longer “runtime unsupported” census work items. |
| src/mobius/integrations/gguf/_route_census_test.py | Updates expected census counts and ensures draft items are absent. |
| src/mobius/integrations/gguf/_draft.py | Tokenizer vocab trailing padding handling; stricter target config validation; pairing validation tightened; manifest runtime status updated. |
| src/mobius/integrations/gguf/_draft_test.py | Adds tokenizer padding/gap tests; updates embedding/head ownership behaviors; validates normalized hidden-state indices; CLI tests updated. |
| src/mobius/integrations/gguf/_draft_runtime.py | New DraftPairRunner coordinator + verified snapshotting + external-data closure enforcement. |
| src/mobius/integrations/gguf/_draft_runtime_test.py | Unit tests for embedding bridge selection, logits projection, external-data scanning, snapshot immutability. |
| src/mobius/integrations/gguf/_draft_runtime_evidence_test.py | Validates evidence schema bounds and asserts evidence demonstrates real speculative work. |
| src/mobius/integrations/gguf/_draft_pair.py | New draft-pair builder/writer producing multi-component packages + manifest binding + atomic publish. |
| src/mobius/integrations/gguf/_draft_pair_test.py | Tests target artifact binding, bf16 rejection, manifest persistence, runner verification/closure enforcement. |
| src/mobius/integrations/gguf/_docs.py | Adds draft runtime evidence summary + doc updates for the new draft-pair workflow. |
| src/mobius/integrations/gguf/_config_mapping.py | Normalizes EAGLE3 hidden-state indices and detects draft-owned embedding presence. |
| src/mobius/integrations/gguf/_builder.py | Allows task to be a ModelTask instance; adds output_layer_indices plumbing; binds shared initializers post-build. |
| src/mobius/integrations/gguf/_arch_registry.py | Updates draft runtime reason text to reflect direct-ORT evidence + runtime-unvalidated stance. |
| src/mobius/integrations/gguf/init.py | Exposes draft-pair builder/writer and DraftPairRunner API. |
| src/mobius/_model_package.py | Extends ModelPackage with draft-pair metadata fields. |
| src/mobius/_configs/_base.py | Adds use_draft_token_embedding to Eagle3Config and defaults it for speculators-format HF configs. |
| src/mobius/main.py | Adds --target-gguf path and routes draft-pair builds through the new builder/writer. |
| docs/cli_reference.md | Documents --target-gguf. |
| docs/api/build_from_gguf.md | Updates API doc to reference draft-pair workflow and includes evidence summary snippet. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
justinchuby
force-pushed
the
justinchuby-prove-draft-model-evidence
branch
3 times, most recently
from
August 28, 2026 18:58
a3853d3 to
a995cd2
Compare
Add exact target/draft package construction and a direct ONNX Runtime coordinator for DFlash and EAGLE3. Preserve independent cache namespaces, accepted-prefix rollback, target bridges, EAGLE-owned embeddings, and immutable graph/package identities. Record bounded source and raw-GGUF evidence for deterministic target-only token equality and real multi-token acceptance while keeping higher-level runtime compatibility advisory. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Reuse the merged MTP cache-port and runtime_unvalidated status conventions for target-coupled draft packages. Bind the manifest through the runtime-payload hash and revalidate both GGUF sources throughout atomic publication. Preserve requested runtime/version metadata while keeping direct ORT evidence artifact-scoped and higher-level execution advisory. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
ORT session inputs are immutable and each draft step returns new present-cache arrays, so retain the existing accepted cache dictionary as the rollback baseline instead of cloning every tensor each round. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Build the draft-pair usage paragraph from wrapped source fragments while preserving the generated single-line documentation and its concision contract. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Exercise DFlash and EAGLE3 through a test-only direct ONNX Runtime coordinator that derives its contract from raw GGUF metadata instead of production transition helpers. Bind per-round proposal, replay, cache, rollback, and mutation evidence and compare production aggregate behavior against the independent trace. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Derive EAGLE3 synthetic input dtypes from the direct ORT session and preserve assertion-shaped trace mismatches under current lint rules. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Separate draft architecture and direct-runtime capability sets, and rebuild independent oracle draft caches from empty state through committed history instead of replaying only the latest transition. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Move mutation discriminators into proposal, cache, and rollback execution; replay the complete target history from empty cache; and bound final speculative rounds so sessions, counters, and caches never advance past max_new_tokens. Regenerate both immutable direct-ORT traces under the corrected semantics. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
justinchuby
force-pushed
the
justinchuby-prove-draft-model-evidence
branch
from
August 28, 2026 19:42
a995cd2 to
3ce6560
Compare
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
DraftPairRunnernor production transition helpers, derives target-layer/remap/block/mask contracts from raw immutable GGUF metadata, and compares production behavior against independently recorded transitions.mainatd68f66418096e0fe9a073764b819d6898de314de, integrating Add standalone GGUF audio projector routes #696, Allow GGUF export with deferred tokenizers #693, and Add OCR and document GGUF projector cohort #691 while retaining shared MTP cache/publication/status infrastructure without duplication.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.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: cosine0.999879, relative L20.005406.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.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, EAGLE30.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 requestedmax_new_tokensfor remaining capacity 1 through width+1. The reference coordinator is batch-size 1 and truthfully reports beam/reorder unsupported. Higher-level execution remainsruntime_unvalidatedwithout gating export.Validation
_config_mapping.pyretains three unrelated pre-existing mypy errors outside the DFlash change.No CI monitoring or merge is requested.