add routing confidence metric#2545
Open
faresobeid wants to merge 1 commit into
Open
Conversation
samsja
reviewed
May 18, 2026
| if values is None: | ||
| continue | ||
| value = values.mean() | ||
| reduce_op = dist.ReduceOp.MAX if name == "max_vio" else dist.ReduceOp.SUM |
Contributor
Author
There was a problem hiding this comment.
hmm what part? The if statement?
Member
There was a problem hiding this comment.
yeah dont like it but also not sure how to do better
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.
Adds metric from stepfun3.5 flash paper to measure stability of MoE models routing for RL (and the need for router replay)

Note
Medium Risk
Adds new MoE routing-stat accumulation and changes router forward return signatures, which could affect training correctness/perf if any call sites assume the old outputs. Changes are limited to telemetry/stat buffers and logging paths, not core loss/optimizer logic.
Overview
Adds a new MoE routing confidence metric by accumulating the selected-expert probability mass in MoE routers (
TokenChoiceTopKRouterandNemotronHRouter) and tracking it via a newrouting_confidence_sumbuffer onMoE/LatentMoE.Extends
get_load_balance_stats()to return bothmax_vioandrouting_confidence(and reset both), and wires the new metric into RL and SFT training logs/monitoring with appropriate distributed reduction (MAX formax_vio, mean across ranks forrouting_confidence).Reviewed by Cursor Bugbot for commit 57679b1. Bugbot is set up for automated code reviews on this repo. Configure here.