Implement the load-balancing aux loss and a training step demonstrating it equalizes exper

Mixture-of-Experts3 / 4

Chapter 083 / 4

Mixture-of-Experts

Implement the load-balancing aux loss and a training step demonstrating it equalizes exper

Hard

Implement the load-balancing aux loss and a training step demonstrating it equalizes expert usage on synthetic data.

Target interface
load_balance_loss(logits, k, n_experts)

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.