feat: accept opaque string envelopes for routed_experts#2089
Merged
ananthsub merged 1 commit intoJul 21, 2026
Conversation
Contributor
Author
|
/ok to test c4d96c4 |
ananthsub
approved these changes
Jul 21, 2026
Training frameworks attach per-token routed-expert indices ([tokens, num_moe_layers, topk]) to chat responses for MoE router replay. As nested JSON int lists these are multi-MB payloads (~11.7M ints at 30k-token contexts) that every gym hop re-parses, re-validates, and re-serializes at ~1s of single-threaded CPU each, throttling rollout throughput. Widen RoutedExperts to Union[str, List[List[List[int]]]] so a single opaque envelope string (e.g. NeMo-RL's nrlre1:<dtype>:<SxLxK>:<base64>) passes through validation in O(1). Gym never inspects the value; the one non-passthrough site (harbor nemo_gym_llm _extract_routed_experts isinstance-list guard, which would silently drop a string) is widened to match. Nested-list payloads remain fully supported. Companion to the NeMo-RL change that emits the envelope; measured there: gym rollout time 132.2s -> 35.4s per step at 15-28k-token prompts with replay fidelity unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Zeyu Zhou <zezhou@nvidia.com>
ananthsub
force-pushed
the
zezhou/routed-experts-b64-envelope
branch
from
July 21, 2026 17:16
c4d96c4 to
bb8e661
Compare
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.
Training frameworks attach per-token routed-expert indices ([tokens, num_moe_layers, topk]) to chat responses for MoE router replay. As nested JSON int lists these are multi-MB payloads that every gym hop re-parses, re-validates, and re-serializes at ~1s of single-threaded CPU each, throttling rollout throughput.
Widen RoutedExperts to Union[str, List[List[List[int]]]] so a single opaque envelope string (e.g. NeMo-RL's nrlre1:::) passes through validation in O(1). Gym never inspects the value; the one non-passthrough site (harbor nemo_gym_llm _extract_routed_experts isinstance-list guard, which would silently drop a string) is widened to match. Nested-list payloads remain fully supported.