Skip to content

fix deepep tokens_per_expert - #2053

Open
PengchengShi00 wants to merge 1 commit into
InternLM:mainfrom
PengchengShi00:fix-deepep
Open

fix deepep tokens_per_expert#2053
PengchengShi00 wants to merge 1 commit into
InternLM:mainfrom
PengchengShi00:fix-deepep

Conversation

@PengchengShi00

Copy link
Copy Markdown
Collaborator

Summary

Fix DeepEP expert assignment counting by deriving num_out_tokens and tokens_per_expert directly from the received topk_ids, instead of relying on num_recv_tokens_per_expert_list.
This ensures that permute and grouped GEMM use the same expert assignment layout, preventing tokens from being processed by incorrectly aligned local experts. Additional assertions validate local expert IDs and assignment counts.
After this fix, the train-inference discrepancy with DeepEP decreased from 0.004449 to 0.000364.

@jayhenry
jayhenry self-requested a review August 28, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant