All problems
MoE Throughput Gain
Problem
Compute the sparse-activation throughput gain of a mixture-of-experts model: total_params / active_params.
The signature is moe_throughput_gain(total_params, active_params).
Hint
Sparse MoE scales total parameters without scaling per-token compute.
Test cases
case 1
in: [1000000,100000]
expected: 10
case 2
in: [8,8]
expected: 1
case 3
in: [47000000000,13000000000]
expected: 3.6153846154
case 4
in: [100,10]
expected: 10
Starter codePython
def moe_throughput_gain(total_params, active_params):
# Your code here
pass4 test cases · run your code against them in the editor