feat: correct routed_experts from sglang(trick of routing_replay)#884
Merged
rchardx merged 31 commits intoinclusionAI:mainfrom Mar 2, 2026
Merged
feat: correct routed_experts from sglang(trick of routing_replay)#884rchardx merged 31 commits intoinclusionAI:mainfrom
rchardx merged 31 commits intoinclusionAI:mainfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
24fc9c1 to
7adde36
Compare
rchardx
reviewed
Feb 24, 2026
rchardx
reviewed
Feb 24, 2026
rchardx
reviewed
Feb 24, 2026
rchardx
reviewed
Feb 24, 2026
rchardx
reviewed
Feb 24, 2026
rchardx
reviewed
Feb 24, 2026
Collaborator
|
(Moved to inline comment on |
rchardx
reviewed
Feb 26, 2026
rchardx
reviewed
Feb 26, 2026
rchardx
reviewed
Feb 26, 2026
Collaborator
Author
|
/gemini review |
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for retrieving routed_experts information from the sglang backend, which is useful for analyzing Mixture of Experts (MoE) models. The changes span across configuration, data structures, and engine logic to propagate the option and handle the returned data. The implementation looks good, with proper error handling for unsupported backends and documentation updates. I have a couple of suggestions to improve maintainability by adding a clarifying comment and removing a redundant validation check.
Comment on lines
+97
to
+99
| num_sgl_token = ( | ||
| meta_info["prompt_tokens"] + meta_info["completion_tokens"] - 1 | ||
| ) |
Contributor
Comment on lines
+599
to
+602
| if self.config.rollout.return_routed_experts: | ||
| raise ValueError( | ||
| "return_routed_experts is not supported with vLLM backend. Please disable return_routed_experts or switch to SGLang backend." | ||
| ) |
Contributor
leandermaben
pushed a commit
to leandermaben/AReaL
that referenced
this pull request
Mar 24, 2026
…nclusionAI#884) The routing replay becomes a trick for stabilizing the RL training in MOE. The sglang 0.5.7 has support to return routed_experts in API. Therefore this P.R support to get the routed_experts from sglang, which will be put into Megatron later. --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Wentai Zhang <zhangwentai.zwt@antgroup.com>
SathyaGnanakumar
pushed a commit
to danielkiely/AReaL
that referenced
this pull request
Apr 29, 2026
…nclusionAI#884) The routing replay becomes a trick for stabilizing the RL training in MOE. The sglang 0.5.7 has support to return routed_experts in API. Therefore this P.R support to get the routed_experts from sglang, which will be put into Megatron later. --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Wentai Zhang <zhangwentai.zwt@antgroup.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.
Description
The routing replay proposed in this Paper becomes a trick for stabilizing the RL training in MOE.
The sglang 0.5.7 has support to return
routed_expertsin API.therefore this P.R support to get the routed_experts from sglang, which will be put into Megatron later.
To test with:
python3 -m areal.launcher.local examples/math/gsm8k_rl.py --config examples/math/gsm8k_grpo.yaml gconfig.return_routed_experts=TrueRelated Issue
N/A
Type of Change
work as expected)
Checklist
jb build docs/gemini review)Breaking Change Details (if applicable):
Additional Context
Need help? Check the Contributing Guide or ask in
GitHub Discussions!