Conversation
Pad shared FP8 gate/up and down weights and their scales to match the routed intermediate size. Retain checkpoint-shaped parameters for generic post-load processing and test preservation and fallback behavior. Co-authored-by: Codex <noreply@openai.com> Signed-off-by: Canlin <canlinguosdu@gmail.com>
gcanlin
marked this pull request as ready for review
September 12, 2026 06:28
gcanlin
requested review from
AndreasKaratzas,
DarkLight1337,
ywang96 and
zyongye
as code owners
September 12, 2026 06:28
Contributor
Author
|
cc @WoosukKwon @zyongye. This PR is for DSv4.1 specific shared expert dim |
This was referenced Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
#56217
DeepSeek-V4.1-Flash's 2304-wide shared expert cannot fuse with MegaMoE's routed experts padded to 2560. Pad shared weights with zeros and unit scales to enable fusion in all 40 layers, preserving checkpoint-shaped parameters and the unsupported-layout fallback.
Extends #53040. Checks of #45861 and related open PRs found no fix for this padding gap; #53567 and #54049 cover different paths.
AI assistance was used for implementation, testing, and documentation.
Test Plan
Deploy
Use a fresh server per arm:
VLLM_DISABLE_DSV4_MEGAMOE_SHARED_EXPERT_FUSION=1for serial shared experts,0for fused. The omitted load-time hook verifies fusion state on all 8 ranks.Benchmark
Workloads follow #53040, plus 8192/1024 at C16. V4.1 uses block size 128 and FP8 indexer cache.
GSM8K evaluation reproduction
Use lm-eval 0.4.12, the same fusion flag, and a fresh server per arm.
Run the full test split in the lm-eval environment, with separate output directories:
OPENAI_API_KEY=EMPTY uv run --active --no-project python -m lm_eval run \ --model local-chat-completions \ --model_args model=dsv41-gsm8k,base_url=http://127.0.0.1:8031/v1/chat/completions,num_concurrent=64,timeout=600,max_retries=2,max_gen_toks=1024,max_length=16384,seed=123 \ --tasks gsm8k --num_fewshot 5 --batch_size 1 \ --apply_chat_template --fewshot_as_multiturn \ --gen_kwargs max_gen_toks=1024 temperature=0.0 do_sample=False "chat_template_kwargs={'thinking': False}" \ --seed 123,123,123,123 --log_samples --output_path results/gsm8k-fusedTest Result
31 tests passed on B200. Ruff, typos, mypy 3.10/3.12, and applicable pre-commit checks passed; nonmatching Actionlint and requirements-compilation hooks were skipped.
All 8 ranks confirmed 0 → 40 fused layers. Model-load memory increased from 41.47 to 43.34 GiB/rank (+1.87 GiB) because the original shared parameters remain allocated.
8×B200, TP8/EP/SP, FP8 KV, 16K context.
vllm bench serve: 2 warmups/run, median of 3 runs except 8192/1024 (1 run), no profiler. All 1,256 requests succeeded with the requested token counts. Both arms used source30aa0ade39ab6625674865f578fae19a49cf3e43+ this patch, native builde7edf17cea217e52701f913cd8491fcacf2d9490, and PyTorch 2.13.0+cu130.Negative latency changes mean lower latency. C1 has only 8 requests/run, so tail-latency estimates are limited.
C64's first run hit quantization JIT in both arms. Excluding it from both changes the throughput gain from +17.7% to +16.6%.