transformers
fe095140 - Experts: per-expert post norms through `_apply_post_expert_norm`, Ergo on the stock experts backends (#51615)

Commit
23 hours ago
Experts: per-expert post norms through `_apply_post_expert_norm`, Ergo on the stock experts backends (#51615) * Experts: per-expert post norms through `_apply_post_expert_norm`, Ergo on the stock experts backends Ergo's routed experts each have their own RMSNorm scale, applied before the weighted sum. Instead of repeating the hidden states top-k times and running the backend at top-k 1 with unit weights, the experts integration now calls the class's `_apply_post_expert_norm(proj_out, expert_ids)`, and Ergo is one decorated `ErgoExperts`. MuseSpark defines the hook for its shared norm. FP8 batched/grouped and DeepGEMM bf16/FP8/FP4 apply it too (they skipped or refused the norm); Mega MoE fuses the reduction, so it refuses experts with a post norm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Ergo: eager experts norm and weight every route at once Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Experts: `_apply_post_expert_norm` after `forward` in every file, where the converter puts it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Ergo eager experts on the usual expert mask pattern, DeepGEMM `_combine_routed_output` kwargs deprecated for BC Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * DeepGEMM: drop the `_combine_routed_output` kwarg deprecation, it's a private helper Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Experts tests: the megamoe stand-in experts carry has_post_expert_norm Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Parents
Loading