Skip to content

[ModelOpt] Unify MoE methods onto QuantSpec + ModelOptMoEMethod - #55997

Open
ima-helikoptaaa wants to merge 6 commits into
vllm-project:mainfrom
ima-helikoptaaa:feat/modelopt-unified-moe-method
Open

ima-helikoptaaa wants to merge 6 commits into
vllm-project:mainfrom
ima-helikoptaaa:feat/modelopt-unified-moe-method

Conversation

@ima-helikoptaaa

@ima-helikoptaaa ima-helikoptaaa commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Purpose

Unify ModelOpt MoE the same way #49381 unified linear methods.

One factory (build_moe_method) and one method class (ModelOptMoEMethod).
resolve() still builds the QuantSpec. MoE looks up a weight-key scheme in
MOE_SCHEME_FOR (not linear SCHEME_FOR).

Folds ModelOptFp8MoEMethod, ModelOptNvFp4FusedMoE, and
ModelOptMxFp8FusedMoE into ModelOptMoEMethod. Config classes stay split.
Deepseek V4 NVFP4 experts go through the same factory.

Mixed block-FP8 MoE (FP8_PB_WO / FP8_BLOCK_SCALES) continues to use
Fp8MoEMethod.

Related: #55339

Test Plan

Unit:

pytest tests/quantization/test_modelopt.py -k "not checkpoint_setup"

Parity, same method as #49381 (VLLM_BATCH_INVARIANT=1, --enforce-eager,
old vs new weight/kernel hash and prefill logit delta) on every ModelOpt MoE
format this PR serves:

Format Checkpoint class Weight/kernel hash Logit delta GSM8K
FP8 per-tensor MoE ModelOpt FP8 MoE pending pending pending
NVFP4 W4A4 MoE ModelOpt NVFP4 pending pending pending
W4A16 NVFP4 MoE ModelOpt W4A16_NVFP4 pending pending pending
MXFP8 MoE ModelOpt MXFP8 pending pending pending

Also:

  • mixed-precision checkpoint (linear + MoE, including block-FP8 MoE experts)
  • Deepseek V4 NVFP4 experts (moe_quant_algo=NVFP4)

GSM8K settings match #49381: 1319 Q, 5-shot, T=0, 512 tok.

Test Result

Unit tests added or updated in tests/quantization/test_modelopt.py.
Parity hashes, logit deltas, and GSM8K for the four MoE formats are still
pending. Results will be filled into the table above.

(Optional) Documentation

No new model. Existing design docs now point at ModelOptMoEMethod.

Not duplicating existing work

This is the MoE half of the ModelOpt QuantKey rewrite. #49381 already landed
the linear side and left MoE on the old per-format classes. This PR replaces
those classes. Mixed block-FP8 MoE from #55513 stays on Fp8MoEMethod.

AI assistance

AI assistance (Cursor) was used to draft and edit the change. I reviewed
every changed line and own the behavior. This is not a pure-agent PR.

ima-helikoptaaa and others added 6 commits September 9, 2026 09:00
Unify homogeneous and mixed-precision MoE construction behind one helper,
matching build_linear_method, and drop the unused FusedMoEMethodCls pointer.

Co-authored-by: Cursor <cursoragent@cursor.com>
…thod.

FP8-family MoE now goes through resolve() like linears; NVFP4 and MXFP8 stay on their per-format classes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Route NVFP4 / W4A16 through resolve() like FP8 and delete ModelOptNvFp4FusedMoE. MXFP8 stays on its own class.

Co-authored-by: Cursor <cursoragent@cursor.com>
All ModelOpt MoE algos now go through resolve() and one method class; delete ModelOptMxFp8FusedMoE.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move FP8, NVFP4, and MXFP8 expert create/process/quant_config onto
per-weight-key schemes so ModelOptMoEMethod stays a thin dispatcher.
Refuse linear-only PcPt/PB_WO at the factory and cover mixed MoE dispatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
After rebasing onto vllm-project#55513, mixed FP8_PB_WO experts are vLLM block-FP8,
not a skip. Only PcPt mixed MoE stays unquantized.

Co-authored-by: Cursor <cursoragent@cursor.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify

mergify Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--55997.org.readthedocs.build/en/55997/

@mergify mergify Bot added documentation Improvements or additions to documentation deepseek Related to DeepSeek models quantization DSv4 labels Sep 9, 2026
@mergify

mergify Bot commented Sep 10, 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, @ima-helikoptaaa.

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 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepseek Related to DeepSeek models documentation Improvements or additions to documentation DSv4 needs-rebase quantization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant