fused_moe_kernel - cast accumulator after applying router weights#32002
Merged
DarkLight1337 merged 1 commit intovllm-project:mainfrom Jan 10, 2026
Merged
fused_moe_kernel - cast accumulator after applying router weights#32002DarkLight1337 merged 1 commit intovllm-project:mainfrom
DarkLight1337 merged 1 commit intovllm-project:mainfrom
Conversation
Signed-off-by: gnovack <gnovack@amazon.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request correctly addresses the accuracy regression and test failures by ensuring the router weights are applied to the accumulator in float32 precision before casting to the compute_type. The change moves the type casting to after the router weight multiplication, which restores the intended numerical behavior. The code is also simplified by removing redundant type casts. The changes look good and are well-justified by the test results provided in the description.
varun-sundar-rabindranath
approved these changes
Jan 10, 2026
Contributor
varun-sundar-rabindranath
left a comment
There was a problem hiding this comment.
LGTM! Thanks @gnovack
Contributor
|
cc @mgoin PTAL 🙌 |
mgoin
approved these changes
Jan 10, 2026
Member
mgoin
left a comment
There was a problem hiding this comment.
Seems reasonable to me, thanks for the fix
akh64bit
pushed a commit
to akh64bit/vllm
that referenced
this pull request
Jan 16, 2026
…lm-project#32002) Signed-off-by: gnovack <gnovack@amazon.com>
dsuhinin
pushed a commit
to dsuhinin/vllm
that referenced
this pull request
Jan 21, 2026
…lm-project#32002) Signed-off-by: gnovack <gnovack@amazon.com> Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
ItzDEXX
pushed a commit
to ItzDEXX/vllm
that referenced
this pull request
Feb 19, 2026
…lm-project#32002) Signed-off-by: gnovack <gnovack@amazon.com>
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
The
tests/lora/test_olmoe_tp.py test_olmoe_lora_mixedtest case has been failing since #31676 was merged. Previously the application ofmoe_weight(router weights) to theaccumulatorwas performed infloat32, but after #31676, this computation is now done afteraccumulatorhas been cast tocompute_type.This change in behavior caused the above test case to begin failing, and introduced a slight accuracy degradation based on lm-eval results on
gsm8kandmmlu_pro.Results Before #31676:
Results on main:
Test Plan
Test Result
tests/lora/test_olmoe_tp.py test_olmoe_lora_mixedis passing now.lm-eval results after the change in this PR:
Note
Cursor Bugbot is generating a summary for commit e78572a. Configure here.
Note
Adjusts compute order in the Triton
fused_moe_kernelto improve numerical behavior.b_scale/a_scaledequant multipliers without early casting; defersaccumulator.to(compute_type)until after addingbiasand multiplying routermoe_weightint8_w8a16, multiply byb_scale; forfp8_w8a8/int8_w8a8tensor-wise or per-channel (non-block-wise), multiply bya_scale * b_scalevllm/model_executor/layers/fused_moe/fused_moe.pyWritten by Cursor Bugbot for commit e78572a. This will update automatically on new commits. Configure here.