You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[TokenSwitch] Support topk_weights gradient in dispatch so the MoE router can train #201470
Autograd computes the gradient of recv_weights, but dispatch backward drops it. So the router weights get no gradient from the main loss, and the router does not learn which experts to pick. The expert weights and the token gradients are correct. All backends inherit this, because the autograd is in the base class.
Proposed Solution
Return a gradient for topk_weights from dispatch backward. Send grad_out_topk_weights back to the source rank, one value for each (token, expert) pair. Backends that do not support this can keep the current behavior.
Activity
[TokenSwitch] Support `topk_weights` gradients (pytorch#201642)
[TokenSwitch] Support `topk_weights` gradients (pytorch#201642)
[TokenSwitch] Support `topk_weights` gradients (pytorch#201642)