Skip to content

Fix Qwen3.6 Olive mixed-precision export - #515

Merged
titaiwangms merged 2 commits into
mainfrom
fix/qwen35-olive-mixed-precision
Aug 19, 2026
Merged

titaiwangms merged 2 commits into
mainfrom
fix/qwen35-olive-mixed-precision

Conversation

@titaiwangms

Copy link
Copy Markdown
Contributor

Summary

  • keep Qwen3.5/3.6-MoE GatedDeltaNet projections in floating point for Olive-format checkpoints
  • keep the shared-expert gate floating point while preserving quantized attention, shared-expert MLP, and fused QMoE experts
  • preserve existing dense, GPTQ/AWQ, and unquantized graph construction

This aligns Mobius with the module selection introduced by microsoft/Olive#2630 and unblocks the multimodal Qwen3.6-35B-A3B recipe in microsoft/olive-recipes#588.

Validation

  • python -m pytest -q src/mobius/models/qwen35_test.py src/mobius/components/_gated_deltanet_test.py src/mobius/components/_moe_test.py (57 passed)
  • targeted text/VL tests cover mixed initializer binding, dense Olive behavior, non-Olive graph preservation, and fused QMoE weights

Match Mobius graph construction to Olive's Qwen3.5/3.6-MoE quantization selection by keeping GatedDeltaNet projections and the shared-expert gate floating point while preserving quantized attention, shared experts, and QMoE weights.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: e10674c1-6909-4b09-9f5a-d41b28c89d2d
@titaiwangms
titaiwangms requested review from a team and a lite review from Copilot August 18, 2026 23:35
@github-actions

github-actions Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing 2481e3c → 192a8e6

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 60 60 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 105 105 +0.0% ⚪
gpt2 model_size_bytes 388 KB 388 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 264 264 +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 126 126 +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 428 428 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 166 166 +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 Aug 18, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 2481e3c → 192a8e6

Model Sub-model Changes Status
qwen model 0 ⚪
qwen (static-cache) model 0 ⚪
qwen3 model 0 ⚪
qwen3 (static-cache) model 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.

Pull request overview

Updates Mobius’ Qwen3.5/3.6-MoE export path to match Olive’s mixed-precision module selection so Olive-format checkpoints bind correctly (keeping specific projections/gates in floating point while preserving quantized attention, shared-expert MLP, and fused QMoE experts).

Changes:

  • Add an Olive-scoped opt-out so Qwen3.5/3.6 MoE linear_attn (GatedDeltaNet) projections and shared_expert_gate remain float while the rest of the decoder stays quantized.
  • Extend Qwen2MoELayer with shared_expert_gate_class to override the gate factory without affecting existing callers.
  • Add targeted unit tests covering mixed float/quantized layouts across MoE text/VL, dense Olive behavior, and non-Olive quantizers; document the change in the changelog.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/mobius/models/qwen35.py Adds Olive-only float-module exceptions for MoE linear_attn and shared_expert_gate while preserving existing quantized graph behavior elsewhere.
src/mobius/models/qwen35_test.py Adds focused tests validating mixed-precision module construction and state-dict preprocessing/binding behavior.
src/mobius/models/moe.py Adds shared_expert_gate_class override for Qwen2MoELayer to support float gate in otherwise-quantized checkpoints.
CHANGELOG.md Documents the Olive mixed-precision fix and the new shared_expert_gate_class API.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/mobius/models/moe.py Resolved
Comment thread src/mobius/models/qwen35.py Resolved

@justinchuby justinchuby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you explain why it's excluded? Is it due to accuracy reasons?

Co-authored-by: Copilot <[email protected]>

Copilot-Session: e10674c1-6909-4b09-9f5a-d41b28c89d2d
@titaiwangms

Copy link
Copy Markdown
Contributor Author

On why Olive excludes these modules: the two cases have slightly different motivations.

  • linear_attn is a GatedDeltaNet/SSM recurrent block. Olive deliberately excludes the whole subtree because its generic 2-D Linear quantization path was not intended/validated for projections feeding the state-space recurrence; this is primarily a support/correctness boundary rather than a measured Mobius accuracy choice.
  • shared_expert_gate is a [1, hidden] sigmoid gate controlling the always-active shared-expert contribution. Olive keeps routing-like signals in float, and int4 quantization is disproportionately lossy for a single-output-row gate, so accuracy is the reason there.

The Mobius change itself is a checkpoint-layout compatibility fix: post-#2630 Olive checkpoints contain float tensors for both groups. Building MatMulNBits modules for them produces packed-shape/scale initializers that do not exist, so export cannot bind the weights. The rest of the decoder remains quantized.

@titaiwangms
titaiwangms enabled auto-merge (squash) August 19, 2026 00:18
@titaiwangms
titaiwangms merged commit 1125b8a into main Aug 19, 2026
19 of 22 checks passed
@titaiwangms
titaiwangms deleted the fix/qwen35-olive-mixed-precision branch August 19, 2026 00:23
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