Skip to content

Register qwen3_5_moe_text for text-only Qwen3.6 export - #445

Open
justinchuby wants to merge 1 commit into
mainfrom
feat/qwen3.6-text-only
Open

Register qwen3_5_moe_text for text-only Qwen3.6 export#445
justinchuby wants to merge 1 commit into
mainfrom
feat/qwen3.6-text-only

Conversation

@justinchuby

Copy link
Copy Markdown
Member

What

Adds the missing text-only registry sibling for Qwen3.6-35B-A3B (Qwen/Qwen3.6-35B-A3B, HF model_type=qwen3_5_moe with a vision_config).

Every other Qwen/Gemma VL family registers a *_text sibling (gemma3_text, qwen3_vl_text, qwen3_5_vl_text), but the MoE VL did not. As a result:

  • registry.get("qwen3_5_moe_text") raised KeyError (the VL text_config's own model_type is qwen3_5_moe_text); and
  • build(..., text_only=True) on the VL checkpoint failed — no _TEXT_ONLY_MODEL_TYPE entry for qwen3_5_moe_vl.

How

Qwen35MoECausalLMModel.preprocess_weights already strips the language_model. prefix, drops visual./MTP keys, and unpacks fused MoE experts, so it consumes the VL text weights directly (no new class needed).

  • Register qwen3_5_moe_textQwen35MoECausalLMModel.
  • Wire _TEXT_ONLY_MODEL_TYPE: qwen3_5_moe_vlqwen3_5_moe_text (+ idempotent self-map).
  • Add default-id (Qwen/Qwen3.6-35B-A3B) and family (qwen) map entries.
  • Add an L1 build-graph tiny config reusing the qwen3_5_moe hybrid-MoE config (added to _CHECKER_SKIP_MODELS like its sibling, since it uses LinearAttention/CausalConvWithState custom ops).

Verification

  • L1 build + registry-completeness pass; broader qwen suite green (107 passed).
  • Verified against the real Qwen3.6 config (config-only) that both text_only=True routing and text_config.model_type now resolve to Qwen35MoECausalLMModel (previously a KeyError).

Note: a full weight-level (L4/L5) export requires the 35B checkpoint + GPU and is out of scope here; this PR is the routing/registration fix with L1 coverage.

Please review — do not merge yet.

Qwen/Qwen3.6-35B-A3B ships model_type=qwen3_5_moe with a vision_config, so
the builder overrides it to qwen3_5_moe_vl and unwraps text_config (whose own
model_type is qwen3_5_moe_text). Unlike every other VL family (gemma3_text,
qwen3_vl_text, qwen3_5_vl_text), the MoE VL had no registered text-only
sibling, so:

  - registry.get("qwen3_5_moe_text") raised KeyError, and
  - build(..., text_only=True) on the VL checkpoint failed (no
    _TEXT_ONLY_MODEL_TYPE entry for qwen3_5_moe_vl).

Qwen35MoECausalLMModel already strips the language_model. prefix, drops
visual./MTP keys, and unpacks fused experts, so it consumes the VL text
weights directly. Register qwen3_5_moe_text -> Qwen35MoECausalLMModel, wire
the text-only override (qwen3_5_moe_vl -> qwen3_5_moe_text, idempotent
self-map), and add default-id/family map entries.

Add an L1 build-graph config (reusing the qwen3_5_moe hybrid MoE tiny config)
so registry-completeness passes and the new key builds. Verified against the
real Qwen3.6 config that both text_only routing and text_config.model_type
now resolve to Qwen35MoECausalLMModel.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: justinchuby <justinchuby@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 8a565d7b6d4db0

Model Sub-model Changes Status

No architecture changes detected.


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

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Performance Comparison

Comparing 8a565d7b6d4db0

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 68 68 +0.0%
gemma2 model_size_bytes 428 KB 428 KB +0.0%
gemma2 num_nodes 107 107 +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 62 62 +0.0%
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0%
llama (static-cache) num_nodes 58 58 +0.0%
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0%
mamba (ssm-text-generation) num_nodes 98 98 +0.0%
phi3 model_size_bytes 421 KB 421 KB +0.0%
phi3 num_nodes 60 60 +0.0%
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0%
phi3 (static-cache) num_nodes 56 56 +0.0%
qwen2 model_size_bytes 425 KB 425 KB +0.0%
qwen2 num_nodes 62 62 +0.0%
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0%
qwen2 (static-cache) num_nodes 58 58 +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 275 275 +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 129 129 +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 413 413 +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.

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

This PR fixes text-only export routing for the Qwen3.6-35B-A3B vision-language checkpoint by registering the missing qwen3_5_moe_text registry sibling and wiring the text_only=True remap path so the VL wrapper can export its text backbone as a standalone decoder-only model.

Changes:

  • Register qwen3_5_moe_textQwen35MoECausalLMModel and add text-only remapping qwen3_5_moe_vlqwen3_5_moe_text in _TEXT_ONLY_MODEL_TYPE.
  • Add L1 coverage via a tiny build-graph config for qwen3_5_moe_text and skip ONNX checker for it (same custom-op limitations as its sibling).
  • Add metadata for L2/family defaults (_TEST_MODEL_IDS, family override entries) so dashboards/tests can resolve the new model_type.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/build_graph_test.py Add qwen3_5_moe_text to the ONNX-checker skip list to avoid known checker limitations for these custom-op graphs.
tests/_test_configs.py Add a representative tiny config entry for qwen3_5_moe_text (hybrid linear/full attention + MoE) for L1/L3 coverage.
src/mobius/_registry.py Register qwen3_5_moe_text, add text-only remap for qwen3_5_moe_vl, and attach default test model id + family metadata for the new type.

Comment thread src/mobius/_registry.py
Comment on lines +801 to +805
# Qwen3.5-MoE-VL (Qwen3.6-35B-A3B): export just the hybrid MoE text
# backbone as a standalone decoder-only LLM. The builder overrides
# ``qwen3_5_moe`` -> ``qwen3_5_moe_vl`` when a ``vision_config`` is present,
# so the text-only override keys off the VL type here.
"qwen3_5_moe_vl": "qwen3_5_moe_text",
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.

2 participants