Skip to content

Preserve original GGUF weights with opset 29 - #827

Merged
justinchuby merged 9 commits into
mainfrom
justinchuby-qwen38-compatibility
Nov 17, 2026
Merged

justinchuby merged 9 commits into
mainfrom
justinchuby-qwen38-compatibility

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Keep packed and typed GGUF tensors in their original files as ONNX external data. Use DequantizePacked, exact layout operations, selected-row embedding decoding, and GroupedMatMul for ordinary gated experts.

Remove lossy affine rounding/requantization; unsupported legacy routes and floating reparameterizations now fail explicitly. Consolidate GGUF docs and add a per-format/per-architecture survey.

Current scope is flat, little-endian packages. Runtime kernels, selected-bank fusion, multi-component packaging, and remaining architecture contracts are documented gaps. DequantizePacked-29 addresses the primary representation request in onnx/onnx#8359.

justinchuby and others added 4 commits November 13, 2026 09:06
Normalize the upstream indexed_attention spelling to the existing QSA implementation, preserving checkpoint full_attention compatibility. Compare position history at its current indexer-cache owner while retaining support for older Transformers references.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Bind packed and typed GGUF tensors directly to their original external byte ranges. Lower exact layout operations, use grouped expert matmuls where appropriate, and preserve source bindings through optimization and package roundtrips.

Remove lossy affine rounding and requantization routes, fail closed on unsupported layouts and floating reparameterization, and refresh the bounded per-format/per-architecture survey. Consolidate obsolete GGUF design documentation.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
@justinchuby
justinchuby requested review from a team and a balanced review from Copilot November 15, 2026 20:31
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing d6d45b77 → 191c80d3

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 68 68 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 68 68 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 109 109 +0.0% ⚪
gpt2 model_size_bytes 324 KB 324 KB +0.0% ⚪
gpt2 num_nodes 54 54 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 60 60 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 56 56 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 94 94 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 58 58 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 54 54 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 60 60 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 271 271 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 133 133 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 463 463 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 176 176 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing d6d45b77 → 191c80d3

Model Sub-model Changes Status
bert (feature-extraction) model 0 ⚪
falcon model 0 ⚪
gemma2 model 0 ⚪
gemma4 (gemma4) decoder 0 ⚪
gemma4 (gemma4) embedding 0 ⚪
gemma4 (gemma4) vision_encoder 0 ⚪
gemma4_text model 0 ⚪
gpt2 model 0 ⚪
llama model 0 ⚪
llama (static-cache) model 0 ⚪
mamba (ssm-text-generation) model 0 ⚪
phi3 model 0 ⚪
phi3 (static-cache) model 0 ⚪
qwen model 0 ⚪
qwen (static-cache) model 0 ⚪
qwen2 model 0 ⚪
qwen2 (static-cache) model 0 ⚪
qwen2_moe model 0 ⚪
qwen2_moe (static-cache) model 0 ⚪
qwen3 model 0 ⚪
qwen3 (static-cache) model 0 ⚪
qwen3_5_moe (hybrid-text-generation) model 0 ⚪
qwen3_5_text (hybrid-text-generation) model 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) decoder 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) embedding 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) vision_encoder 0 ⚪
qwen3_moe model 0 ⚪
qwen3_moe (static-cache) model 0 ⚪
qwen3_next (hybrid-text-generation) model 0 ⚪
t5 (seq2seq) decoder 0 ⚪
t5 (seq2seq) encoder 0 ⚪
whisper (speech-to-text) decoder 0 ⚪
whisper (speech-to-text) encoder 0 ⚪

No architecture changes detected. ✅


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Packed-package saves and loads fail on supported Python 3.10, and the packed-save path bypasses required weight validation, allowing models with missing initializer weights to be saved.

2 open issues
What changed in this PR

Adds an experimental opset-29 GGUF import path that integrates with Mobius’s existing graph builder while retaining original weight files as ONNX external data. Runtime kernel support remains separate.

Changes:

  • Adds exact weight-layout operations, selected-row embedding decoding, and GroupedMatMul graphs for ordinary experts.
  • Removes lossy legacy conversions and adds source-integrity checks and optimization safeguards.
  • Updates tests and GGUF documentation, plus Qwen4 attention-label compatibility.
File Description
src/​mobius/​models/​qwen4_exp_test.py Tests attention aliases and updated reference cache positions.
src/​mobius/​integrations/​gguf/​_shard_set.py Identifies the original shard owning each tensor.
src/​mobius/​integrations/​gguf/​_repacker.py Removes lossy repacking and rejects unsupported conversions.
src/​mobius/​integrations/​gguf/​_repacker_test.py Replaces lossy-conversion expectations with rejection checks.
src/​mobius/​integrations/​gguf/​_reader.py Exposes tensor ownership without reading payloads.
src/​mobius/​integrations/​gguf/​_quant_registry.py Restricts legacy routes to supported exact representations.
src/​mobius/​integrations/​gguf/​_quant_registry_test.py Updates expected routes and rejection behavior.
src/​mobius/​integrations/​gguf/​_quant_capabilities.py Updates capability reporting and evidence references.
src/​mobius/​integrations/​gguf/​_quant_capabilities_test.py Verifies revised capability claims.
src/​mobius/​integrations/​gguf/​_packed.py Adds external bindings, layout translation, selected-row decoding, and persistence.
src/​mobius/​integrations/​gguf/​_packed_test.py Covers formats, parity, integrity, round trips, and optimization protection.
src/​mobius/​integrations/​gguf/​_opset29_survey_test.py Validates survey coverage without implying runtime qualification.
src/​mobius/​integrations/​gguf/​_mtp_test.py Updates unsupported quantized-head and explicit-float expectations.
src/​mobius/​integrations/​gguf/​_kimi_k3_test.py Replaces removed quantized-import expectations with rejection checks.
src/​mobius/​integrations/​gguf/​_granite_test.py Tests rejection of an unsupported fused quantized layout.
src/​mobius/​integrations/​gguf/​_docs.py Adds survey results to generated capability documentation.
src/​mobius/​integrations/​gguf/​_builder.py Wires packed imports and grouped experts into the build pipeline.
src/​mobius/​integrations/​gguf/​_builder_core_test.py Removes obsolete lossy-route tests and updates diagnostics.
src/​mobius/​integrations/​gguf/​_builder_architectures_test.py Removes expectations for discontinued quantized fallback routes.
src/​mobius/​components/​_moe.py Adds GroupedMoELayer for ordinary bias-free experts.
src/​mobius/​components/​__init__.py Exports the grouped-expert component.
src/​mobius/​_optimizations.py Protects original external weights from constant folding.
src/​mobius/​_model_package.py Integrates packed-package save and load handling.
src/​mobius/​_configs/​_base.py Normalizes indexed_attention as Qwen sparse attention.
docs/​design/​qwen4-exp-text-core.md Explains accepted Qwen attention labels.
docs/​design/​gguf-support-proposal.md Replaces historical proposals with the current import design.
docs/​api/​build_from_gguf.md Documents experimental usage, packaging limits, and migration.

Review effort: Balanced

Comment thread src/mobius/_model_package.py Resolved
Comment thread src/mobius/integrations/gguf/_packed.py Resolved
Preserve missing-weight validation and Python 3.10-compatible source hashing. Gate experimental GGUF tests on installed standard schemas, qualify them in the existing current-ONNX CI job, and fail before source loading when schemas are absent.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Annotate the pytest monkeypatch fixture to avoid version-dependent trailing-comma formatting in CI.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
@justinchuby
justinchuby requested a balanced review from Copilot November 15, 2026 21:22
Comment thread .github/workflows/main.yml Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Gather replacement renames a public graph output, breaking callers that request the original name; preserve the output name and verify it survives binding, saving, and loading.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread src/mobius/integrations/gguf/_packed.py Resolved
Keep the original Gather output name when replacing packed embedding reads, including graph outputs and package roundtrips. Remove the installed-schema prerequisite from construction; schema-aware checking remains separate.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Use explicit standardized packed layouts instead of parsing runtime schema docs during binding. Exercise unavailable schema lookup in the construction regression and conditionally run schema conformance checks in the supported CI leg.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Limit schema skips to checker, optimizer validation, grouped construction and reference execution. Keep per-codec binding and package integrity coverage in released-ONNX jobs. Collect and upload dedicated opset29 coverage and JUnit reports, retaining CI artifacts.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
@justinchuby
justinchuby merged commit c8fb589 into main Nov 17, 2026
24 of 27 checks passed
@justinchuby
justinchuby deleted the justinchuby-qwen38-compatibility branch November 17, 2026 18:17
justinchuby added a commit that referenced this pull request Nov 17, 2026
)

Stacked on #827.

Extend exact grouped dispatch to ordinary/shared experts and Flash-Next
fused expert banks. Add original-byte multi-component/MTP packaging and
functional standalone Janus-Pro mmproj conversion. Align LinearAttention
with merged independent value heads and optional recurrence
trajectories.

The capability survey documents remaining specialized-architecture,
projector, runtime-fusion and whole-model rollback restrictions; this
does not claim universal efficient MoE execution.

---------

Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants