Skip to content

feat: support Granite MoE SWA expert defusion - #71

Merged
Qubitium merged 1 commit into
mainfrom
feat/granitemoe-swa-defusion
Nov 13, 2026
Merged

Qubitium merged 1 commit into
mainfrom
feat/granitemoe-swa-defusion

Conversation

@ZX-ModelCloud

Copy link
Copy Markdown
Collaborator

Summary

Add granitemoe_swa to the public model registry and defuse its packed routed-expert tensors through the existing generic path.

The Granite MoE SWA checkpoint stores every routed expert as a fused experts.gate_up_proj tensor plus experts.down_proj. Conversion now exposes numbered per-expert gate_proj / up_proj / down_proj linear modules while leaving the shared expert MLP and router untouched. No model-specific replacement class or forward patch is required.

granite_swa (dense) is not registered because it has no packed expert or fused MLP tensors to defuse.

Changes

  • Register granitemoe_swa in defuser/model_registry.py.
  • Add meta-model coverage for GraniteMoeSWAExperts.
  • Add forward-equivalence coverage for the standard routed-expert conversion path.
  • Document the model type in the README support table.
  • Bump the package version to 0.0.30.

Validation

Targeted tests:

pytest "tests/test_meta_model_defusion.py::test_each_model_defuses_direct_meta_model[granitemoe_swa]" \
       "tests/test_candidate_coverage.py::test_standard_moe_candidates_convert_and_preserve_forward[granitemoe_swa]" \
       tests/test_candidate_coverage.py::test_model_registry_covers_all_scanned_candidates
# 3 passed

The new conversion preserves the original expert forward outputs (torch.testing.assert_close) and leaves all meta parameters on the meta device.

Note: the broader meta-model and candidate-coverage suites contain pre-existing failures for unrelated model types whose upstream Transformers classes have changed. Those failures are present on main before this change and are not caused by this PR.

Register granitemoe_swa in the public model registry and add meta-model
and forward-equivalence coverage. The checkpoint stores routed experts
as packed gate_up_proj/down_proj tensors; the generic defusion path
splits them into numbered gate_proj/up_proj/down_proj linears while
keeping the shared expert MLP intact.

Bump the package version to 0.0.30.
@Qubitium
Qubitium merged commit 7657694 into main Nov 13, 2026
28 checks passed
@Qubitium
Qubitium deleted the feat/granitemoe-swa-defusion branch November 13, 2026 07:59
Qubitium pushed a commit to ModelCloud/GPTQModel that referenced this pull request Nov 13, 2026
#3833)

Add granite_swa and granitemoe_swa model definitions.

- granite_swa reuses the Llama decoder layout; the learnable attention
  sinks stay in their source dtype while the attention and MLP
  projections are quantized.
- granitemoe_swa relies on Defuser's registered granitemoe_swa support to
  split packed routed-expert gate_up_proj/down_proj tensors into
  per-expert linears; the router stays non-quantized and the shared
  SwiGLU MLP stays quantizable.

Bump the Defuser floor to 0.0.30 for the new registry entry. Register both
model types, add the module-plan and fusion-admission inventory entries,
add real meta-model module-tree tests, and add GPTQ evaluation tests for
both checkpoints. Update the README support table and the fusion coverage
counts.

Depends on ModelCloud/Defuser#71.
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