Raise EP routed-row pricing to each checkpoint's observed routing - #981
Draft
bradhilton wants to merge 8 commits into
Draft
bradhilton wants to merge 8 commits into
bradhilton wants to merge 8 commits into
Conversation
At EP>1 TrainerRank prices the rows each rank's experts receive at a fixed allowance over balanced routing (1.4x at EP2); skew beyond it went unseen. Record each checkpoint's worst-layer routed share at the micro-batch handoff, from HybridEP's retained tokens_per_expert, through the existing handoff MAX reduce (EP>1 only: share, epoch, -epoch). A share is recorded only when every rank observed the same checkpoint route epoch. Epochs are assigned after a load or snapshot commits on every rank, never reused, and forgotten on reload or discard. When a checkpoint's share plus a 0.10 margin exceeds the allowance, its balanced routed rows are scaled up to match. Charges never go down. The share is reported in last_forward_telemetry() and planner-miss reports. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Review follow-ups: - Loads and snapshot discards now check that every rank targets the same name and route epoch, so every rank forgets and assigns the same epochs. - Cancellation during the observation still reaches the handoff exchange, as a failed forward. - Epochs at or above 2**40 are not observed, so float64 transport stays exact. - No-grad waves are observed: they dispatch the same way, and observations only raise charges. - A snapshot starts from its source's share, since it has the same weights. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 26, 2026 05:13 — with
GitHub Actions
Error
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
deployed
to
trainer-rank-gpu-validation
September 26, 2026 05:23 — with
GitHub Actions
Active
bradhilton
marked this pull request as ready for review
September 26, 2026 15:53
bradhilton
deployed
to
trainer-rank-gpu-validation
September 26, 2026 15:54 — with
GitHub Actions
Active
bradhilton
marked this pull request as draft
September 26, 2026 16:08
bradhilton
deployed
to
trainer-rank-gpu-validation
September 26, 2026 23:14 — with
GitHub Actions
Active
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
deployed
to
trainer-rank-gpu-validation
September 26, 2026 23:54 — with
GitHub Actions
Active
This was referenced Sep 27, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 27, 2026 00:32 — with
GitHub Actions
Error
This branch was successfully deployed
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.
At EP>1, TrainerRank prices the rows each rank's experts receive at a fixed allowance over balanced routing (1.4x at EP2). A checkpoint whose routing is more skewed than that is under-priced every time, and nothing notices. This PR measures each checkpoint's routed share on the micro-batch wave path. When that share plus a 0.10 margin exceeds the allowance, the checkpoint's routed rows are raised to match. Observations never lower a charge. Reloading a checkpoint starts over from the allowance.
Scope: HybridEP with the EP group equal to the CP group and TP/ETP 1, the only path where routed rows are priced from the CP group.
What changes
forward_micro_batcheswave with one group (with or without gradients), each rank reads the worst layer's received pairs, divided by top-k times the balanced rows that pricing starts from.dp_rank_forward, split and multi-group waves record nothing. They are still priced from whatever the checkpoint has recorded.epoch, -epoch. A share is recorded only if every rank observed the same epoch. An empty, unsupported, failed, cancelled or different-checkpoint rank records nothing, so every rank keeps an identical table.snapshot_checkpointstarts from its source's share, since it has the same weights. A snapshot loaded from disk starts cold._plan_group_routed_rowsscales a group's balanced rows by (share + 0.10) / allowance when that exceeds 1. The scaled rows feed every consumer: plan cost, admission, splits and the checkpoint floor.last_forward_telemetry()["routed_share"]gives each wave's observed share. Planner-miss reports include it, along with the share behind each group's routed rows.Before/after
Not in this PR: pricing below the allowance (the "warm discount" of Part B2). It waits on measurements that this PR makes possible.
Testing:
Stacked on #978 (itself on #963); neither base is merged, so review after them.
🤖 Generated with Claude Code