Repository navigation
[MoE] Validate grouped AutoEP top-k routing - #8630
Merged
tohtana merged 3 commits intoNov 26, 2026
Merged
Conversation
Signed-off-by: HR-zengzzz <hrzeng123456@gmail.com>
Silas-Zeng
requested review from
hwchen2017,
loadams,
tjruwase and
tohtana
as code owners
September 22, 2026 19:46
Contributor
Author
|
Hi @tjruwase @hwchen2017 @tohtana @loadams, could one of you take a look at this PR? It adds early validation to prevent grouped AutoEP routing from selecting masked-out experts when top_k exceeds the number of experts available in the selected groups. Regression tests are included for both the router constructor and post-detection validation. I’d appreciate your feedback. Thanks! |
tohtana
approved these changes
Nov 25, 2026
tohtana
left a comment
Collaborator
There was a problem hiding this comment.
Thank you @Silas-Zeng, and sorry for the delay. This looks good to me.
tohtana
enabled auto-merge
November 25, 2026 00:00
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 26, 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.
Problem
Grouped AutoEP masks experts outside the selected groups before
topk. Whentop_kexceeds the available experts,torch.topkfills the remaining slots with masked-infentries and can produce routes outside the configured groups.Change
Reject the invalid configuration before router construction and during post-detection validation. Update the native MoE
kdocumentation to match its arbitrary top-k implementation.Validation
flake8on changed files.yapf --diffon changed files.git diff --check.compileallon changed files.