Skip to content
DeepForgeby svx
All problems
MediumDeep Learningdl-310

MoE Load Balance

Problem

Compute the expert load imbalance factor: max expert token count divided by the mean count.

The signature is moe_load_balance(expert_counts). Return a float; 1.0 means perfectly balanced.

Hint

Imbalance makes some experts idle while others become throughput bottlenecks.

Test cases

case 1
in: [[10,10,10,10]]
expected: 1
case 2
in: [[20,0,0,0]]
expected: 4
case 3
in: [[5,5,0,0]]
expected: 2
case 4
in: [[3,1,2,4]]
expected: 1.6
Starter codePython
def moe_load_balance(expert_counts):
    # Your code here
    pass

4 test cases · run your code against them in the editor