Skip to content

Add opt-in R3 route-mismatch metric and targeted R3 CI checks - #2463

Open
kar137 wants to merge 1 commit into
THUDM:mainfrom
kar137:r3-route-mismatch
Open

kar137 wants to merge 1 commit into
THUDM:mainfrom
kar137:r3-route-mismatch

Conversation

@kar137

@kar137 kar137 commented Oct 11, 2026

Copy link
Copy Markdown

Rollout routing replay (R3) had no measure of the train/inference routing disagreement it removes and no check that the replay is aligned: the R3 e2e tests only passed --ci-test and the step-0 KL check is skipped under R3, so a replay off by one token or one layer still passed CI.

  • --log-r3-route-mismatch: during the training forward only, count per MoE layer the real tokens (every token but each sample's last, without CP/TP padding) whose replayed expert set differs from the router's own top-k; all-reduce the counts and log train/r3_route_mismatch, _max, layer and _min_tokens. Off by default and R3-only.
  • --ci-r3-route-mismatch-threshold: under --ci-test, assert that every MoE layer replayed real tokens and that the worst layer stays under the bound. Both R3 e2e tests pass the metric and a bound.
  • RoutingReplay.assert_all_consumed expects backward pops only for the routers activation recompute re-runs, and runs on the R3 path under --ci-test.

Rollout routing replay (R3) had no measure of the train/inference routing
disagreement it removes and no check that the replay is aligned: the R3
e2e tests only passed --ci-test and the step-0 KL check is skipped under
R3, so a replay off by one token or one layer still passed CI.

- --log-r3-route-mismatch: during the training forward only, count per
  MoE layer the real tokens (every token but each sample's last, without
  CP/TP padding) whose replayed expert set differs from the router's own
  top-k; all-reduce the counts and log train/r3_route_mismatch, _max,
  _layer_<i> and _min_tokens. Off by default and R3-only.
- --ci-r3-route-mismatch-threshold: under --ci-test, assert that every MoE
  layer replayed real tokens and that the worst layer stays under the
  bound. Both R3 e2e tests pass the metric and a bound.
- RoutingReplay.assert_all_consumed expects backward pops only for the
  routers activation recompute re-runs, and runs on the R3 path under
  --ci-test.

This branch has not been deployed

No deployments
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