Merged
Conversation
e7ebaf2 to
a636b15
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.
PR README: feat: support router replay r2
Summary
Adds router replay r2 support to
SamplingClient.compute_logprobs, allowing MoE (Mixture of Experts) models to retrieve forward expert routing data when computing logprobs for use in subsequentforward_backwardtraining.Change Summary
de974c56a799b6f5e3ea27a8fea52ab42b44a705weaver/sampling_client.pyMain Changes
New parameter
router_replay_r2router_replay_r2: bool = Falsetocompute_logprobsTrue, the request body includesrouter_replay_r2: Trueso the server returns expert routing dataReturn value behavior
router_replay_r2=False(default): ReturnsList[float | None](per-token logprobs), same as beforerouter_replay_r2=True: Returns aDictwith:"logprobs": per-token logprobs"fwd_expert_replay_data": forward expert routing data (orNonefor non-MoE or when unavailable)Purpose
fwd_expert_replay_datasupports MoE router replay by reusing forward expert selections during backward, keeping training consistentUsage Example
Compatibility
router_replay_r2=Falsepreserves previous behavior and remains backward compatiblerouter_replay_r2=Trueis passedTesting Checklist
router_replay_r2=False, return type and content match the previous implementationrouter_replay_r2=True, returned dict includeslogprobsandfwd_expert_replay_datafwd_expert_replay_dataworks correctly withforward_backward