All problems
SmoothQuant Migration Factor
Problem
Compute the SmoothQuant migration scale for one channel: s = act_max_abs^alpha / weight_max_abs^(1 - alpha). Activations are divided by s and weights multiplied by s, moving quantization difficulty from activations to weights.
The signature is smoothquant_scale(act_max_abs, weight_max_abs, alpha).
Hint
Alpha = 0.5 balances the two dynamic ranges in the geometric mean.
Test cases
case 1
in: [10,1,0.5]
expected: 3.1622776602
case 2
in: [4,1,0.5]
expected: 2
case 3
in: [10,1,0]
expected: 1
case 4
in: [10,1,1]
expected: 10
case 5
in: [8,2,0.5]
expected: 2
Starter codePython
def smoothquant_scale(act_max_abs, weight_max_abs, alpha):
# Your code here
pass5 test cases · run your code against them in the editor