Skip to content

[Model] Add DeepGEMM MegaMoE support to GLM with compressed-tensors MXFP4 - #55275

Closed
tlrmchlsmth wants to merge 38 commits into
vllm-project:mainfrom
tlrmchlsmth:feature/glm-megamoe
Closed

tlrmchlsmth wants to merge 38 commits into
vllm-project:mainfrom
tlrmchlsmth:feature/glm-megamoe

Conversation

@tlrmchlsmth

@tlrmchlsmth tlrmchlsmth commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Purpose

Extend the deep_gemm_mega_moe backend to DeepSeek-derived GLM model
implementations without changing compressed-tensors NVFP4 weights into a
different FP4 encoding.

This change:

  • adds MegaMoE adapters for DeepSeek V2/V3.2 and GLM-5-next, including their
    MTP paths;
  • supports unquantized BF16 and checkpoint-native MXFP4 expert weights;
  • rejects compressed-tensors NVFP4 expert checkpoints instead of performing a
    lossy NVFP4-to-E2M1/UE8M0 conversion;
  • preserves grouped routing, deferred-reduction, and sequence-parallel
    semantics;
  • puts the reusable expert implementation in a shared module; DSv4 and Kimi K3
    model files and the existing DSv4 tests are unchanged;
  • covers the adapters, checkpoint-format selection, and explicit NVFP4
    rejection with focused tests.

Duplicate-work check

This does not duplicate the open related work:

Test plan and results

Local checks after splitting the shared implementation from DSv4:

pre-commit run
# all hooks passed on the staged split

.venv/bin/python -m pytest tests/models/test_deep_gemm_mega_moe.py tests/models/test_deepseek_v4_mega_moe.py -q
# 11 passed, 29 skipped (CUDA/SM100 unavailable locally)

The CPU tests cover checkpoint-format selection, NVFP4 rejection, mocked
BF16/MXFP4 loading and finalization, expert mapping, and deferred-reduction
scaling. Non-compressed-tensors quantization configurations are not rejected
by the MXFP4 format predicate.

DSv4 migration is kept separately on
feature/dsv4-shared-megamoe,
stacked on this PR. No follow-up PR has been opened. Kimi K3 file changes are
omitted from both branches.

The following results predate this extraction; no new GPU or model-accuracy
evaluation was run for the split.

GB200 kernel validation performed earlier on the PR:

  • Random FP8 x FP4 MegaMoE, four ranks: relative L2 0.0252-0.0276 and cosine
    similarity greater than 0.9996.
  • Exact GLM topology (EP8 across two GB200 nodes, hidden size 6144,
    intermediate size 2048, 256 experts, top-k 8): all ranks produced finite
    outputs.

MXFP4 performance validation used RedHatAI/GLM-5.2-MXFP4xMXFP8 on two GB200
nodes with TP8/EP8. At concurrency 64, DeepGEMM MegaMoE reached 927.8 output
tokens/s, compared with 562.2 for TP8, 540.2 for EP8 with AGRS and CUTLASS
MXFP4, and 237.8 for EP8 with DeepEP-v2 and CUTLASS MXFP4. All 2,269 recorded
requests across the four runs completed successfully. These are single-run
client-side measurements, not repeated trials; Prometheus/DCGM series were not
exported.

No NVFP4 model evaluation is claimed: compressed-tensors NVFP4 is deliberately
unsupported by this PR because conversion into DeepGEMM's different FP4
representation showed unacceptable source-level error.

AI assistance

AI assistance was used to implement, debug, test, and draft this change.
Human review of the latest split and relevant GPU/model validation are pending.

tlrmchlsmth and others added 18 commits September 3, 2026 18:35
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify mergify Bot added deepseek Related to DeepSeek models kimi k3 glm DSv4 labels Sep 4, 2026
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@mergify

mergify Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @tlrmchlsmth.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 5, 2026
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@mergify mergify Bot removed the needs-rebase label Sep 8, 2026
@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88564 for commit 80893b14f903.

tlrmchlsmth and others added 3 commits September 12, 2026 17:06
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@tlrmchlsmth

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88670 for commit c4cab4255685.

@tlrmchlsmth tlrmchlsmth changed the title [Model] Add GLM and compressed-tensors support to MegaMoE [Model] Add DeepGEMM MegaMoE support to GLM and enable compressed-tensors format for MegaMoE generally Sep 13, 2026
@mergify

mergify Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @tlrmchlsmth.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 14, 2026
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@tlrmchlsmth tlrmchlsmth changed the title [Model] Add DeepGEMM MegaMoE support to GLM and enable compressed-tensors format for MegaMoE generally [Model] Add DeepGEMM MegaMoE support to GLM, DeepSeek, and Kimi Sep 14, 2026
tlrmchlsmth and others added 2 commits September 14, 2026 14:39
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@tlrmchlsmth tlrmchlsmth changed the title [Model] Add DeepGEMM MegaMoE support to GLM, DeepSeek, and Kimi [Model] Add DeepGEMM MegaMoE support to GLM and DeepSeek models Sep 14, 2026
@mergify mergify Bot removed the needs-rebase label Sep 14, 2026
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@tlrmchlsmth tlrmchlsmth changed the title [Model] Add DeepGEMM MegaMoE support to GLM and DeepSeek models [Model] Add DeepGEMM MegaMoE support to GLM + CT DSv4 Sep 14, 2026
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@tlrmchlsmth tlrmchlsmth changed the title [Model] Add DeepGEMM MegaMoE support to GLM + CT DSv4 [Model] Add DeepGEMM MegaMoE support to GLM with compressed-tensors MXFP4 Sep 14, 2026
tlrmchlsmth and others added 3 commits September 14, 2026 15:18
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
@tlrmchlsmth

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #89108 for commit 79941a31a28e.

@mergify

mergify Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @tlrmchlsmth.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant