Skip to content

Change GraniteSwitch inheritance to MoEShared - #133

Draft
antonpibm wants to merge 3 commits into
mainfrom
feature/dehybridize-moeshared
Draft

antonpibm wants to merge 3 commits into
mainfrom
feature/dehybridize-moeshared

Conversation

@antonpibm

Copy link
Copy Markdown
Collaborator

No description provided.

Remove the hybrid (mamba/SSM) dependency from GraniteSwitch. The switch
model is attention-only and never constructs a mamba layer, so it does not
need the GraniteMoeHybrid family — GraniteMoeShared provides every class it
actually uses (shared MLP, MoE, RMSNorm, RoPE, PreTrainedModel base) minus
the mamba machinery.

HF backend:
- GraniteSwitchConfig now extends GraniteMoeSharedConfig; modeling and
  core/lora imports repointed to the granitemoeshared twins.
- layer_types / position_embedding_type become switch-owned attributes
  (the shared parent does not declare them, but internal readers still
  depend on them).

shared_intermediate_size fix: the shared parent defaults it to 0, which is
also the "no shared MLP" sentinel for pure sparse-MoE bases. The config now
resolves it itself instead of inheriting a magic default — explicit values
(including 0) are honored verbatim; when unset, dense resolves to
intermediate_size and pure MoE keeps 0. This is a compose-time decision
frozen into config.json; it also closes a latent bug where a bare dense
config silently inherited the old 1024 default. Guarded by new unit tests.

composer: granite_moe_hybrid_arch/_sr_arch renamed to
granite_moe_shared_arch/_sr_arch. The "granitemoehybrid" registry key is
retained (mapped to the shared arch) because real Granite 4.x dense
checkpoints are still typed granitemoehybrid upstream; a "granitemoeshared"
key is added alongside.

vLLM backend:
- Removed the vestigial IsHybrid / HasInnerState marker mixins (no hybrid
  contract was implemented).
- The two borrowed upstream classes (GraniteMoeMoE, GraniteMoeSharedMLP)
  now load via a version-tolerant helper that prefers the non-hybrid
  granitemoe / granitemoeshared modules and falls back to granitemoehybrid,
  so a single codebase works across the pinned vLLM versions.

Local CPU tests pass (unit, config sis-trap, composer arch skinning, HF
granite4 equivalence, HF forward/lora/multi-switch). vLLM and GPU
generation tests to run on the cluster.

Signed-off-by: antonp <[email protected]>
eval/gen_smoke.py loads a composed Granite Switch checkpoint in vLLM and
generates the same question with the base path and with each adapter's
control token, printing the outputs so a reviewer can confirm the
de-hybridized (granitemoeshared) backend both loads and routes adapters.
Used by the Vela validation job (vela_yamls/dehybridize_vllm_gen.yaml).

Signed-off-by: antonp <[email protected]>
Signed-off-by: antonp <[email protected]>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@antonpibm

Copy link
Copy Markdown
Collaborator Author

/gpu-test-multi

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